Class: KudagoClient::Connection

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

Constant Summary collapse

BASE_URL =
"https://kudago.com/public-api/v1.4/"

Class Method Summary collapse

Class Method Details

.connectionObject



12
13
14
15
16
17
18
# File 'lib/kudago_client/connection.rb', line 12

def self.connection
  Faraday.new(options) do |faraday|
    faraday.request :url_encoded
    faraday.response :json, parser_options: {decoder: Oj, symbolize_names: true}
    faraday.adapter Faraday.default_adapter
  end
end

.headersObject



29
30
31
32
33
34
# File 'lib/kudago_client/connection.rb', line 29

def self.headers
  {
    "Accept" => "application/json",
    "User-Agent" => "Kudago Client/#{KudagoClient::VERSION}"
  }
end

.optionsObject



22
23
24
25
26
27
# File 'lib/kudago_client/connection.rb', line 22

def self.options
  {
    headers:,
    url: BASE_URL
  }
end