Class: Mistilteinn::Ticket::Redmine
- Inherits:
-
Object
- Object
- Mistilteinn::Ticket::Redmine
- Defined in:
- lib/mistilteinn/ticket/redmine.rb
Instance Method Summary collapse
- #check ⇒ Object
- #create(title) ⇒ Object
-
#initialize(config) ⇒ Redmine
constructor
A new instance of Redmine.
- #tickets ⇒ Object
Constructor Details
#initialize(config) ⇒ Redmine
Returns a new instance of Redmine.
10 11 12 |
# File 'lib/mistilteinn/ticket/redmine.rb', line 10 def initialize(config) @config = config.redmine end |
Instance Method Details
#check ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/mistilteinn/ticket/redmine.rb', line 33 def check begin HttpUtil.get_json(api('users/current'), { :key => @config.apikey}) 'ok' rescue HttpUtil::HttpError => e "Error: #{e.}" end end |
#create(title) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/mistilteinn/ticket/redmine.rb', line 24 def create(title) HttpUtil.post_json(api('issues'), { "X-Redmine-API-Key" => @config.apikey }, { :issue => { :project_id => @config.project, :subject => title, }}) end |
#tickets ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/mistilteinn/ticket/redmine.rb', line 14 def tickets HttpUtil.get_json(api('issues'), { :project_id => @config.project, :key => @config.apikey})['issues'].map{|entry| ::Mistilteinn::Ticket::Entry.new(entry['id'], entry['subject'], entry['status']['name']) } end |