Class: Outsmart::Client
- Inherits:
-
Object
- Object
- Outsmart::Client
- Defined in:
- lib/outsmart/client.rb
Constant Summary collapse
- BASE_URL =
"https://www.werkbonapp.nl/openapi/8"
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#software_token ⇒ Object
readonly
Returns the value of attribute software_token.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(token:, software_token:, adapter: Faraday.default_adapter) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(token:, software_token:, adapter: Faraday.default_adapter) ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 |
# File 'lib/outsmart/client.rb', line 12 def initialize(token:, software_token:, adapter: Faraday.default_adapter) @token = token @software_token = software_token @adapter = adapter end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
10 11 12 |
# File 'lib/outsmart/client.rb', line 10 def adapter @adapter end |
#software_token ⇒ Object (readonly)
Returns the value of attribute software_token.
10 11 12 |
# File 'lib/outsmart/client.rb', line 10 def software_token @software_token end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
10 11 12 |
# File 'lib/outsmart/client.rb', line 10 def token @token end |
Instance Method Details
#connection ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/outsmart/client.rb', line 18 def connection @connection ||= Faraday.new do |conn| conn.url_prefix = BASE_URL conn.request :json conn.params[:token] = @token conn.params[:software_token] = @software_token conn.response :json, content_type: "application/json" conn.adapter adapter end end |