Class: Incandescent::ServiceCall
- Inherits:
-
Object
- Object
- Incandescent::ServiceCall
- Defined in:
- lib/incandescent/service_call.rb
Constant Summary collapse
- ENDPOINT =
'https://incandescent.xyz/'
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#method_path ⇒ Object
readonly
Returns the value of attribute method_path.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Instance Method Summary collapse
-
#initialize(method_path, params) ⇒ ServiceCall
constructor
A new instance of ServiceCall.
- #results ⇒ Object
Constructor Details
#initialize(method_path, params) ⇒ ServiceCall
Returns a new instance of ServiceCall.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/incandescent/service_call.rb', line 9 def initialize(method_path, params) @connection = Faraday.new(url: ENDPOINT) @method_path = method_path expire_time = Time.now.to_i + 60*15 @payload = {uid: ENV['INCANDESCENT_UID'], auth: auth_token(expire_time), expires: expire_time} @payload.merge!(params) end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
7 8 9 |
# File 'lib/incandescent/service_call.rb', line 7 def connection @connection end |
#method_path ⇒ Object (readonly)
Returns the value of attribute method_path.
7 8 9 |
# File 'lib/incandescent/service_call.rb', line 7 def method_path @method_path end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
7 8 9 |
# File 'lib/incandescent/service_call.rb', line 7 def payload @payload end |
Instance Method Details
#results ⇒ Object
21 22 23 |
# File 'lib/incandescent/service_call.rb', line 21 def results make_post_request(method_path, payload) end |