class Stormpath::Resource::Collection

Attributes

client[R]
collection_href[R]
criteria[R]
href[R]
item_class[R]

Public Class Methods

new(href, item_class, client, options = {}) click to toggle source
   # File lib/stormpath-sdk/resource/collection.rb
23 def initialize(href, item_class, client, options = {})
24   @client = client
25   @href = href
26   @item_class = item_class
27   @collection_href = options[:collection_href] || @href
28   @criteria ||= {}
29 end

Public Instance Methods

current_page() click to toggle source
   # File lib/stormpath-sdk/resource/collection.rb
65 def current_page
66   page = CollectionPage.new(collection_href, client, criteria)
67   page.item_type = item_class
68   page
69 end
data_store() click to toggle source
   # File lib/stormpath-sdk/resource/collection.rb
31 def data_store
32   client.data_store
33 end
each(&block) click to toggle source
   # File lib/stormpath-sdk/resource/collection.rb
61 def each(&block)
62   PaginatedIterator.iterate(collection_href, client, item_class, @criteria, &block)
63 end
limit(limit) click to toggle source
   # File lib/stormpath-sdk/resource/collection.rb
51 def limit(limit)
52   criteria[:limit] = limit
53   self
54 end
offset(offset) click to toggle source
   # File lib/stormpath-sdk/resource/collection.rb
46 def offset(offset)
47   criteria[:offset] = offset
48   self
49 end
order(statement) click to toggle source
   # File lib/stormpath-sdk/resource/collection.rb
56 def order(statement)
57   criteria[:order_by] = statement
58   self
59 end