Class: Setka::Workflow::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/setka/workflow/resource.rb

Direct Known Subclasses

Category, Ticket

Class Method Summary collapse

Class Method Details

.actual_client(options) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# 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) ⇒ Object

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



13
14
15
# 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) ⇒ Object

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



7
8
9
# 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