Class: Octopolo::Jira::StoryCommenter

Inherits:
Object
  • Object
show all
Includes:
ConfigWrapper
Defined in:
lib/octopolo/jira/story_commenter.rb

Instance Attribute Summary collapse

Attributes included from ConfigWrapper

#config

Instance Method Summary collapse

Constructor Details

#initialize(issue_id, comment) ⇒ StoryCommenter

Returns a new instance of StoryCommenter.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/octopolo/jira/story_commenter.rb', line 11

def initialize(issue_id, comment)
  Jiralicious.configure do |jira_config|
    jira_config.username = config.jira_user
    jira_config.password = config.jira_password
    jira_config.uri = config.jira_url
  end
  begin
    self.issue =  Jiralicious::Issue.find issue_id
  rescue => e
     puts "Error: Invalid Jira Issue #{issue_id}" 
  end
  self.comment = comment
end

Instance Attribute Details

#commentObject

Returns the value of attribute comment.



9
10
11
# File 'lib/octopolo/jira/story_commenter.rb', line 9

def comment
  @comment
end

#issueObject

Returns the value of attribute issue.



8
9
10
# File 'lib/octopolo/jira/story_commenter.rb', line 8

def issue
  @issue
end

Instance Method Details

#performObject



25
26
27
28
29
30
31
# File 'lib/octopolo/jira/story_commenter.rb', line 25

def perform
  begin
    issue.comments.add(comment)
  rescue => e
    puts "Error: Failed to comment on Jira Issue. \nException: #{e}"
  end
end