Class: Kippt::FollowRelationship
- Inherits:
-
Object
- Object
- Kippt::FollowRelationship
- Defined in:
- lib/kippt/follow_relationship.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #follow ⇒ Object
- #following? ⇒ Boolean
-
#initialize(client, user) ⇒ FollowRelationship
constructor
A new instance of FollowRelationship.
- #unfollow ⇒ Object
Constructor Details
#initialize(client, user) ⇒ FollowRelationship
Returns a new instance of FollowRelationship.
4 5 6 7 |
# File 'lib/kippt/follow_relationship.rb', line 4 def initialize(client, user) @client = client @user = user end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
2 3 4 |
# File 'lib/kippt/follow_relationship.rb', line 2 def user @user end |
Instance Method Details
#follow ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/kippt/follow_relationship.rb', line 19 def follow response = update_following(true) if response.success? true else raise Kippt::APIError.new("Problem with following: #{response.body["message"]}") end end |
#following? ⇒ Boolean
9 10 11 12 13 14 15 16 17 |
# File 'lib/kippt/follow_relationship.rb', line 9 def following? response = client.get("users/#{user.id}/relationship/") if response.success? response.body["following"] else raise Kippt::APIError.new("Resource could not be loaded: #{response.body["message"]}") end end |