Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make collections Enumberable

  • Loading branch information...
commit cfd59b019cf16d71825d8e953cb65bd3c3d109cb 1 parent 99058f7
@vesan authored
Showing with 10 additions and 2 deletions.
  1. +4 −2 README.md
  2. +2 −0  lib/kippt/collection.rb
  3. +4 −0 spec/spec_helper.rb
View
6 README.md
@@ -73,7 +73,7 @@ Get all the lists:
```ruby
client = Kippt::Client.new(username: "vesan", token: "2544d6bfddf5893ec8617")
-lists = client.lists # Returns Kippt::ListCollection
+lists = client.lists.all # Returns Kippt::ListCollection
```
Get single list:
@@ -89,9 +89,11 @@ list = client.lists[list_id] # Returns Kippt::ListItem
```ruby
client = Kippt::Client.new(username: "vesan", token: "2544d6bfddf5893ec8617")
-clips = client.clips # Returns Kippt::ClipCollection
+clips = client.clips.all # Returns Kippt::ClipCollection
```
+Both ListCollection and ClipCollection are Enumerable.
+
### Pagination
View
2  lib/kippt/collection.rb
@@ -1,4 +1,6 @@
module Kippt::Collection
+ include Enumerable
+
attr_reader :total_count, :limit, :offset
def initialize(data, collection_resource = nil)
View
4 spec/spec_helper.rb
@@ -96,6 +96,10 @@ def fixture(file)
end
shared_examples_for "collection" do
+ it "is Enumberable" do
+ subject.should be_a(Enumerable)
+ end
+
describe "#total_count" do
it "returns total count of resources" do
subject.total_count.should eq data["meta"]["total_count"]
Please sign in to comment.
Something went wrong with that request. Please try again.