module Polyseerio::SDK::Static

SDK static module.

Static methods.

Static methods.

Static methods.

Static methods.

Static methods.

Static methods.

Static methods.

Static methods.

Static methods.

Static methods.

Static methods.

Static methods.

Static methods.

Constants

MAP

Public Class Methods

attach() click to toggle source
# File lib/sdk/static/attach.rb, line 5
def self.attach
  proc do ||
  end
end
check() click to toggle source
# File lib/sdk/static/check.rb, line 5
def self.check
  proc do ||
  end
end
create() click to toggle source
# File lib/sdk/static/create.rb, line 9
def self.create
  proc do |request, resource, copts, attributes, options = {}|
    options = Polyseerio::Helper.defaults(options, copts)

    eid = Helper.resolve_eid options
    uri = URL.get_resource_path(resource, eid: eid)

    request.post(uri, attributes)
  end
end
detach() click to toggle source
# File lib/sdk/static/detach.rb, line 5
def self.detach
  proc do ||
  end
end
execute() click to toggle source
# File lib/sdk/static/execute.rb, line 5
def self.execute
  proc do ||
  end
end
factory(request, resource, statics = [], options = {}) click to toggle source

Generates static functions.

# File lib/sdk/factory.rb, line 10
def self.factory(request, resource, statics = [], options = {})
  accumulator = Helper.accumulate_procs('static', MAP)

  statics = statics.each_with_object({}, &accumulator)

  # curry request, resource, and options
  statics.each_with_object(statics) do |(name, static), hash|
    if static.arity > 3
      hash[name] = static.curry.call(request, resource, options)
    end
  end

  statics
end
find() click to toggle source
# File lib/sdk/static/find.rb, line 8
def self.find
  # TODO; issue with arg arity on curry when all optional
  proc do |request, resource, _copts, _query, options = {}|
    eid = Helper.resolve_eid options
    uri = URL.get_resource_path(resource, eid: eid)

    # TODO: add query string
    request.get uri
  end
end
find_by_id() click to toggle source
# File lib/sdk/static/find_by_id.rb, line 9
def self.find_by_id
  proc do |request, resource, copts, id, options = {}|
    options = Polyseerio::Helper.defaults(options, copts)

    eid = Helper.resolve_eid options
    uri = URL.get_resource_path(resource, eid: eid, id: id)

    request.get uri
  end
end
find_by_name() click to toggle source
# File lib/sdk/static/find_by_name.rb, line 8
def self.find_by_name
  proc do |request, resource, copts, name, options = {}|
    options = Polyseerio::Helper.defaults(options, copts)

    name = "/name/#{name}"
    eid = Helper.resolve_eid options

    uri = URL.get_resource_path(resource, eid: eid)

    uri = if resource == Polyseerio::Enum::Resource::ENVIRONMENT
            "/environments#{name}"
          else
            "#{uri}#{name}"
          end

    request.get uri
  end
end
message() click to toggle source
# File lib/sdk/static/message.rb, line 5
def self.message
  proc do |request, resource, _, attributes, options|
    eid = resolve_eid options
    uri = get_resource_path(resource, eid: eid)

    request.post(uri, attributes)
  end
end
remove() click to toggle source
# File lib/sdk/static/remove.rb, line 9
def self.remove
  proc do |request, resource, copts, id, options = {}|
    options = Polyseerio::Helper.defaults(options, copts)

    eid = Helper.resolve_eid options
    uri = URL.get_resource_path(resource, eid: eid, id: id)

    request.delete uri
  end
end
trigger() click to toggle source
# File lib/sdk/static/trigger.rb, line 5
def self.trigger
  proc do |request, resource, copts, id, payload = {}, options = {}| # rubocop:disable all
    options = Polyseerio::Helper.defaults(options, copts)

    eid = Helper.resolve_eid options
    uri = URL.get_resource_path(resource, eid: eid, id: id)

    request.post("#{uri}/trigger", payload)
  end
end
update() click to toggle source
# File lib/sdk/static/update.rb, line 5
def self.update
  # TODO: unit-test
  proc do |request, resource, copts, id, updates = {}, options = {}| # rubocop:disable all
    options = Polyseerio::Helper.defaults(options, copts)

    eid = Helper.resolve_eid options
    uri = URL.get_resource_path(resource, eid: eid, id: id)

    request.put(uri, updates)
  end
end