Class: Rxer::Api::Client

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

Overview

HTTP-client based on Faraday and Excon adapter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, version: "v1") ⇒ Client

Returns a new instance of Client.



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

def initialize(url:, version: "v1")
  @api_version = version
  @conn = Faraday.new(url: url) do |f|
    f.adapter :excon, persistent: true
    f.request :json
    f.response :json
  end
  include_api_version_methods
end

Instance Attribute Details

#api_versionObject (readonly)

Returns the value of attribute api_version.



7
8
9
# File 'lib/rxer/api/client.rb', line 7

def api_version
  @api_version
end

#connObject

Returns the value of attribute conn.



8
9
10
# File 'lib/rxer/api/client.rb', line 8

def conn
  @conn
end