Class: Mws::Apis::Feeds::Product::ProductBuilder

Inherits:
DelegatingBuilder show all
Defined in:
lib/mws/apis/feeds/product.rb

Instance Method Summary collapse

Methods inherited from DelegatingBuilder

#method_missing

Constructor Details

#initialize(product) ⇒ ProductBuilder

Returns a new instance of ProductBuilder.



67
68
69
70
# File 'lib/mws/apis/feeds/product.rb', line 67

def initialize(product)
  super product
  @product = product
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Mws::Apis::Feeds::Product::DelegatingBuilder

Instance Method Details

#bullet_point(bullet_point) ⇒ Object



94
95
96
# File 'lib/mws/apis/feeds/product.rb', line 94

def bullet_point(bullet_point)
  @product.bullet_points << bullet_point
end

#details(details = nil, &block) ⇒ Object



98
99
100
101
# File 'lib/mws/apis/feeds/product.rb', line 98

def details(details=nil, &block)
  @product.details = details || {}
  DetailBuilder.new(@product.details).instance_eval &block if block_given?
end

#item_dimensions(&block) ⇒ Object



76
77
78
79
# File 'lib/mws/apis/feeds/product.rb', line 76

def item_dimensions(&block)
  @product.item_dimensions = Dimensions.new
  DimensionsBuilder.new(@product.item_dimensions).instance_eval &block if block_given?
end

#msrp(amount, currency) ⇒ Object



72
73
74
# File 'lib/mws/apis/feeds/product.rb', line 72

def msrp(amount, currency)
  @product.msrp = Money.new amount, currency
end

#package_dimensions(&block) ⇒ Object



81
82
83
84
# File 'lib/mws/apis/feeds/product.rb', line 81

def package_dimensions(&block)
  @product.package_dimensions = Dimensions.new
  DimensionsBuilder.new(@product.package_dimensions).instance_eval &block if block_given?
end

#package_weight(value, unit = nil) ⇒ Object



86
87
88
# File 'lib/mws/apis/feeds/product.rb', line 86

def package_weight(value, unit=nil)
  @product.package_weight = Weight.new(value, unit)
end

#shipping_weight(value, unit = nil) ⇒ Object



90
91
92
# File 'lib/mws/apis/feeds/product.rb', line 90

def shipping_weight(value, unit=nil)
  @product.shipping_weight = Weight.new(value, unit)
end