Class: Svpply::User
- Inherits:
-
Object
- Object
- Svpply::User
- Defined in:
- lib/svpply/user.rb
Instance Attribute Summary collapse
-
#avatar ⇒ Object
readonly
Returns the value of attribute avatar.
-
#date_created ⇒ Object
readonly
Returns the value of attribute date_created.
-
#date_updated ⇒ Object
readonly
Returns the value of attribute date_updated.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#display_name ⇒ Object
readonly
Returns the value of attribute display_name.
-
#gender_preference ⇒ Object
readonly
Returns the value of attribute gender_preference.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#owns_count ⇒ Object
readonly
Returns the value of attribute owns_count.
-
#products_count ⇒ Object
readonly
Returns the value of attribute products_count.
-
#searches_following_count ⇒ Object
readonly
Returns the value of attribute searches_following_count.
-
#stores_following_count ⇒ Object
readonly
Returns the value of attribute stores_following_count.
-
#svpply_url ⇒ Object
readonly
Returns the value of attribute svpply_url.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
-
#users_followers_count ⇒ Object
readonly
Returns the value of attribute users_followers_count.
-
#users_following_count ⇒ Object
readonly
Returns the value of attribute users_following_count.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(hash) ⇒ User
Returns a new instance of User.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/svpply/user.rb', line 18 def initialize(hash) @id = hash["id"] @name = hash["name"] @username = hash["username"] @url = hash["url"] @description = hash["description"] @location = hash["location"] @display_name = hash["display_name"] @avatar = hash["avatar"] @gender_preference = hash["gender_preference"] @products_count = hash["products_count"] @owns_count = hash["owns_count"] @users_following_count = hash["users_following_count"] @users_followers_count = hash["users_followers_count"] @stores_following_count = hash["stores_following_count"] @searches_following_count = hash["searches_following_count"] @date_created = hash["date_created"] @date_updated = hash["date_updated"] @svpply_url = "https://svpply.com/#{@username}" end |
Instance Attribute Details
#avatar ⇒ Object (readonly)
Returns the value of attribute avatar.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def avatar @avatar end |
#date_created ⇒ Object (readonly)
Returns the value of attribute date_created.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def date_created @date_created end |
#date_updated ⇒ Object (readonly)
Returns the value of attribute date_updated.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def date_updated @date_updated end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def description @description end |
#display_name ⇒ Object (readonly)
Returns the value of attribute display_name.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def display_name @display_name end |
#gender_preference ⇒ Object (readonly)
Returns the value of attribute gender_preference.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def gender_preference @gender_preference end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def id @id end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def name @name end |
#owns_count ⇒ Object (readonly)
Returns the value of attribute owns_count.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def owns_count @owns_count end |
#products_count ⇒ Object (readonly)
Returns the value of attribute products_count.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def products_count @products_count end |
#searches_following_count ⇒ Object (readonly)
Returns the value of attribute searches_following_count.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def searches_following_count @searches_following_count end |
#stores_following_count ⇒ Object (readonly)
Returns the value of attribute stores_following_count.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def stores_following_count @stores_following_count end |
#svpply_url ⇒ Object (readonly)
Returns the value of attribute svpply_url.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def svpply_url @svpply_url end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def url @url end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def username @username end |
#users_followers_count ⇒ Object (readonly)
Returns the value of attribute users_followers_count.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def users_followers_count @users_followers_count end |
#users_following_count ⇒ Object (readonly)
Returns the value of attribute users_following_count.
3 4 5 |
# File 'lib/svpply/user.rb', line 3 def users_following_count @users_following_count end |
Class Method Details
.find(id) ⇒ Object
10 11 12 |
# File 'lib/svpply/user.rb', line 10 def self.find(id) new(Client.get_response("/users/#{id}.json")["user"]) end |
.products(id, attrs = nil) ⇒ Object
14 15 16 |
# File 'lib/svpply/user.rb', line 14 def self.products(id, attrs=nil) ProductCollection.new(Client.get_response("/users/#{id}/wants/products.json", attrs)).products end |