Class: Incandescent::ServiceCall

Inherits:
Object
  • Object
show all
Defined in:
lib/incandescent/service_call.rb

Constant Summary collapse

ENDPOINT =
'https://incandescent.xyz/'

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#connectionObject (readonly)

Returns the value of attribute connection.



7
8
9
# File 'lib/incandescent/service_call.rb', line 7

def connection
  @connection
end

#method_pathObject (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

#payloadObject (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

#resultsObject



21
22
23
# File 'lib/incandescent/service_call.rb', line 21

def results
  make_post_request(method_path, payload)
end