Class: Hookers::Pivotal::TrackerProject
- Inherits:
-
Object
- Object
- Hookers::Pivotal::TrackerProject
- Defined in:
- lib/hookers/pivotal/tracker_project.rb
Instance Attribute Summary collapse
-
#base_uri ⇒ Object
Returns the value of attribute base_uri.
-
#git ⇒ Object
Returns the value of attribute git.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #commit_uri ⇒ Object
-
#initialize(token) ⇒ TrackerProject
constructor
A new instance of TrackerProject.
- #notify_changes ⇒ Object
Constructor Details
#initialize(token) ⇒ TrackerProject
Returns a new instance of TrackerProject.
8 9 10 11 12 13 |
# File 'lib/hookers/pivotal/tracker_project.rb', line 8 def initialize(token) raise "Pivotal api token not found" unless token self.token = token self.git = Git::Repository.new self.base_uri = 'http://www.pivotaltracker.com/' end |
Instance Attribute Details
#base_uri ⇒ Object
Returns the value of attribute base_uri.
6 7 8 |
# File 'lib/hookers/pivotal/tracker_project.rb', line 6 def base_uri @base_uri end |
#git ⇒ Object
Returns the value of attribute git.
6 7 8 |
# File 'lib/hookers/pivotal/tracker_project.rb', line 6 def git @git end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/hookers/pivotal/tracker_project.rb', line 6 def token @token end |
Instance Method Details
#commit_uri ⇒ Object
15 16 17 |
# File 'lib/hookers/pivotal/tracker_project.rb', line 15 def commit_uri "#{self.base_uri}services/v3/source_commits" end |
#notify_changes ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/hookers/pivotal/tracker_project.rb', line 19 def notify_changes puts "Notifying pivotal tracker of changes..." commit = git.last_commit response = HttpClient.post(commit_uri, commit.to_xml, { "X-TrackerToken" => self.token, "Content-type" => "application/xml" }) puts "Pivotal notified succesfully" if response.code == "200" end |