Class: DMM::Response::Item
- Inherits:
-
Object
- Object
- DMM::Response::Item
- Defined in:
- lib/ruby-dmm/response/item.rb
Constant Summary collapse
- KEYS =
[ :affiliate_url, :affiliate_url_sp, :bandaiinfo, :category_name, :cdinfo, :content_id, :floor_name, :isbn, :jancode, :maker_product, :product_id, :service_name, :stock, :title, :url, :url_sp, ]
Instance Method Summary collapse
-
#initialize(item) ⇒ Item
constructor
A new instance of Item.
- #large_images ⇒ Object
Constructor Details
#initialize(item) ⇒ Item
Returns a new instance of Item.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ruby-dmm/response/item.rb', line 40 def initialize(item) item.each do |key, value| case key when :date @date = Time.parse(value) if value when :iteminfo @iteminfo = ItemInfo.new(value) if value when :sample_image_url @small_images = value[:sample_s][:image] if value when :prices setup_prices(value) if value else instance_variable_set("@#{key}", item[key]) end end end |
Instance Method Details
#large_images ⇒ Object
57 58 59 60 61 |
# File 'lib/ruby-dmm/response/item.rb', line 57 def large_images @small_images && @small_images.map do |image| image.gsub(/(-[0-9]+\.jpg)/, 'jp\1') end end |