Class: JenkinsTracker::TrackerClient
- Inherits:
-
Object
- Object
- JenkinsTracker::TrackerClient
- Defined in:
- lib/jenkins_tracker/tracker_client.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#use_ssl ⇒ Object
writeonly
Sets the attribute use_ssl.
Instance Method Summary collapse
- #add_note_to_story(project_id, story_id, note) ⇒ Object
- #connection(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ TrackerClient
constructor
A new instance of TrackerClient.
Constructor Details
#initialize(options = {}) ⇒ TrackerClient
Returns a new instance of TrackerClient.
7 8 9 |
# File 'lib/jenkins_tracker/tracker_client.rb', line 7 def initialize( = {}) @token = [:token] end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
5 6 7 |
# File 'lib/jenkins_tracker/tracker_client.rb', line 5 def token @token end |
#use_ssl=(value) ⇒ Object
Sets the attribute use_ssl
4 5 6 |
# File 'lib/jenkins_tracker/tracker_client.rb', line 4 def use_ssl=(value) @use_ssl = value end |
Instance Method Details
#add_note_to_story(project_id, story_id, note) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/jenkins_tracker/tracker_client.rb', line 15 def add_note_to_story(project_id, story_id, note) begin connection["projects/#{project_id}/stories/#{story_id}/notes"].post("<note><text>#{note}</text></note>") rescue => e # if the post fails for whatever reason (e.g. invalid story id etc), just ignore it #puts ["An error occurred while trying add note to Story ##{story_id} in Project ##{project_id} ", e.message, e.backtrace] * "\n" end end |
#connection(options = {}) ⇒ Object
11 12 13 |
# File 'lib/jenkins_tracker/tracker_client.rb', line 11 def connection( = {}) @connection ||= RestClient::Resource.new(api_url, :headers => { 'X-TrackerToken' => token, 'Content-Type' => 'application/xml' }) end |