Class: Brazify::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/brazify/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(config: Brazify.config) ⇒ Client

Returns a new instance of Client.



6
7
8
# File 'lib/brazify/client.rb', line 6

def initialize(config: Brazify.config)
  @config = config
end

Instance Method Details

#connectionObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/brazify/client.rb', line 10

def connection
  @connection ||= Faraday.new(config.base_url) do |conn|
    conn.request config.format
    conn.request :authorization, 'Bearer', config.api_key
    conn.response config.format, content_type: 'application/json'

    conn.options[:timeout] = config.timeout
    conn.options[:open_timeout] = config.open_timeout
  end
end