Class: TicketMaster::Provider::Mingle::Ticket
- Inherits:
-
Base::Ticket
- Object
- Base::Ticket
- TicketMaster::Provider::Mingle::Ticket
- Defined in:
- lib/provider/ticket.rb
Class Method Summary collapse
- .create(*options) ⇒ Object
- .find_by_attributes(identifier, attributes = {}) ⇒ Object
- .find_by_id(identifier, number) ⇒ Object
- .search(identifier, options = {}, limit = 1000) ⇒ Object
Instance Method Summary collapse
-
#comment!(*options) ⇒ Object
def comment(*options).
- #comments(*options) ⇒ Object
- #description ⇒ Object
- #id ⇒ Object
- #identifier ⇒ Object
-
#initialize(*object) ⇒ Ticket
constructor
declare needed overloaded methods herea.
- #name ⇒ Object
- #number ⇒ Object
- #status ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(*object) ⇒ Ticket
declare needed overloaded methods herea
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/provider/ticket.rb', line 10 def initialize(*object) if object.first args = object object = args.shift identifier = args.shift @system_data = {:client => object} unless object.is_a? Hash hash = {:number => object.number, :name => object.name, :description => object.description, :card_type_name => object.card_type.nil? ? "Card" : object.card_type.name, :identifier => identifier, :created_on => object.created_on, :modified_on => object.modified_on, :properties => object.properties} else hash = object end super hash end end |
Class Method Details
.create(*options) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/provider/ticket.rb', line 32 def self.create(*) card = API.new(*) ticket = self.new card card.save ticket end |
.find_by_attributes(identifier, attributes = {}) ⇒ Object
48 49 50 |
# File 'lib/provider/ticket.rb', line 48 def self.find_by_attributes(identifier, attributes = {}) self.search(identifier, attributes) end |
.find_by_id(identifier, number) ⇒ Object
39 40 41 |
# File 'lib/provider/ticket.rb', line 39 def self.find_by_id(identifier, number) self.search(identifier, {'number' => number}).first end |
.search(identifier, options = {}, limit = 1000) ⇒ Object
43 44 45 46 |
# File 'lib/provider/ticket.rb', line 43 def self.search(identifier, = {}, limit = 1000) tickets = API.find(:all, :params => {:identifier => identifier}).collect { |ticket| self.new ticket, identifier } search_by_attribute(tickets, , limit) end |
Instance Method Details
#comment!(*options) ⇒ Object
def comment(*options)
94 95 96 97 |
# File 'lib/provider/ticket.rb', line 94 def comment!(*) [0].update(:identifier => identifier, :number => number) if .first.is_a?(Hash) Comment.create(*) end |
#comments(*options) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/provider/ticket.rb', line 80 def comments(*) begin if .empty? comments = MingleAPI::Comment.find(:all, :params => {:identifier => identifier, :number => number}).collect { |comment| TicketMaster::Provider::Mingle::Comment.new comment } else super(*) end rescue [] end end |
#description ⇒ Object
72 73 74 |
# File 'lib/provider/ticket.rb', line 72 def description self[:description] end |
#id ⇒ Object
56 57 58 |
# File 'lib/provider/ticket.rb', line 56 def id self[:id].to_i end |
#identifier ⇒ Object
64 65 66 |
# File 'lib/provider/ticket.rb', line 64 def identifier self[:identifier] end |
#name ⇒ Object
60 61 62 |
# File 'lib/provider/ticket.rb', line 60 def name self[:name] end |
#number ⇒ Object
52 53 54 |
# File 'lib/provider/ticket.rb', line 52 def number self[:number].to_i end |
#status ⇒ Object
76 77 78 |
# File 'lib/provider/ticket.rb', line 76 def status self.properties[1].value end |
#title ⇒ Object
68 69 70 |
# File 'lib/provider/ticket.rb', line 68 def title self[:name] end |