Class: TrackerApi::Endpoints::Projects

Inherits:
Object
  • Object
show all
Defined in:
lib/tracker_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/tracker_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/tracker_api/endpoints/projects.rb', line 4

def client
  @client
end

Instance Method Details

#get(params = {}) ⇒ Object



10
11
12
13
14
15
# File 'lib/tracker_api/endpoints/projects.rb', line 10

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

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