lib/tracker_api/resources/project.rb in tracker_api-0.2.6 vs lib/tracker_api/resources/project.rb in tracker_api-0.2.7
- old
+ new
@@ -43,10 +43,11 @@
# @return [String] comma separated list of labels
def label_list
@label_list ||= labels.collect(&:name).join(',')
end
+ # @param [Hash] params
# @return [Array[Epic]] epics associated with this project
def epics(params={})
raise ArgumentError, 'Expected @epics to be an Array' unless @epics.is_a? Array
return @epics unless @epics.empty?
@@ -55,15 +56,27 @@
# @param [Hash] params
# @option params [String] :scope Restricts the state of iterations to return.
# If not specified, it defaults to all iterations including done.
# Valid enumeration values: done, current, backlog, current_backlog.
+ # @option params [Integer] :number The iteration to retrieve, starting at 1
# @option params [Integer] :offset The offset of first iteration to return, relative to the
# set of iterations specified by 'scope', with zero being the first iteration in the scope.
# @option params [Integer] :limit The number of iterations to return relative to the offset.
# @return [Array[Iteration]] iterations associated with this project
def iterations(params = {})
+ if params.include?(:number)
+ number = params[:number].to_i
+ raise ArgumentError, ':number must be > 0' unless number > 0
+
+ params = params.merge(auto_paginate: false, limit: 1)
+ params.delete(:number)
+
+ offset = number - 1
+ params[:offset] = offset if offset > 0
+ end
+
Endpoints::Iterations.new(client).get(id, params)
end
# @param [Hash] params
# @option params [String] :with_label A label name which all returned stories must match.
@@ -79,21 +92,31 @@
# @return [Array[Story]] stories associated with this project
def stories(params = {})
Endpoints::Stories.new(client).get(id, params)
end
+ # @param [Hash] params
+ # @return [Array[ProjectMembership]] memberships of this project
def memberships(params = {})
Endpoints::Memberships.new(client).get(id, params)
end
+ # Provides a list of all the activity performed on a project.
+ #
+ # @param [Hash] params
+ # @return [Array[Activity]]
+ def activity(params = {})
+ Endpoints::Activity.new(client).get_project(id, params)
+ end
+
# @param [Fixnum] story_id id of story to get
- # @return [Story] Story with given id
+ # @return [Story] story with given id
def story(story_id)
Endpoints::Story.new(client).get(id, story_id)
end
- # @param [Hash] hash of attributes to create the story
- # @return [Story] Story with given id
+ # @param [Hash] params attributes to create the story with
+ # @return [Story] newly created Story
def create_story(params)
Endpoints::Story.new(client).create(id, params)
end
end
end