Class: Dawanda::User
Overview
User
Represents a single Dawanda user - has the following attributes:
- id
-
The unique identifier for this user
- name
-
This user’s username
- city
-
The user’s city / state (optional)
- sex
-
The user’s gender
- transaction_sold_count
-
How many products have been sold by this user
- is_seller
-
Is this user a seller?
- bio
-
User’s biography
- restful_path
- url
-
The full URL to this user’s profile page / shop (if seller)
Class Method Summary collapse
-
.search(keyword, params = {}) ⇒ Object
Search for users with given keyword.
Instance Method Summary collapse
- #image_170x ⇒ Object
- #image_40x40 ⇒ Object
- #image_80x80 ⇒ Object
- #pinboards(params = {}) ⇒ Object
-
#seller? ⇒ Boolean
Is this user a seller?.
-
#shop(params = {}) ⇒ Object
This user’s shop, returns nil if user is not a seller.
Methods included from Model
Class Method Details
.search(keyword, params = {}) ⇒ Object
Search for users with given keyword
36 37 38 39 |
# File 'lib/dawanda/user.rb', line 36 def self.search(keyword, params = {}) params.update(:keyword => keyword) self.find_all_by_method('search', params) end |
Instance Method Details
#image_170x ⇒ Object
55 56 57 |
# File 'lib/dawanda/user.rb', line 55 def image_170x images.first['image_170x'] end |
#image_40x40 ⇒ Object
47 48 49 |
# File 'lib/dawanda/user.rb', line 47 def image_40x40 images.first['image_40x40'] end |
#image_80x80 ⇒ Object
51 52 53 |
# File 'lib/dawanda/user.rb', line 51 def image_80x80 images.first['image_80x80'] end |
#pinboards(params = {}) ⇒ Object
59 60 61 |
# File 'lib/dawanda/user.rb', line 59 def pinboards(params = {}) Pinboard.find_all_by_user_id(id, params) end |
#seller? ⇒ Boolean
Is this user a seller?
43 44 45 |
# File 'lib/dawanda/user.rb', line 43 def seller? is_seller end |
#shop(params = {}) ⇒ Object
This user’s shop, returns nil if user is not a seller. See Dawanda::Shop for more information.
31 32 33 |
# File 'lib/dawanda/user.rb', line 31 def shop(params = {}) @shop ||= Shop.find_by_user_id(id, params) if seller? end |