Module: CacheAccessor

Included in:
Reggie
Defined in:
lib/cache_accessor.rb

Instance Method Summary collapse

Instance Method Details

#cache_accessor(*names) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/cache_accessor.rb', line 2

def cache_accessor(*names)
  names.each do |name|
    define_method(name) do |image_url|
      begin
        response = RestClient.put "#{@base_uri}/#{@customer_id}/edge/#{name}",
                                  {:MediaPath => image_url, :MediaType => 8}.to_json,
                                  :authorization => token,
                                  :content_type => :json,
                                  :accept => :json
      rescue => e
        e
      end
    end
  end
end