class Setka::Workflow::Resource

Public Class Methods

actual_client(options) click to toggle source
# File lib/setka/workflow/resource.rb, line 17
def actual_client(options)
  if options[:client]
    raise ConfigurationError.new('Wrong client is specified') unless
      options[:client].is_a?(Setka::Workflow::Client)

    options[:client]
  else
    Setka::Workflow.client
  end
end
collection(http_verb, action = nil, body = nil, options) click to toggle source

Abstract operation's execution over a collection of a resource.

# File lib/setka/workflow/resource.rb, line 13
def collection(http_verb, action = nil, body = nil, options)
  actual_client(options).send(http_verb, path(action), body, options)
end
member(http_verb, id, action = nil, body = nil, options) click to toggle source

Abstract operation's execution over a member of a resource.

# File lib/setka/workflow/resource.rb, line 7
def member(http_verb, id, action = nil, body = nil, options)
  actual_client(options).send(http_verb, path(action, id), body, options)
end

Private Class Methods

path(action, id = nil) click to toggle source
# File lib/setka/workflow/resource.rb, line 30
def path(action, id = nil)
  id_clause = "/#{id}" if id
  action_clause = "/#{action}" if action

  "#{resource_plural}#{id_clause}#{action_clause}.json"
end
resource_plural() click to toggle source
# File lib/setka/workflow/resource.rb, line 37
def resource_plural; end