Class: Feedeng::Client
- Inherits:
-
Object
- Object
- Feedeng::Client
- Defined in:
- lib/feedeng/client.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #get_user_feed(feed_name) ⇒ Object
- #get_user_posts(feed_name) ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #post_to_feed(feed_name, params) ⇒ Object
- #refeed(feed_name, feed_item) ⇒ Object
- #set_token(token) ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
10 11 12 |
# File 'lib/feedeng/client.rb', line 10 def initialize @connection = Faraday.new(:url => 'http://api.feedeng.in') end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
7 8 9 |
# File 'lib/feedeng/client.rb', line 7 def connection @connection end |
#token ⇒ Object
Returns the value of attribute token.
8 9 10 |
# File 'lib/feedeng/client.rb', line 8 def token @token end |
Instance Method Details
#get_user_feed(feed_name) ⇒ Object
18 19 20 |
# File 'lib/feedeng/client.rb', line 18 def get_user_feed(feed_name) get "/feeds/#{feed_name}" end |
#get_user_posts(feed_name) ⇒ Object
22 23 24 |
# File 'lib/feedeng/client.rb', line 22 def get_user_posts(feed_name) get "/feeds/#{feed_name}/posts" end |
#post_to_feed(feed_name, params) ⇒ Object
26 27 28 |
# File 'lib/feedeng/client.rb', line 26 def post_to_feed(feed_name, params) post("/feeds/#{feed_name}/posts", params) end |
#refeed(feed_name, feed_item) ⇒ Object
30 31 32 |
# File 'lib/feedeng/client.rb', line 30 def refeed(feed_name, feed_item) refeed_post("/feeds/#{feed_name}/posts/#{feed_item}/refeeds") end |
#set_token(token) ⇒ Object
14 15 16 |
# File 'lib/feedeng/client.rb', line 14 def set_token(token) @token = token end |