Class: Kiita::User
Constant Summary collapse
- @@attributes =
%w[ name profile_image_url url description website_url organization location facebook linkedin twitter github followers following_users items ]
Instance Attribute Summary collapse
-
#url_name ⇒ Object
readonly
Returns the value of attribute url_name.
Class Method Summary collapse
Instance Method Summary collapse
- #following_tags(options = {}) ⇒ Object
- #following_users(options = {}) ⇒ Object
-
#initialize(url_name, options = {}) ⇒ User
constructor
A new instance of User.
- #posts(options = {}) ⇒ Object
- #stocks(options = {}) ⇒ Object
Methods included from Model
Constructor Details
#initialize(url_name, options = {}) ⇒ User
Returns a new instance of User.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kiita/user.rb', line 14 def initialize(url_name, = {}) if url_name.is_a?(Hash) = url_name @url_name = ["url_name"] else @url_name = url_name end super() end |
Instance Attribute Details
#url_name ⇒ Object (readonly)
Returns the value of attribute url_name.
4 5 6 |
# File 'lib/kiita/user.rb', line 4 def url_name @url_name end |
Class Method Details
.find(url_name) ⇒ Object
53 54 55 |
# File 'lib/kiita/user.rb', line 53 def self.find(url_name) new(url_name, Kiita::API.get("/users/#{url_name}").merge!(loaded: true)) end |
.lazy_load(url_name) ⇒ Object
49 50 51 |
# File 'lib/kiita/user.rb', line 49 def self.lazy_load(url_name) new(url_name) end |
Instance Method Details
#following_tags(options = {}) ⇒ Object
43 44 45 46 47 |
# File 'lib/kiita/user.rb', line 43 def ( = {}) @following_tags ||= Kiita::API.get("/users/#{url_name}/following_tags", ).map do |tag| Kiita::Tag.new(tag) end end |
#following_users(options = {}) ⇒ Object
37 38 39 40 41 |
# File 'lib/kiita/user.rb', line 37 def following_users( = {}) @following_users ||= Kiita::API.get("/users/#{url_name}/following_users", ).map do |user| Kiita::User.new(user) end end |