Class: BeyondApi::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/beyond_api/connection.rb

Class Method Summary collapse

Class Method Details

.defaultObject


7
8
9
10
11
12
13
14
15
16
17
# File 'lib/beyond_api/connection.rb', line 7

def self.default
  Faraday.new(ssl: { verify: true }) do |faraday|
    faraday.options[:open_timeout] = BeyondApi.configuration.open_timeout.to_i
    faraday.options[:timeout] = BeyondApi.configuration.timeout.to_i
    faraday.headers['Accept'] = 'application/json'
    faraday.headers['Content-Type'] = 'application/json'
    faraday.request(:multipart)
    faraday.request(:url_encoded)
    faraday.adapter(:net_http)
  end
end

.tokenObject


19
20
21
22
23
24
25
26
27
28
# File 'lib/beyond_api/connection.rb', line 19

def self.token
  Faraday.new(ssl: { verify: true }) do |faraday|
    faraday.options[:open_timeout] = BeyondApi.configuration.open_timeout.to_i
    faraday.options[:timeout] = BeyondApi.configuration.timeout.to_i
    faraday.headers['Accept'] = 'application/json'
    faraday.adapter(:net_http)
    faraday.basic_auth(BeyondApi.configuration.client_id,
                       BeyondApi.configuration.client_secret)
  end
end