Sha256: 2173573aa20fe047cc9020f22e1ebc2a486d7700d5fee8923686a3e0d3962c6d

Contents?: true

Size: 1009 Bytes

Versions: 59

Compression:

Stored size: 1009 Bytes

Contents

module FaaStRuby
  class Function < BaseObject
    attr_accessor :name, :workspace, :errors, :context, :updated_at, :created_at

    def run(options)
      options['method'] ||= 'get'
      options['headers'] ||= {}
      response = @api.run(function_name: name, workspace_name: options['workspace_name'], payload: options['body'], method: options['method'], headers: options['headers'], time: options['time'], query: options['query'])
      response
    end

    def destroy
      response = @api.delete_from_workspace(function_name: self.name, workspace_name: @workspace.name)
      @errors += response.errors if response.errors.any?
    end

    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
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
faastruby-0.5.30 lib/faastruby/function.rb
faastruby-0.5.29 lib/faastruby/function.rb
faastruby-0.5.28 lib/faastruby/function.rb
faastruby-0.5.27 lib/faastruby/function.rb
faastruby-0.5.26 lib/faastruby/function.rb
faastruby-0.5.25 lib/faastruby/function.rb
faastruby-0.5.24 lib/faastruby/function.rb
faastruby-0.5.23 lib/faastruby/function.rb
faastruby-0.5.22 lib/faastruby/function.rb
faastruby-0.5.21 lib/faastruby/function.rb
faastruby-0.5.20 lib/faastruby/function.rb
faastruby-0.5.19 lib/faastruby/function.rb
faastruby-0.5.18 lib/faastruby/function.rb
faastruby-0.5.17 lib/faastruby/function.rb
faastruby-0.5.16 lib/faastruby/function.rb
faastruby-0.5.15 lib/faastruby/function.rb
faastruby-0.5.14 lib/faastruby/function.rb
faastruby-0.5.13 lib/faastruby/function.rb
faastruby-0.5.12 lib/faastruby/function.rb
faastruby-0.5.11 lib/faastruby/function.rb