Class: FuncLive::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/func_live/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Client

Returns a new instance of Client.



11
12
13
14
15
16
# File 'lib/func_live/client.rb', line 11

def initialize(token)
  @headers = {
    "Content-Type" => "application/json",
    "Authorization" => "Bearer #{token}"
  }
end

Instance Method Details

#functions(function_name, input = nil) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/func_live/client.rb', line 18

def functions(function_name, input = nil)
  body = { input: input }
  self.class.post(
    "/functions/#{function_name}",
    headers: @headers,
    body: body.to_json
  )
end