Class: Colourlovers::Color

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

Class Method Summary collapse

Class Method Details

.all(options) ⇒ Object

Retrieve colors as an array of hashes with options available from Colourlovers API see documentation here: www.colourlovers.com/api#colors lover = COLOURlover hueRange = 12,68 [values must be 0>value<359, and the left value must be less than the right value] briRange = 2,88 [values must be 0>value<99, and the left value must be less than the right 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]



18
19
20
# File 'lib/colourlovers/color.rb', line 18

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

.find(hex) ⇒ Object

Retrieve color details from hex value as an array with one hash



38
39
40
# File 'lib/colourlovers/color.rb', line 38

def find(hex)
  Client.get("/color/#{hex}")
end

.new(options) ⇒ Object

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



28
29
30
# File 'lib/colourlovers/color.rb', line 28

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

.randomObject

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



33
34
35
# File 'lib/colourlovers/color.rb', line 33

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

.top(options) ⇒ Object

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



23
24
25
# File 'lib/colourlovers/color.rb', line 23

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