Class: Smartcar::Base
Overview
The Base class for all of the other class. Let other classes inherit from here and put common methods here.
Direct Known Subclasses
Battery, Charge, EngineOil, Fuel, Location, Oauth, Odometer, Permissions, TirePressure, User, Vehicle, VehicleAttributes, Vin
Defined Under Namespace
Classes: InvalidParameterValue
Constant Summary collapse
- BEARER =
Constant for Bearer auth type
'BEARER'.freeze
- BASIC =
Constant for Basic auth type
'BASIC'.freeze
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#fetch(path:, options: {}, auth: 'BEARER') ⇒ Object
This requires a proc 'PATH' to be defined in the class.
Methods included from Utils
#get_config, #get_error, #initialize
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
16 17 18 |
# File 'lib/smartcar/base.rb', line 16 def error @error end |
#meta ⇒ Object
Returns the value of attribute meta.
16 17 18 |
# File 'lib/smartcar/base.rb', line 16 def @meta end |
#token ⇒ Object
Returns the value of attribute token.
16 17 18 |
# File 'lib/smartcar/base.rb', line 16 def token @token end |
Instance Method Details
#fetch(path:, options: {}, auth: 'BEARER') ⇒ Object
This requires a proc 'PATH' to be defined in the class
50 51 52 53 54 |
# File 'lib/smartcar/base.rb', line 50 def fetch(path: , options: {}, auth: 'BEARER') _path = path _path += "?#{URI.encode_www_form()}" unless .empty? get(_path, {auth: auth}) end |