Class: Clubhouse::Project

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ClubhouseResource

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

Constructor Details

This class inherits a constructor from Clubhouse::ClubhouseResource

Class Method Details

.api_urlObject



10
11
12
# File 'lib/clubhouse2/project.rb', line 10

def self.api_url
	'projects'
end

.propertiesObject



3
4
5
6
7
8
# File 'lib/clubhouse2/project.rb', line 3

def self.properties
	[
		:abbreviation, :archived, :color, :created_at, :days_to_thermometer, :description, :entity_type, :external_id,
		:follower_ids, :id, :iteration_length, :name, :show_thermometer, :start_time, :stats, :updated_at
	]
end

Instance Method Details

#create_story(**args) ⇒ Object



19
20
21
22
23
24
# File 'lib/clubhouse2/project.rb', line 19

def create_story(**args)
	@stories = nil
	args[:project_id] = @id
	Story.validate(**args)
	@client.create_object(:story, args)
end

#stories(**args) ⇒ Object



14
15
16
17
# File 'lib/clubhouse2/project.rb', line 14

def stories(**args)
	@stories ||= JSON.parse(@client.api_request(:get, @client.url("#{api_url}/stories"))).collect { |story| Story.new(client: @client, object: story) }
	@stories.reject { |s| args.collect { |k,v| s.send(k) != v }.reduce(:|) }
end

#story(**args) ⇒ Object



26
# File 'lib/clubhouse2/project.rb', line 26

def story(**args); stories(args).first; end