Class: SimpleEventickApi::Attendee

Inherits:
Base
  • Object
show all
Defined in:
lib/simple_eventick_api/attendee.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

get, resource

Constructor Details

#initialize(args = {}) ⇒ Attendee

Returns a new instance of Attendee.



10
11
12
13
14
# File 'lib/simple_eventick_api/attendee.rb', line 10

def initialize(args={})
  args.each do |key, value|
    self.public_send("#{key}=", value)
  end
end

Instance Attribute Details

#checked_atObject

Returns the value of attribute checked_at.



8
9
10
# File 'lib/simple_eventick_api/attendee.rb', line 8

def checked_at
  @checked_at
end

#codeObject

Returns the value of attribute code.



8
9
10
# File 'lib/simple_eventick_api/attendee.rb', line 8

def code
  @code
end

#emailObject

Returns the value of attribute email.



8
9
10
# File 'lib/simple_eventick_api/attendee.rb', line 8

def email
  @email
end

#event_idObject

Returns the value of attribute event_id.



8
9
10
# File 'lib/simple_eventick_api/attendee.rb', line 8

def event_id
  @event_id
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/simple_eventick_api/attendee.rb', line 7

def id
  @id
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/simple_eventick_api/attendee.rb', line 7

def name
  @name
end

#ticket_typeObject

Returns the value of attribute ticket_type.



8
9
10
# File 'lib/simple_eventick_api/attendee.rb', line 8

def ticket_type
  @ticket_type
end

Class Method Details

.all(token, event_id, checked_at = nil) ⇒ Object

class methods



17
18
19
20
21
22
23
24
# File 'lib/simple_eventick_api/attendee.rb', line 17

def self.all(token, event_id, checked_at = nil)
  resource "events/#{event_id}/attendees"

  response = get(token, {checked_at: checked_at})
  
  attendees = response['attendees'].map { |json| self.new json }
  attendees.each { |a| a.event_id = event_id }
end

.check_in(token, event_id, code, checked_at) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/simple_eventick_api/attendee.rb', line 35

def self.check_in(token, event_id, code, checked_at )
  resource "events/#{event_id}/attendees/#{code}"

  response = get(token, {checked_at: checked_at})
  
  attendees = response['attendees'].map { |json| self.new json }
  attendees.each { |a| a.event_id = event_id }.first
end

.find(token, event_id, id) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/simple_eventick_api/attendee.rb', line 26

def self.find(token, event_id, id )
  resource "events/#{event_id}/attendees/#{id}"

  response = get(token)
  
  attendees = response['attendees'].map { |json| self.new json }
  attendees.each { |a| a.event_id = event_id }.first
end