Class: Chiketto::User
Instance Attribute Summary collapse
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Resource
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Resource
endpoint, get, #initialize, query, token
Methods included from AttrDSL
Constructor Details
This class inherits a constructor from Chiketto::Resource
Instance Attribute Details
#first_name ⇒ Object
Returns the value of attribute first_name.
3 4 5 |
# File 'lib/chiketto/user.rb', line 3 def first_name @first_name end |
#last_name ⇒ Object
Returns the value of attribute last_name.
3 4 5 |
# File 'lib/chiketto/user.rb', line 3 def last_name @last_name end |
#name ⇒ Object
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
#email ⇒ Object
12 13 14 |
# File 'lib/chiketto/user.rb', line 12 def email emails.detect { |email| email.primary } end |
#emails ⇒ Object
16 17 18 |
# File 'lib/chiketto/user.rb', line 16 def emails @emails.map { |email| Chiketto::Email.new email } end |
#events(params = {}) ⇒ Object
20 21 22 23 |
# File 'lib/chiketto/user.rb', line 20 def events(params = {}) events = Chiketto::User.find_events @id, params events['events'].map { |e| Chiketto::Event.new e } end |