Class: TaskMapper::Provider::Redmine::Ticket
- Inherits:
-
Base::Ticket
- Object
- Base::Ticket
- TaskMapper::Provider::Redmine::Ticket
- Defined in:
- lib/provider/ticket.rb
Class Method Summary collapse
- .attributes_for_request(project_id, options) ⇒ Object
- .create(attributes) ⇒ Object
- .find_by_attributes(project_id, attributes = {}) ⇒ Object
- .find_by_id(project_id, ticket_id) ⇒ Object
Instance Method Summary collapse
- #assignee ⇒ Object
- #created_at ⇒ Object
- #description ⇒ Object
- #id ⇒ Object
-
#initialize(*args) ⇒ Ticket
constructor
declare needed overloaded methods here.
- #priority ⇒ Object
- #project_id ⇒ Object
- #requestor ⇒ Object
- #save ⇒ Object
- #status ⇒ Object
- #updated_at ⇒ Object
Constructor Details
#initialize(*args) ⇒ Ticket
declare needed overloaded methods here
10 11 12 13 14 15 16 |
# File 'lib/provider/ticket.rb', line 10 def initialize(*args) case args.first when Hash then super args.first when RedmineAPI::Issue then super args.first.to_ticket_hash else raise ArgumentError.new end end |
Class Method Details
.attributes_for_request(project_id, options) ⇒ Object
63 64 65 |
# File 'lib/provider/ticket.rb', line 63 def self.attributes_for_request(project_id, ) hash = {:params => {:project_id => project_id}}.merge!() end |
.create(attributes) ⇒ Object
67 68 69 70 |
# File 'lib/provider/ticket.rb', line 67 def self.create(attributes) ticket = self.new(attributes) ticket if ticket.save end |
.find_by_attributes(project_id, attributes = {}) ⇒ Object
58 59 60 61 |
# File 'lib/provider/ticket.rb', line 58 def self.find_by_attributes(project_id, attributes = {}) issues = API.find(:all, attributes_for_request(project_id, attributes)) issues.collect { |issue| self.new issue } end |
.find_by_id(project_id, ticket_id) ⇒ Object
54 55 56 |
# File 'lib/provider/ticket.rb', line 54 def self.find_by_id(project_id, ticket_id) self.new API.find(ticket_id) end |
Instance Method Details
#assignee ⇒ Object
42 43 44 |
# File 'lib/provider/ticket.rb', line 42 def assignee self[:author].name end |
#created_at ⇒ Object
18 19 20 |
# File 'lib/provider/ticket.rb', line 18 def created_at self[:created_on] end |
#description ⇒ Object
50 51 52 |
# File 'lib/provider/ticket.rb', line 50 def description self[:description] end |
#id ⇒ Object
46 47 48 |
# File 'lib/provider/ticket.rb', line 46 def id self[:id].to_i end |
#priority ⇒ Object
34 35 36 |
# File 'lib/provider/ticket.rb', line 34 def priority self[:priority].name end |
#project_id ⇒ Object
26 27 28 |
# File 'lib/provider/ticket.rb', line 26 def project_id self[:project_id] end |
#requestor ⇒ Object
38 39 40 |
# File 'lib/provider/ticket.rb', line 38 def requestor self[:author].name end |
#save ⇒ Object
72 73 74 |
# File 'lib/provider/ticket.rb', line 72 def save to_issue.new? ? to_issue.save : update end |
#status ⇒ Object
30 31 32 |
# File 'lib/provider/ticket.rb', line 30 def status self[:status].name end |
#updated_at ⇒ Object
22 23 24 |
# File 'lib/provider/ticket.rb', line 22 def updated_at self[:updated_on] end |