Class: Homeflow::API::Collection

Inherits:
Array
  • Object
show all
Defined in:
lib/homeflow/api/collection.rb

Instance Method Summary collapse

Constructor Details

#initialize(collection_response, klass) ⇒ Collection

Returns a new instance of Collection.



6
7
8
9
10
# File 'lib/homeflow/api/collection.rb', line 6

def initialize(collection_response, klass)
	@has_next_page = collection_response["has_next"]
	@total = collection_response["total"]
   collection_response["elements"].each{|element| self << klass.new(element)}
end

Instance Method Details

#has_next_page?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/homeflow/api/collection.rb', line 13

def has_next_page?
	@has_next_page
end

#totalObject



17
18
19
# File 'lib/homeflow/api/collection.rb', line 17

def total
	@total
end