class Doattend::Base
Attributes
event[RW]
key[RW]
result[RW]
url[RW]
Public Class Methods
new(e=nil, k=nil)
click to toggle source
# File lib/doattend/base.rb, line 13 def initialize(e=nil, k=nil) if defined? Rails conf = YAML.load_file("#{Rails.root}/config/doattend.yml") self.event = conf['doattend']['event'] self.key = conf['doattend']['key'] else self.event = e self.key = k end self.url = "http://doattend.com/api/events/#{self.event}/participants_list.json?api_key=#{self.key}" end
Public Instance Methods
aggregate()
click to toggle source
Get Total Participants.
# File lib/doattend/base.rb, line 35 def aggregate self.result['participants'].size end
fetch()
click to toggle source
Request DoAttend and fetch results.
# File lib/doattend/base.rb, line 26 def fetch begin self.result = JSON.parse(RestClient.get(url)) rescue Exception => e raise e end end
participant()
click to toggle source
Use methods of Participant
class.
# File lib/doattend/base.rb, line 45 def participant Doattend::Participant.new(self.result['participants']) end
ticket()
click to toggle source
Use methods of Ticket
class.
# File lib/doattend/base.rb, line 40 def ticket Doattend::Ticket.new(self.result['participants']) end