Class: ColumnApi::Collection
- Inherits:
-
Object
- Object
- ColumnApi::Collection
- Defined in:
- lib/column_api/collection.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#has_more ⇒ Object
readonly
Returns the value of attribute has_more.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data:, has_more:) ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize(data:, has_more:) ⇒ Collection
Returns a new instance of Collection.
20 21 22 23 |
# File 'lib/column_api/collection.rb', line 20 def initialize(data:, has_more:) @data = data @has_more = has_more end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/column_api/collection.rb', line 5 def data @data end |
#has_more ⇒ Object (readonly)
Returns the value of attribute has_more.
5 6 7 |
# File 'lib/column_api/collection.rb', line 5 def has_more @has_more end |
Class Method Details
.from_response(response, key:, type:) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/column_api/collection.rb', line 7 def self.from_response(response, key:, type:) new( data: response[key].map do |attrs| if type.respond_to?(:from_response) type.from_response(attrs) else type.new(attrs) end end, has_more: response["has_more"] ) end |