Class: FaaStRuby::Function
- Inherits:
-
BaseObject
- Object
- BaseObject
- FaaStRuby::Function
- Defined in:
- lib/faastruby/function.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#name ⇒ Object
Returns the value of attribute name.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#workspace ⇒ Object
Returns the value of attribute workspace.
Instance Method Summary collapse
Methods inherited from BaseObject
#assign_attributes, #attributes=, #call_api, #initialize, #mass_assign
Constructor Details
This class inherits a constructor from FaaStRuby::BaseObject
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
3 4 5 |
# File 'lib/faastruby/function.rb', line 3 def context @context end |
#created_at ⇒ Object
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/faastruby/function.rb', line 3 def created_at @created_at end |
#errors ⇒ Object
Returns the value of attribute errors.
3 4 5 |
# File 'lib/faastruby/function.rb', line 3 def errors @errors end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/faastruby/function.rb', line 3 def name @name end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
3 4 5 |
# File 'lib/faastruby/function.rb', line 3 def updated_at @updated_at end |
#workspace ⇒ Object
Returns the value of attribute workspace.
3 4 5 |
# File 'lib/faastruby/function.rb', line 3 def workspace @workspace end |
Instance Method Details
#destroy ⇒ Object
12 13 14 15 |
# File 'lib/faastruby/function.rb', line 12 def destroy response = @api.delete_from_workspace(function_name: self.name, workspace_name: @workspace.name) @errors += response.errors if response.errors.any? end |
#run(options) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/faastruby/function.rb', line 5 def run() ['method'] ||= 'get' ['headers'] ||= {} response = @api.run(function_name: name, workspace_name: ['workspace_name'], payload: ['body'], method: ['method'], headers: ['headers'], time: ['time'], query: ['query']) response end |
#update(new_context:) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/faastruby/function.rb', line 17 def update(new_context:) payload = {'context' => new_context} response = @api.update_function_context(function_name: self.name, workspace_name: @workspace.name, payload: payload) @errors += response.errors if response.errors.any? unless @errors.any? self.context = response.body['context'] end self end |