Class: Colourlovers::Palette

Inherits:
Object
  • Object
show all
Defined in:
lib/colourlovers/palette.rb

Class Method Summary collapse

Class Method Details

.all(options) ⇒ Object

Retrieve palettes as an array of hashes with options available from Colourlovers API see documentation here: www.colourlovers.com/api#palettes lover = COLOURlover hueOption = yellow,orange,red or green,violet or blue

Possible Values can be a combination of: red, orange, yellow, green, aqua, blue, violet, and / or fuchsia

hex = 00FF33 [Possible Values: any valid 6-char hex value] keywords = search+term keywordExact = 0 or 1 [Perform an exact search for the keywords passed. Default 0] orderCol = X [Where X can be: dateCreated, score, name, numVotes, or numViews] sortBy = X [Where X can be: ASC or DESC. Default ASC] numResults = 20 [Number of results to return, maximum of 100. Default 20] resultOffset = 5 [Result offset, for paging. Default 0] format = json or xml [Result format. Default is xml] jsonCallback = yourCallbackFunction [Adds a callback to JSON format. Assumes format=json] showPaletteWidths = 0 or 1 [Shows palette’s color’s widths. Default 0]



22
23
24
# File 'lib/colourlovers/palette.rb', line 22

def all(options)  
  Client.get("/palettes", :query => options)
end

.find(paletteID) ⇒ Object

Retrieve palette details from paletteID as an array with one hash



42
43
44
# File 'lib/colourlovers/palette.rb', line 42

def find(paletteID)
  Client.get("/palette/#{paletteID}")
end

.new(options) ⇒ Object

Retrives palettes as an array of hashes, same options as all but ordered by dateCreated



32
33
34
# File 'lib/colourlovers/palette.rb', line 32

def new(options)  
  Client.get("/palettes/new", :query => options)
end

.randomObject

Retrieve random palette as an array with one hash, no parameters allowed



37
38
39
# File 'lib/colourlovers/palette.rb', line 37

def random
  Client.get("/palettes/random")
end

.top(options) ⇒ Object

Retrives palettes as an array of hashes, same options as all but ordered by popularity



27
28
29
# File 'lib/colourlovers/palette.rb', line 27

def top(options)  
  Client.get("/palettes/top", :query => options)
end