Class: TrackerApi::Resources::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/tracker_api/resources/project.rb

Instance Method Summary collapse

Instance Method Details

#activity(params = {}) ⇒ Array[Activity]

Provides a list of all the activity performed on a project.

Parameters:

  • params (Hash) (defaults to: {})

Returns:



107
108
109
# File 'lib/tracker_api/resources/project.rb', line 107

def activity(params = {})
  Endpoints::Activity.new(client).get_project(id, params)
end

#create_story(params) ⇒ Story

Returns newly created Story.

Parameters:

  • params (Hash)

    attributes to create the story with

Returns:

  • (Story)

    newly created Story



119
120
121
# File 'lib/tracker_api/resources/project.rb', line 119

def create_story(params)
  Endpoints::Story.new(client).create(id, params)
end

#epics(params = {}) ⇒ Array[Epic]

Returns epics associated with this project.

Parameters:

  • params (Hash) (defaults to: {})

Returns:

  • (Array[Epic])

    epics associated with this project

Raises:

  • (ArgumentError)


50
51
52
53
54
55
# File 'lib/tracker_api/resources/project.rb', line 50

def epics(params={})
  raise ArgumentError, 'Expected @epics to be an Array' unless @epics.is_a? Array
  return @epics unless @epics.empty?

  @epics = Endpoints::Epics.new(client).get(id, params)
end

#iterations(params = {}) ⇒ Array[Iteration]

Returns iterations associated with this project.

Parameters:

  • params (Hash) (defaults to: {})

Options Hash (params):

  • :scope (String)

    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.

  • :number (Integer)

    The iteration to retrieve, starting at 1

  • :offset (Integer)

    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.

  • :limit (Integer)

    The number of iterations to return relative to the offset.

Returns:

  • (Array[Iteration])

    iterations associated with this project



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/tracker_api/resources/project.rb', line 66

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

#label_listString

Returns comma separated list of labels.

Returns:

  • (String)

    comma separated list of labels



44
45
46
# File 'lib/tracker_api/resources/project.rb', line 44

def label_list
  @label_list ||= labels.collect(&:name).join(',')
end

#memberships(params = {}) ⇒ Array[ProjectMembership]

Returns memberships of this project.

Parameters:

  • params (Hash) (defaults to: {})

Returns:



99
100
101
# File 'lib/tracker_api/resources/project.rb', line 99

def memberships(params = {})
  Endpoints::Memberships.new(client).get(id, params)
end

#stories(params = {}) ⇒ Array[Story]

Returns stories associated with this project.

Parameters:

  • params (Hash) (defaults to: {})

Options Hash (params):

  • :with_label (String)

    A label name which all returned stories must match.

  • :with_state (String)

    A story’s current_state which all returned stories must match. Valid enumeration values: accepted, delivered, finished, started, rejected, unstarted, unscheduled

  • :filter (String)

    This parameter supplies a search string; only stories that match the search criteria are returned. Cannot be used together with any other parameters except limit and offset. ex) state:started requester:OWK label:“jedi stuff” keyword

  • :offset (Integer)

    With the first story in your priority list as 0, the index of the first story you want returned.

  • :limit (Integer)

    The number of stories you want returned.

Returns:

  • (Array[Story])

    stories associated with this project



93
94
95
# File 'lib/tracker_api/resources/project.rb', line 93

def stories(params = {})
  Endpoints::Stories.new(client).get(id, params)
end

#story(story_id) ⇒ Story

Returns story with given id.

Parameters:

  • story_id (Fixnum)

    id of story to get

Returns:

  • (Story)

    story with given id



113
114
115
# File 'lib/tracker_api/resources/project.rb', line 113

def story(story_id)
  Endpoints::Story.new(client).get(id, story_id)
end