Sha256: 5ffbc4861ae43dfe9cb3c895d1430550476abd82cf6340ec091b3fefa3e2c845
Contents?: true
Size: 516 Bytes
Versions: 2
Compression:
Stored size: 516 Bytes
Contents
module SpiffyStoresAPI class Image < Base init_prefix :product # generate a method for each possible image variant [:pico, :icon, :thumb, :small, :compact, :medium, :large, :grande, :original].each do |m| reg_exp_match = "/\\1_#{m}.\\2" define_method(m) { src.gsub(/\/(.*)\.(\w{2,4})/, reg_exp_match) } end def attach_image(data, filename = nil) attributes['attachment'] = Base64.encode64(data) attributes['filename'] = filename unless filename.nil? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spiffy_stores_api-4.11.1 | lib/spiffy_stores_api/resources/image.rb |
spiffy_stores_api-4.11.0 | lib/spiffy_stores_api/resources/image.rb |