Class: Fleetly::Client
- Inherits:
-
Object
- Object
- Fleetly::Client
- Extended by:
- Forwardable
- Defined in:
- lib/fleetly/client.rb
Instance Attribute Summary collapse
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#connection ⇒ Faraday::Connection
Create a Faraday::Connection object.
-
#initialize(options = {}) ⇒ Client
constructor
Create a new Fleetly::Client object.
Methods included from Logitem
#get_logitem_details, #get_logitems
Methods included from Activity
#get_activities, #get_activity
Methods included from User
Methods included from Request
Constructor Details
Instance Attribute Details
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
17 18 19 |
# File 'lib/fleetly/client.rb', line 17 def api_url @api_url end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
17 18 19 |
# File 'lib/fleetly/client.rb', line 17 def token @token end |
Instance Method Details
#connection ⇒ Faraday::Connection
Create a Faraday::Connection object
32 33 34 35 36 37 38 39 40 |
# File 'lib/fleetly/client.rb', line 32 def connection params = {} @connection = Faraday.new(url: api_url, params: params, headers: default_headers) do |faraday| faraday.use FaradayMiddleware::Mashify faraday.use FaradayMiddleware::ParseJson, content_type: /\bjson$/ faraday.use FaradayMiddleware::FollowRedirects faraday.adapter Faraday.default_adapter end end |