Module: StrawberryAPI::Client::Collections
- Included in:
- StrawberryAPI::Client
- Defined in:
- lib/strawberry_api/client/collections.rb
Instance Method Summary collapse
-
#collection(id:) ⇒ StrawberryAPI::Collection
Fetches a collection.
-
#collections ⇒ Array<StrawberryAPI::Collection>
Fetches all collections.
Instance Method Details
#collection(id:) ⇒ StrawberryAPI::Collection
Fetches a collection
22 23 24 25 |
# File 'lib/strawberry_api/client/collections.rb', line 22 def collection(id:) data = get("/collections/#{id}").parse['collection'] data.nil? ? nil : Collection.new(data) end |
#collections ⇒ Array<StrawberryAPI::Collection>
Fetches all collections
10 11 12 13 14 |
# File 'lib/strawberry_api/client/collections.rb', line 10 def collections get("/collections").parse['array']&.map do |collection| Collection.new(collection) end end |