Module: FuncLive
- Defined in:
- lib/func_live.rb,
lib/func_live/client.rb,
lib/func_live/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
- .call(function_name, input = nil) ⇒ Object
- .client ⇒ Object
- .default_token ⇒ Object
- .token ⇒ Object
-
.token=(token) ⇒ Object
rubocop:disable Style/TrivialAccessors.
Class Method Details
.call(function_name, input = nil) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/func_live.rb', line 30 def call(function_name, input = nil) response = client.functions(function_name, input) if response["success"] == false raise FuncLive::Error, response["error"] end response["output"] end |
.client ⇒ Object
26 27 28 |
# File 'lib/func_live.rb', line 26 def client @client ||= FuncLive::Client.new(token) end |
.default_token ⇒ Object
10 11 12 |
# File 'lib/func_live.rb', line 10 def default_token ENV["FUNC_LIVE_TOKEN"] end |
.token ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/func_live.rb', line 18 def token if @token.to_s.empty? && default_token.to_s.empty? raise FuncLive::Error, "FuncLive.token is empty" end @token || default_token end |
.token=(token) ⇒ Object
rubocop:disable Style/TrivialAccessors
14 15 16 |
# File 'lib/func_live.rb', line 14 def token=(token) # rubocop:disable Style/TrivialAccessors @token = token end |