Class: Nineflats::User
Instance Attribute Summary collapse
-
#favorites(options = {}) ⇒ Object
Returns the value of attribute favorites.
-
#favorites_url ⇒ Object
Returns the value of attribute favorites_url.
-
#full_url ⇒ Object
Returns the value of attribute full_url.
-
#name ⇒ Object
Returns the value of attribute name.
-
#self_url ⇒ Object
Returns the value of attribute self_url.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#user_photo_url ⇒ Object
Returns the value of attribute user_photo_url.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #bookings ⇒ Object
-
#initialize(json) ⇒ User
constructor
A new instance of User.
Methods inherited from Base
client_app_key, client_app_key=, object_link
Constructor Details
#initialize(json) ⇒ User
Returns a new instance of User.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/nineflats-api/user.rb', line 6 def initialize(json) @raw_data = json user = json.first[1] @name = user["name"] @slug = user["slug"] @user_photo_url = user["user_photo_url"] if user["links"] @self_url = Nineflats::Base.object_link("self", user["links"]) @full_url = Nineflats::Base.object_link("full", user["links"]) @favorites_url = Nineflats::Base.object_link("favorites", user["links"]) end end |
Instance Attribute Details
#favorites(options = {}) ⇒ Object
Returns the value of attribute favorites.
3 4 5 |
# File 'lib/nineflats-api/user.rb', line 3 def favorites @favorites end |
#favorites_url ⇒ Object
Returns the value of attribute favorites_url.
3 4 5 |
# File 'lib/nineflats-api/user.rb', line 3 def favorites_url @favorites_url end |
#full_url ⇒ Object
Returns the value of attribute full_url.
3 4 5 |
# File 'lib/nineflats-api/user.rb', line 3 def full_url @full_url end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/nineflats-api/user.rb', line 3 def name @name end |
#self_url ⇒ Object
Returns the value of attribute self_url.
3 4 5 |
# File 'lib/nineflats-api/user.rb', line 3 def self_url @self_url end |
#slug ⇒ Object
Returns the value of attribute slug.
3 4 5 |
# File 'lib/nineflats-api/user.rb', line 3 def slug @slug end |
#user_photo_url ⇒ Object
Returns the value of attribute user_photo_url.
3 4 5 |
# File 'lib/nineflats-api/user.rb', line 3 def user_photo_url @user_photo_url end |
Class Method Details
.find_by_slug(slug) ⇒ Object
32 33 34 |
# File 'lib/nineflats-api/user.rb', line 32 def self.find_by_slug(slug) Client.user(slug) end |
Instance Method Details
#bookings ⇒ Object
21 22 23 |
# File 'lib/nineflats-api/user.rb', line 21 def bookings Client.user_bookings(self.slug) end |