Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adds support for getting the feed

  • Loading branch information...
commit 9a1e58d69d60d4a8aa38860fcedd7f55c196ac31 1 parent b8046cd
@vesan authored
View
4 TODO.md
@@ -2,7 +2,7 @@
# Clip
-* Getting the feed of authenticated user
+* [DONE] Getting the feed of authenticated user
* Getting the user of the clip
* Getting the list of the clip
* Getting the original clip the clip was created via
@@ -21,7 +21,7 @@
# List
-* DONE Support for is private
+* [DONE] Support for is private
* Getting the user
* Getting & setting the description
* Getting the collaborators of the list
View
4 lib/kippt/clips.rb
@@ -27,6 +27,10 @@ def base_uri
"clips"
end
+ def feed
+ Kippt::ClipCollection.new(@client.get("clips/feed").body)
+ end
+
def search(parameters)
if parameters.is_a?(String)
Kippt::ClipCollection.new(
View
2  lib/kippt/collection.rb
@@ -9,7 +9,7 @@ def initialize(data, collection_resource = nil)
@offset = meta.fetch("offset")
@next = meta.fetch("next") { nil }
@previous = meta.fetch("previous") { nil }
- @total_count = meta.fetch("total_count")
+ @total_count = meta.fetch("total_count") { nil }
@collection_resource = collection_resource
View
1  spec/fixtures/feed.json
@@ -0,0 +1 @@
+{"meta": {"next": null, "previous": null, "limit": 20, "offset": 0}, "objects": [{"url_domain": "karrisaarinen.com", "updated": "1335090586", "is_starred": false, "title": "Karri Saarinen", "url": "http://karrisaarinen.com/", "notes": "Cool site, bro", "created": "1335090567", "list": "/api/lists/44525/", "id": 1589450, "resource_uri": "/api/clips/1589450/"}]}
View
12 spec/kippt/clips_spec.rb
@@ -10,6 +10,16 @@
it_behaves_like "collection resource"
+ describe "#feed" do
+ subject { Kippt::Client.new(valid_user_credentials).clips }
+
+ it "returns ClipCollection" do
+ stub_get("/clips/feed").
+ to_return(:status => 200, :body => fixture("feed.json"))
+ subject.feed.should be_a Kippt::ClipCollection
+ end
+ end
+
describe "#search" do
subject { Kippt::Client.new(valid_user_credentials).clips }
@@ -45,7 +55,7 @@
stub_get("/search/clips?q=bunny").
to_return(:status => 200, :body => fixture("clips.json"))
clips = subject.search("bunny")
- clips.is_a? Kippt::ClipCollection
+ clips.should be_a Kippt::ClipCollection
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.