Sha256: fb03ec162d27f158caad0ea0f9212b37e1f748b6c8695b45c192e6813e4eeef4
Contents?: true
Size: 856 Bytes
Versions: 1
Compression:
Stored size: 856 Bytes
Contents
module FleetAPI::PaginatedCollection def self.included(klass) klass.attribute :nextPageToken klass.send(:extend, FleetAPI::PaginatedCollection::Attributes) end module FleetAPI::PaginatedCollection::Attributes def collection_root(collection_root) @collection_root = collection_root end def collection_request(collection_request) @collection_request = collection_request end end def collection_root self.class.instance_variable_get(:@collection_root) end def collection_request self.class.instance_variable_get(:@collection_request) end def next_page all("url" => self.next_link) if self.next_link end def all(params={}) response = connection.send(self.collection_request, params) collection = self.clone.load(response.body[self.collection_root]) collection end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coreos-fleet-api-0.1.0 | lib/fleet_api/paginated_collection.rb |