Class: PivotalTracker::Console
Instance Method Summary
collapse
#display_story_info, #display_story_not_found, #display_story_title
#display_project_info, #display_project_not_found, #display_project_title
#display_error, #display_header, #display_text, included, #skip_one_line
#authenticate_by_token, included
Instance Method Details
#project(id) ⇒ Object
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/pivotal-tracker-console/console.rb', line 50
def project(id)
display_text "Details about project", :new_line
begin
project = Project.find(id)
display_project_info project
rescue RestClient::ResourceNotFound
display_project_not_found id
end
end
|
#projects ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/pivotal-tracker-console/console.rb', line 38
def projects
display_text "All projects", :new_line
Project.all.each do |project|
display_project_title project
end
end
|
#setup ⇒ Object
28
29
30
31
32
|
# File 'lib/pivotal-tracker-console/console.rb', line 28
def setup
Setup::API::Authentication.token = options[:token]
display_text "Token was setup."
end
|
#stories ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/pivotal-tracker-console/console.rb', line 67
def stories
display_text "Project's stories", :new_line
project_id = options.project
begin
project = Project.find(project_id)
display_project_title project
skip_one_line
project.stories.all(:story_type => options.type).each do |story|
display_story_title story
end
rescue RestClient::ResourceNotFound
display_project_not_found project_id
end
end
|
#story(id) ⇒ Object
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/pivotal-tracker-console/console.rb', line 90
def story(id)
display_text "Details about story", :new_line
project_id = options.project
begin
project = Project.find(project_id)
display_project_title project
skip_one_line
story = project.stories.find(id.to_i)
if story
display_story_info story
else
display_error "Story #{id} not found in the project #{project_id}"
end
rescue RestClient::ResourceNotFound
display_project_not_found id
end
end
|