Sha256: 29ea1de9f8e1abc879cce9ada5c01108f3d709f63879a657ef12f4b82a5f88e2

Contents?: true

Size: 920 Bytes

Versions: 3

Compression:

Stored size: 920 Bytes

Contents

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

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

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

    def update
      payload = {'context' => context}
      response = @api.update_function_context(function: self, workspace: @workspace, 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

3 entries across 3 versions & 1 rubygems

Version Path
faastruby-0.2.2 lib/faastruby/function.rb
faastruby-0.2.1 lib/faastruby/function.rb
faastruby-0.2.0 lib/faastruby/function.rb