Class: Versafleet::Client
- Inherits:
-
Object
- Object
- Versafleet::Client
- Defined in:
- lib/versafleet/client.rb
Constant Summary collapse
- BASE_URL =
"https://api.versafleet.co/api"
Instance Attribute Summary collapse
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
readonly
Returns the value of attribute client_secret.
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(client_id:, client_secret:) ⇒ Client
constructor
A new instance of Client.
- #jobs ⇒ Object
- #tasks ⇒ Object
Constructor Details
#initialize(client_id:, client_secret:) ⇒ Client
Returns a new instance of Client.
7 8 9 10 |
# File 'lib/versafleet/client.rb', line 7 def initialize(client_id:, client_secret:) @client_id = client_id @client_secret = client_secret end |
Instance Attribute Details
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
5 6 7 |
# File 'lib/versafleet/client.rb', line 5 def client_id @client_id end |
#client_secret ⇒ Object (readonly)
Returns the value of attribute client_secret.
5 6 7 |
# File 'lib/versafleet/client.rb', line 5 def client_secret @client_secret end |
Instance Method Details
#connection ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/versafleet/client.rb', line 20 def connection @connection ||= Faraday.new(params: default_params) do |conn| conn.url_prefix = BASE_URL conn.request :json conn.response :json, content_type: "application/json" conn.adapter Faraday.default_adapter end end |
#jobs ⇒ Object
12 13 14 |
# File 'lib/versafleet/client.rb', line 12 def jobs JobsResource.new(self) end |
#tasks ⇒ Object
16 17 18 |
# File 'lib/versafleet/client.rb', line 16 def tasks TasksResource.new(self) end |