Class: Printful::Collection
- Inherits:
-
Object
- Object
- Printful::Collection
- Defined in:
- lib/printful/collection.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data:, count:) ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize(data:, count:) ⇒ Collection
Returns a new instance of Collection.
12 13 14 15 |
# File 'lib/printful/collection.rb', line 12 def initialize(data:, count:) @data = data @count = count end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
3 4 5 |
# File 'lib/printful/collection.rb', line 3 def count @count end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/printful/collection.rb', line 3 def data @data end |
Class Method Details
.from_response(body:, type:) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/printful/collection.rb', line 5 def self.from_response(body:, type:) new( data: body.map { |attrs| type.new(attrs) }, count: body.count ) end |