Class: Lyft::Connection

Inherits:
Faraday::Connection
  • Object
show all
Defined in:
lib/lyft/connection.rb

Overview

Used to perform requests against Lyft’s API.

Instance Method Summary collapse

Constructor Details

#initialize(url = nil, options = nil, &block) ⇒ Connection

Returns a new instance of Connection.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/lyft/connection.rb', line 5

def initialize(url=nil, options=nil, &block)

  if url.is_a? Hash
    options = url
    url = options[:url]
  end

  url = default_url if url.nil?

  super url, options, &block

  # We need to use the FlatParamsEncoder so we can pass multiple of
  # the same param to certain endpoints (like the search API).
  self.options.params_encoder = ::Faraday::FlatParamsEncoder

  self.response :lyft_raise_error
end