Class: Eventick::Checkin

Inherits:
Base
  • Object
show all
Defined in:
lib/eventick/checkin.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

path, resource

Constructor Details

#initialize(args = {}) ⇒ Checkin

Returns a new instance of Checkin.



7
8
9
10
# File 'lib/eventick/checkin.rb', line 7

def initialize(args={})
  self.attendee = args[:attendee]
  self.checkin_time = Time.now
end

Instance Attribute Details

#attendeeObject

Returns the value of attribute attendee.



5
6
7
# File 'lib/eventick/checkin.rb', line 5

def attendee
  @attendee
end

#checkin_timeObject

Returns the value of attribute checkin_time.



5
6
7
# File 'lib/eventick/checkin.rb', line 5

def checkin_time
  @checkin_time
end

Class Method Details

.all(event, attendees) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/eventick/checkin.rb', line 16

def self.all(event,attendees)
  params = params(event)
  checkin_time = Time.now
  attendees.each{ |a| a.checkin_at = checkin_time }
  atts = attendees.map{ |a| a.to_json }.join(",")
  data = "{ 'attendees': [#{ atts }]  }"
  checkin_response = Eventick.put path(params), data
  true
end

.create(attendee) ⇒ Object



12
13
14
# File 'lib/eventick/checkin.rb', line 12

def self.create(attendee)
  (self.new :attendee => attendee).save
end

Instance Method Details

#saveObject



26
27
28
29
30
31
# File 'lib/eventick/checkin.rb', line 26

def save
  params = self.attendee.to_param
  checkin_response = Eventick.put self.class.path(params), { checked_at: checkin_time}
  self.attendee.checked_at = checkin_time
  true
end