Class: VehicleData::Base
- Inherits:
-
Object
- Object
- VehicleData::Base
- Defined in:
- lib/vehicle_data.rb
Instance Attribute Summary collapse
-
#app_key ⇒ Object
Returns the value of attribute app_key.
-
#data ⇒ Object
Returns the value of attribute data.
-
#options ⇒ Object
Returns the value of attribute options.
-
#request ⇒ Object
Returns the value of attribute request.
-
#response ⇒ Object
Returns the value of attribute response.
-
#secret ⇒ Object
Returns the value of attribute secret.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #send_request ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
24 25 26 27 28 |
# File 'lib/vehicle_data.rb', line 24 def initialize(={}) @app_key = VehicleData.configuration.app_key @secret = VehicleData.configuration.secret @data = .merge!({ :app => @app_key, :v => 0.2, :t => Time.now.to_i }) end |
Instance Attribute Details
#app_key ⇒ Object
Returns the value of attribute app_key.
22 23 24 |
# File 'lib/vehicle_data.rb', line 22 def app_key @app_key end |
#data ⇒ Object
Returns the value of attribute data.
22 23 24 |
# File 'lib/vehicle_data.rb', line 22 def data @data end |
#options ⇒ Object
Returns the value of attribute options.
22 23 24 |
# File 'lib/vehicle_data.rb', line 22 def end |
#request ⇒ Object
Returns the value of attribute request.
22 23 24 |
# File 'lib/vehicle_data.rb', line 22 def request @request end |
#response ⇒ Object
Returns the value of attribute response.
22 23 24 |
# File 'lib/vehicle_data.rb', line 22 def response @response end |
#secret ⇒ Object
Returns the value of attribute secret.
22 23 24 |
# File 'lib/vehicle_data.rb', line 22 def secret @secret end |
Instance Method Details
#send_request ⇒ Object
30 31 32 33 |
# File 'lib/vehicle_data.rb', line 30 def send_request response = Typhoeus.get("#{base_uri}/?#{build_params(@data)}&hash=#{calculate_signature}") JSON.parse(response.body) end |