Class: Colourlovers::Pattern

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

Class Method Summary collapse

Class Method Details

.all(options) ⇒ Object

Retrieve patterns as an array of hashes with options available from Colourlovers API see documentation here: www.colourlovers.com/api#patterns 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]



19
20
21
# File 'lib/colourlovers/pattern.rb', line 19

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

.find(patternID) ⇒ Object

Retrieve pattern details from patternID



39
40
41
# File 'lib/colourlovers/pattern.rb', line 39

def find(patternID)
  Client.get("/pattern/#{patternID}")
end

.new(options) ⇒ Object

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



29
30
31
# File 'lib/colourlovers/pattern.rb', line 29

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

.randomObject

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



34
35
36
# File 'lib/colourlovers/pattern.rb', line 34

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

.top(options) ⇒ Object

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



24
25
26
# File 'lib/colourlovers/pattern.rb', line 24

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