Class: Doattend::Ticket
- Inherits:
-
Object
- Object
- Doattend::Ticket
- Defined in:
- lib/doattend/ticket.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
Returns the value of attribute result.
Instance Method Summary collapse
-
#aggregate(name) ⇒ Object
Returns number of registrations for a ticket type.
-
#initialize(result) ⇒ Ticket
constructor
A new instance of Ticket.
-
#names ⇒ Object
Returns different ticket names that is available for the event.
Constructor Details
#initialize(result) ⇒ Ticket
Returns a new instance of Ticket.
7 8 9 |
# File 'lib/doattend/ticket.rb', line 7 def initialize(result) self.result = result end |
Instance Attribute Details
#result ⇒ Object
Returns the value of attribute result.
5 6 7 |
# File 'lib/doattend/ticket.rb', line 5 def result @result end |
Instance Method Details
#aggregate(name) ⇒ Object
Returns number of registrations for a ticket type
17 18 19 |
# File 'lib/doattend/ticket.rb', line 17 def aggregate(name) self.result.count{ |t| t['Ticket_Name'] == name } end |
#names ⇒ Object
Returns different ticket names that is available for the event.
12 13 14 |
# File 'lib/doattend/ticket.rb', line 12 def names self.result.map{ |t| t['Ticket_Name'] }.uniq end |