Class: Ehpt::GetProject

Inherits:
Base
  • Object
show all
Defined in:
lib/ehpt/get_project.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#data, #errors

Instance Method Summary collapse

Methods inherited from Base

call, #error?, #success?

Constructor Details

#initialize(token, project_id) ⇒ GetProject

Returns a new instance of GetProject.



8
9
10
11
12
# File 'lib/ehpt/get_project.rb', line 8

def initialize(token, project_id)
  @token = token || ENV['PIVOTAL_TRACKER_TOKEN']
  @project_id = project_id || ENV['PIVOTAL_TRACKER_PROJECT_ID']
  super
end

Instance Attribute Details

#project_idObject (readonly)

Returns the value of attribute project_id.



6
7
8
# File 'lib/ehpt/get_project.rb', line 6

def project_id
  @project_id
end

#tokenObject (readonly)

Returns the value of attribute token.



6
7
8
# File 'lib/ehpt/get_project.rb', line 6

def token
  @token
end

Instance Method Details

#callObject



14
15
16
17
18
19
# File 'lib/ehpt/get_project.rb', line 14

def call
  pt_client = TrackerApi::Client.new(token: token)
  @data = pt_client.project(project_id)
rescue StandardError => e
  @errors << e.message
end