Class: Chiketto::User

Inherits:
Resource show all
Defined in:
lib/chiketto/user.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

build_query_string, endpoint, get, #initialize, open_post, paginated, post, should_paginate, token

Methods included from AttrDSL

included

Constructor Details

This class inherits a constructor from Chiketto::Resource

Instance Attribute Details

#first_nameObject

Returns the value of attribute first_name.



3
4
5
# File 'lib/chiketto/user.rb', line 3

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



3
4
5
# File 'lib/chiketto/user.rb', line 3

def last_name
  @last_name
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/chiketto/user.rb', line 3

def name
  @name
end

Class Method Details

.find(id = 'me') ⇒ Object



7
8
9
10
# File 'lib/chiketto/user.rb', line 7

def self.find(id = 'me')
  user = get "users/#{id}"
  User.new user
end

Instance Method Details

#emailObject



12
13
14
# File 'lib/chiketto/user.rb', line 12

def email
  emails.detect { |email| email.primary }
end

#emailsObject



16
17
18
# File 'lib/chiketto/user.rb', line 16

def emails
  @emails.map { |email| Email.new email }
end

#event_attendees(params = {}) ⇒ Object



25
26
27
28
# File 'lib/chiketto/user.rb', line 25

def event_attendees(params = {})
  attendees = User.paginated_attendees @id, params
  attendees.map { |e| Attendee.new e }
end

#events(params = {}) ⇒ Object



20
21
22
23
# File 'lib/chiketto/user.rb', line 20

def events(params = {})
  events = User.paginated_events @id, params
  events.map { |e| Event.new e }
end

#organizersObject



30
31
32
33
# File 'lib/chiketto/user.rb', line 30

def organizers
  organizers = User.find_organizers @id
  organizers['organizers'].map { |o| Organizer.new o }
end