class Bliss::Client::Look
Constants
- RESOURCES
Public Class Methods
for_collection(collection_id, args)
click to toggle source
Fetch looks for a collection.
@param [Integer] collection_id The id of the collection @param [Hash] args @option args [Symbol] :type Which kind of look to fetch; either
:keylook or :studiolook
@return [Array<Look>]
@example Fetch all keylooks for the collection with id 88
Bliss::Client::Look.for_collection(88, type: :keylook)
# File lib/bliss/client/look.rb, line 31 def self.for_collection(collection_id, args) resource = RESOURCES.fetch(args.fetch(:type).to_sym) url = "collections/#{collection_id}/#{resource}" response = Client.connection.get url if response.success? response.body.map { |attr| new attr } else raise JSON.parse(response.body).fetch('message') end end
Public Instance Methods
description(language)
click to toggle source
Get description in language.
@param [Symbol] language ISO 639-1 two-letter languange code @return [String] description of this look in the requested language
@example Get English description
look.description(:en) # => "Super trendy-wendy look combining yada..."
# File lib/bliss/client/look.rb, line 51 def description(language) descriptions.fetch(language.to_s.downcase) rescue KeyError raise ArgumentError, %{ No description found in language: "#{language}". Make sure "#{language}" is a valid ISO 639-1 two-letter code. See https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes } end