Class: SocialcastApi::User
- Defined in:
- lib/socialcast-api/base.rb
Class Method Summary collapse
Instance Method Summary collapse
- #follow ⇒ Object
- #followers(args = {}) ⇒ Object
- #following(args = {}) ⇒ Object
- #messages ⇒ Object
- #unfollow ⇒ Object
Class Method Details
.all_pages ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/socialcast-api/base.rb', line 106 def self.all_pages results = Array.new page = 1 per_page = 500 begin users = all(:params => {:page => page, :per_page => per_page}) page += 1 results += users end until users.count < per_page return results end |
.search(args = {}) ⇒ Object
82 83 84 |
# File 'lib/socialcast-api/base.rb', line 82 def self.search(args = {}) get(:search, args).map {|user| User.new(user)} end |
Instance Method Details
#follow ⇒ Object
94 95 96 |
# File 'lib/socialcast-api/base.rb', line 94 def follow User.post(id.to_s + '/followers') end |
#followers(args = {}) ⇒ Object
90 91 92 |
# File 'lib/socialcast-api/base.rb', line 90 def followers(args = {}) get(:followers, args).map {|follower| User.new(follower)} end |
#following(args = {}) ⇒ Object
102 103 104 |
# File 'lib/socialcast-api/base.rb', line 102 def following(args = {}) get(:following, args).map {|user| User.new(user)} end |
#messages ⇒ Object
86 87 88 |
# File 'lib/socialcast-api/base.rb', line 86 def get(:messages).map {|| Message.new()} end |
#unfollow ⇒ Object
98 99 100 |
# File 'lib/socialcast-api/base.rb', line 98 def unfollow delete('followers/' + contact_id.to_s) end |