Sha256: 2b48fe1c0303ecc69d95d0d2079a49df59ff1af7f3d635688531f3dcf3906712
Contents?: true
Size: 511 Bytes
Versions: 24
Compression:
Stored size: 511 Bytes
Contents
module ShopifyAPI 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
24 entries across 24 versions & 1 rubygems