Class: Ehpt::GetProject
Instance Attribute Summary collapse
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(token, project_id) ⇒ GetProject
constructor
A new instance of GetProject.
Methods inherited from Base
#add_error, #add_warning, call, #error?, #success?, #warning?
Constructor Details
#initialize(token, project_id) ⇒ GetProject
Returns a new instance of GetProject.
5 6 7 8 9 |
# File 'lib/ehpt/get_project.rb', line 5 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_id ⇒ Object (readonly)
Returns the value of attribute project_id.
3 4 5 |
# File 'lib/ehpt/get_project.rb', line 3 def project_id @project_id end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
3 4 5 |
# File 'lib/ehpt/get_project.rb', line 3 def token @token end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 |
# File 'lib/ehpt/get_project.rb', line 11 def call pt_client = TrackerApi::Client.new(token: token) @data = pt_client.project(project_id) rescue StandardError => e add_error(eval(e.)[:body]) end |