Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am alduethadyn on github.
  • I am abeckwith (https://keybase.io/abeckwith) on keybase.
  • I have a public key whose fingerprint is A7F0 074B 04F6 5CE0 72E1 2D15 FF67 FA4E F6D0 472B

To claim this, I am signing this object:

@alduethadyn
alduethadyn / product.rb
Created January 19, 2015 18:08
Ruby example of deriving the best high-res product image for a Best Buy product
class Product < ActiveRecord::Base
attr_accessible :data, :sku
serialize :data, JSON
def data=(data)
write_attribute :data, data
return unless data?
self.primary_high_res_url = high_res
end
require 'openssl'
require 'Base64'
key = 'API_KEY'
secret = 'SHARED_SECRET'
message = "#{key}#{secret}#{Time.now().to_i}"
sig = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), secret, message)
puts sig