Class: PivotalApi::Endpoints::Projects

Inherits:
Object
  • Object
show all
Defined in:
lib/pivotal_api/endpoints/projects.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Projects

Returns a new instance of Projects.



6
7
8
# File 'lib/pivotal_api/endpoints/projects.rb', line 6

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/pivotal_api/endpoints/projects.rb', line 4

def client
  @client
end

Instance Method Details

#all(params = {}) ⇒ Array[PivotalApi::Resources::Project]

Parameters:

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

Returns:

Raises:



12
13
14
15
16
17
# File 'lib/pivotal_api/endpoints/projects.rb', line 12

def all(params={})
  data = client.paginate('/projects', params: params)
  raise PivotalApi::Errors::UnexpectedData, 'Array of projects expected' unless data.is_a? Array

  data.map { |project| Resources::Project.new({ }.merge(project)) }
end

#epicsObject



29
30
31
# File 'lib/pivotal_api/endpoints/projects.rb', line 29

def epics
  Endpoints::Epics.new(client)
end

#get(id, params = {}) ⇒ PivotalApi::Resources::Project

Parameters:

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

Returns:



22
23
24
25
26
27
# File 'lib/pivotal_api/endpoints/projects.rb', line 22

def get(id, params={})
  # Endpoints::Project.new(self).get(id, params)
  data = client.get("/projects/#{id}", params: params).body

  Resources::Project.new({ }.merge(data))
end

#iterationsObject



33
34
35
# File 'lib/pivotal_api/endpoints/projects.rb', line 33

def iterations
  Endpoints::Iterations.new(client)
end

#membershipsObject



41
42
43
# File 'lib/pivotal_api/endpoints/projects.rb', line 41

def memberships
  Endpoints::Memberships.new(client)
end

#storiesObject



37
38
39
# File 'lib/pivotal_api/endpoints/projects.rb', line 37

def stories
  Endpoints::Stories.new(client)
end

#webhooksObject



45
46
47
# File 'lib/pivotal_api/endpoints/projects.rb', line 45

def webhooks
  Endpoints::Webhooks.new(client)
end