Class: Blingee::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/blingee/instance.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Instance

Returns a new instance of Instance.



5
6
7
8
9
# File 'lib/blingee/instance.rb', line 5

def initialize(options)
  options   = HashWithIndifferentAccess.new(options)
  @user_id  = options[:user_id] || raise(ArgumentError, "Blingee user_id is required")
  @secret   = options[:secret]  || raise(ArgumentError, "Blingee secret is required")
end

Instance Method Details

#tag_search(tags = '') ⇒ Object

Search Blingee for graphics matching the given tags.

blingee.search('miley,cyrus,myley cyrus')
blingee.search(['miley','cyrus','myley cyrus'])


17
18
19
20
# File 'lib/blingee/instance.rb', line 17

def tag_search(tags = '')
  tags = tags.join(',') if tags.respond_to?(:join)
  objectize(api.request { api.search(:tags => tags, :api_timestamp => Time.now.to_i, :api_signature => API.generate_signature({:api_user_id => @user_id, :tags => tags, :api_timestamp => Time.now.to_i}, @secret)) })
end