Class: Doattend::Ticket

Inherits:
Object
  • Object
show all
Defined in:
lib/doattend/ticket.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#resultObject

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

#namesObject

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