Class: WelcuApi::Attendee
- Inherits:
-
Object
- Object
- WelcuApi::Attendee
- Defined in:
- lib/welcu_api/attendee.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#facebook_uid ⇒ Object
readonly
Returns the value of attribute facebook_uid.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#phone ⇒ Object
readonly
Returns the value of attribute phone.
-
#reference_key ⇒ Object
readonly
Returns the value of attribute reference_key.
-
#tickets ⇒ Object
readonly
Returns the value of attribute tickets.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
- #full_name ⇒ Object
-
#initialize(attendee_json) ⇒ Attendee
constructor
A new instance of Attendee.
Constructor Details
#initialize(attendee_json) ⇒ Attendee
Returns a new instance of Attendee.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/welcu_api/attendee.rb', line 13 def initialize(attendee_json) @id = attendee_json["id"].to_i @first_name = attendee_json["first_name"] @last_name = attendee_json["last_name"] @organization = attendee_json["organization"] @title = attendee_json["title"] @email = attendee_json["email"] @phone = attendee_json["phone"] @facebook_uid = attendee_json["facebook_uid"] @reference_key = attendee_json["reference_key"] @tickets = [] attendee_json["tickets"].each do |ticket| puts ticket.inspect @tickets << WelcuApi::Ticket.new(ticket) end end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
7 8 9 |
# File 'lib/welcu_api/attendee.rb', line 7 def email @email end |
#facebook_uid ⇒ Object (readonly)
Returns the value of attribute facebook_uid.
9 10 11 |
# File 'lib/welcu_api/attendee.rb', line 9 def facebook_uid @facebook_uid end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
4 5 6 |
# File 'lib/welcu_api/attendee.rb', line 4 def first_name @first_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/welcu_api/attendee.rb', line 3 def id @id end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
5 6 7 |
# File 'lib/welcu_api/attendee.rb', line 5 def last_name @last_name end |
#phone ⇒ Object (readonly)
Returns the value of attribute phone.
8 9 10 |
# File 'lib/welcu_api/attendee.rb', line 8 def phone @phone end |
#reference_key ⇒ Object (readonly)
Returns the value of attribute reference_key.
10 11 12 |
# File 'lib/welcu_api/attendee.rb', line 10 def reference_key @reference_key end |
#tickets ⇒ Object (readonly)
Returns the value of attribute tickets.
11 12 13 |
# File 'lib/welcu_api/attendee.rb', line 11 def tickets @tickets end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/welcu_api/attendee.rb', line 6 def title @title end |
Class Method Details
.all(options = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/welcu_api/attendee.rb', line 31 def self.all(={}) case [:state] when :checked url = WelcuApi::Attendee.checked_url when :unchecked url = WelcuApi::Attendee.unchecked_url else url = WelcuApi::Attendee.attendee_url end params = {} params.update(ticket_id = ["ticket_id"]) unless ["ticket_id"].nil? response = WelcuApi.request(:get, url, @api_key, {}) attendees_json = MultiJson.load(response) attendees = [] attendees_json.each do |attendee_json| attendees << WelcuApi::Attendee.new(attendee_json) end attendees end |
Instance Method Details
#full_name ⇒ Object
62 63 64 |
# File 'lib/welcu_api/attendee.rb', line 62 def full_name "#{first_name} #{last_name}" end |