Class: TicketMaster::Provider::Codaset::Ticket
- Inherits:
-
Base::Ticket
- Object
- Base::Ticket
- TicketMaster::Provider::Codaset::Ticket
- Defined in:
- lib/provider/ticket.rb
Overview
The class to access the api’s tickets
Instance Attribute Summary collapse
-
#prefix_options ⇒ Object
Returns the value of attribute prefix_options.
Class Method Summary collapse
- .create(*options) ⇒ Object
- .find_by_attributes(project_id, attributes = {}) ⇒ Object
- .find_by_id(project_id, id) ⇒ Object
- .search(project_id, options = {}, limit = 1000) ⇒ Object
Instance Method Summary collapse
-
#comment ⇒ Object
TODO?.
-
#comment! ⇒ Object
TODO?.
- #comments ⇒ Object
- #created_at ⇒ Object
- #description ⇒ Object
- #id ⇒ Object
-
#initialize(*object) ⇒ Ticket
constructor
declare needed overloaded methods here.
- #project_id ⇒ Object
- #status ⇒ Object
- #title ⇒ Object
- #updated_at ⇒ Object
Constructor Details
#initialize(*object) ⇒ Ticket
declare needed overloaded methods here
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/provider/ticket.rb', line 12 def initialize(*object) if object.first args = object object = args.shift project_id = args.shift @system_data = {:client => object} unless object.is_a? Hash hash = {:id => object.id, :title => object.title, :description => object.description, :status => object.state, :created_at => object.created_at, :updated_at => object.updated_at, :project_id => project_id} else hash = object end super hash end end |
Instance Attribute Details
#prefix_options ⇒ Object
Returns the value of attribute prefix_options.
8 9 10 |
# File 'lib/provider/ticket.rb', line 8 def @prefix_options end |
Class Method Details
.create(*options) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/provider/ticket.rb', line 33 def self.create(*) issue = API.new(.first.merge!(:state => 'new', :created_at => Time.now, :updated_at => Time.now)) ticket = self.new issue issue.save ticket end |
.find_by_attributes(project_id, attributes = {}) ⇒ Object
51 52 53 |
# File 'lib/provider/ticket.rb', line 51 def self.find_by_attributes(project_id, attributes = {}) self.search(project_id, attributes) end |
.find_by_id(project_id, id) ⇒ Object
42 43 44 |
# File 'lib/provider/ticket.rb', line 42 def self.find_by_id(project_id, id) self.search(project_id, {'id' => id}).first end |
.search(project_id, options = {}, limit = 1000) ⇒ Object
46 47 48 49 |
# File 'lib/provider/ticket.rb', line 46 def self.search(project_id, = {}, limit = 1000) tickets = API.find(:all, :params => {:slug => project_id}).collect { |ticket| self.new ticket, project_id } search_by_attribute(tickets, , limit) end |
Instance Method Details
#comment ⇒ Object
TODO?
89 90 91 92 |
# File 'lib/provider/ticket.rb', line 89 def comment warn 'Comments not supported. Perhaps you should leave feedback to request it?' nil end |
#comment! ⇒ Object
TODO?
95 96 97 98 |
# File 'lib/provider/ticket.rb', line 95 def comment! warn 'Comments not supported. Perhaps you should leave feedback to request it?' [] end |
#comments ⇒ Object
83 84 85 86 |
# File 'lib/provider/ticket.rb', line 83 def comments warn 'Comments not supported. Perhaps you should leave feedback to request it?' [] end |
#created_at ⇒ Object
59 60 61 |
# File 'lib/provider/ticket.rb', line 59 def created_at @created_at ||= self[:created_at] ? Time.parse(self[:created_at]) : nil end |
#description ⇒ Object
79 80 81 |
# File 'lib/provider/ticket.rb', line 79 def description self[:description] end |
#id ⇒ Object
67 68 69 |
# File 'lib/provider/ticket.rb', line 67 def id self[:id].to_i end |
#project_id ⇒ Object
55 56 57 |
# File 'lib/provider/ticket.rb', line 55 def project_id self[:project_id] end |
#status ⇒ Object
71 72 73 |
# File 'lib/provider/ticket.rb', line 71 def status self[:status] end |
#title ⇒ Object
75 76 77 |
# File 'lib/provider/ticket.rb', line 75 def title self[:title] end |
#updated_at ⇒ Object
63 64 65 |
# File 'lib/provider/ticket.rb', line 63 def updated_at @updated_at ||= self[:updated_at] ? Time.parse(self[:updated_at]) : nil end |