Module: Spice::Request

Included in:
Connection
Defined in:
lib/spice/request.rb,
lib/spice/request/auth.rb

Defined Under Namespace

Classes: Auth

Instance Method Summary (collapse)

Instance Method Details

- (Object) request(options = {})



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/spice/request.rb', line 8

def request(options={})
  default_options = {
    :headers => {
      :accept => 'application/json',
      :content_type => 'application/json',
      :user_agent => Spice.user_agent
    }
  }

  Faraday.new(
    default_options.deep_merge(Spice.connection_options).deep_merge(options)
  ) do |builder|
    # builder.use Spice::Request::Auth
    builder.use Spice::Response::ClientError
    builder.use Spice::Response::ParseJSON
    builder.adapter(:net_http)
  end
end