class Clubhouse::Epic
Public Class Methods
api_url()
click to toggle source
# File lib/clubhouse2/epic.rb, line 11 def self.api_url 'epics' end
properties()
click to toggle source
# File lib/clubhouse2/epic.rb, line 3 def self.properties [ :archived, :comments, :completed, :completed_at, :completed_at_override, :created_at, :deadline, :description, :entity_type, :external_id, :follower_ids, :id, :labels, :milestone_id, :name, :owner_ids, :position, :project_ids, :started, :started_at, :started_at_override, :state, :stats, :updated_at ] end
Public Instance Methods
comment(**args)
click to toggle source
# File lib/clubhouse2/epic.rb, line 52 def comment(**args); comments(args).first; end
comments(**args)
click to toggle source
# File lib/clubhouse2/epic.rb, line 31 def comments(**args) # The API is missing a parent epic ID property, so we need to fake it here args[:epic_id] = @id @comments ||= JSON.parse(@client.api_request(:get, @client.url("#{api_url}/#{Epiccomment.api_url}"))).collect { |task| Epiccomment.new(client: @client, object: comment) } @comments.reject { |s| args.collect { |k,v| s.send(k) != v }.reduce(:|) } end
create_comment(**args)
click to toggle source
# File lib/clubhouse2/epic.rb, line 44 def create_comment(**args) Task.validate(args) response = JSON.parse(@client.api_request(:post, @client.url("#{api_url}/#{Epiccomment.api_url}"), :json => args)) raise ClubhouseAPIError.new(response) unless response.code == 201 @comments = nil response end
stories()
click to toggle source
# File lib/clubhouse2/epic.rb, line 15 def stories @client.projects.collect(&:stories).reduce(:+).select { |s| s.epic_id == @id } end
to_h()
click to toggle source
Calls superclass method
Clubhouse::ClubhouseResource#to_h
# File lib/clubhouse2/epic.rb, line 38 def to_h super.merge({ comments: @comments.collect(&:to_h) }) end
validate(args)
click to toggle source
# File lib/clubhouse2/epic.rb, line 19 def validate(args) raise NoSuchTeam.NoSuchTeam(args[:team_id]) unless @client.get_team(id: args[:team_id]) (args[:follower_ids] || []).each do |this_member| raise NoSuchMember.NoSuchMember(this_member) unless @client.get_member(id: this_member) end (args[:owner_ids] || []).each do |this_member| raise NoSuchMember.NoSuchMember(this_member) unless @client.get_member(id: this_member) end end