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



13
14
15
16
17
18
19
20
21
22
# File 'lib/setka/workflow/resource.rb', line 13

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



9
10
11
# File 'lib/setka/workflow/resource.rb', line 9

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



5
6
7
# File 'lib/setka/workflow/resource.rb', line 5

def member(http_verb, id, action = nil, body = nil, options)
  actual_client(options).send(http_verb, path(action, id), body, options)
end