Class: Clubhouse::Workflow

Inherits:
ClubhouseResource show all
Defined in:
lib/clubhouse2/workflow.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ClubhouseResource

#api_url, #delete!, #flush, inherited, property_filter_create, property_filter_update, #resolve_to_ids, #set_properties, subclass, #to_h, #update, validate, #value_format

Constructor Details

#initialize(client:, object:) ⇒ Workflow

Returns a new instance of Workflow.



7
8
9
10
11
12
13
14
# File 'lib/clubhouse2/workflow.rb', line 7

def initialize(client:, object:)
	super
	@states = []
	object['states'].each do |this_state|
		this_state[:workflow_id] = @id
		@states << State.new(client: client, object: this_state)
	end
end

Class Method Details

.api_urlObject



16
17
18
# File 'lib/clubhouse2/workflow.rb', line 16

def self.api_url
	'workflows'
end

.propertiesObject



3
4
5
# File 'lib/clubhouse2/workflow.rb', line 3

def self.properties
	[ :created_at, :default_state_id, :description, :entity_type, :id, :name, :team_id, :updated_at ]
end

Instance Method Details

#state(**args) ⇒ Object



24
# File 'lib/clubhouse2/workflow.rb', line 24

def state(**args); states(args).first; end

#states(**args) ⇒ Object



20
21
22
# File 'lib/clubhouse2/workflow.rb', line 20

def states(**args)
	@states.reject { |s| args.collect { |k,v| s.send(k) != v }.reduce(:|) }
end