Class: Eventick::Attendee
Instance Attribute Summary collapse
-
#checked_at ⇒ Object
Returns the value of attribute checked_at.
-
#code ⇒ Object
Returns the value of attribute code.
-
#event_id ⇒ Object
Returns the value of attribute event_id.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#ticket_type ⇒ Object
Returns the value of attribute ticket_type.
Class Method Summary collapse
-
.all(event) ⇒ Object
class methods.
- .find_by_id(event, attendee_id) ⇒ Object
Instance Method Summary collapse
- #checkin ⇒ Object
-
#initialize(args = {}) ⇒ Attendee
constructor
A new instance of Attendee.
- #search_index ⇒ Object
- #to_json ⇒ Object
- #to_param ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(args = {}) ⇒ Attendee
Returns a new instance of Attendee.
8 9 10 11 12 |
# File 'lib/eventick/attendee.rb', line 8 def initialize(args={}) args.each do |key, value| self.public_send("#{key}=", value) end end |
Instance Attribute Details
#checked_at ⇒ Object
Returns the value of attribute checked_at.
6 7 8 |
# File 'lib/eventick/attendee.rb', line 6 def checked_at @checked_at end |
#code ⇒ Object
Returns the value of attribute code.
6 7 8 |
# File 'lib/eventick/attendee.rb', line 6 def code @code end |
#event_id ⇒ Object
Returns the value of attribute event_id.
6 7 8 |
# File 'lib/eventick/attendee.rb', line 6 def event_id @event_id end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/eventick/attendee.rb', line 5 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/eventick/attendee.rb', line 5 def name @name end |
#ticket_type ⇒ Object
Returns the value of attribute ticket_type.
6 7 8 |
# File 'lib/eventick/attendee.rb', line 6 def ticket_type @ticket_type end |
Class Method Details
.all(event) ⇒ Object
class methods
15 16 17 18 19 20 |
# File 'lib/eventick/attendee.rb', line 15 def self.all(event) params = params(event) attendees_response = Eventick.get path(params) attendees = attendees_response['attendees'].map { |attendee_json| self.new attendee_json } attendees.each { |a| a.event_id = params[:event_id] } end |
.find_by_id(event, attendee_id) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/eventick/attendee.rb', line 22 def self.find_by_id(event, attendee_id) data = params(event, attendee_id) attendees_response = Eventick.get path(data) params = attendees_response['attendees'].first attendee = self.new params unless params.empty? attendee.event_id = data[:event_id] attendee end |
Instance Method Details
#checkin ⇒ Object
35 36 37 |
# File 'lib/eventick/attendee.rb', line 35 def checkin Checkin.create self end |
#search_index ⇒ Object
31 32 33 |
# File 'lib/eventick/attendee.rb', line 31 def search_index self.name end |
#to_json ⇒ Object
43 44 45 |
# File 'lib/eventick/attendee.rb', line 43 def to_json "{ 'id': #{ self.id }, 'checked_at': '#{ self.checkin_at }' }" end |
#to_param ⇒ Object
39 40 41 |
# File 'lib/eventick/attendee.rb', line 39 def to_param { event_id: self.event_id, code: self.code } end |