module StrawberryAPI::Client::Collections

Public Instance Methods

collection(id:) click to toggle source

Fetches a collection

@param [Integer] id Id of the collection to retrieve

@return [StrawberryAPI::Collection] The fetched collection

# 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() click to toggle source

Fetches all collections

@return [Array<StrawberryAPI::Collection>] A list of collections

# File lib/strawberry_api/client/collections.rb, line 10
def collections
  get("/collections").parse['array']&.map do |collection|
    Collection.new(collection)
  end
end