Module: ItemBuilder
- Defined in:
- lib/item_builder.rb,
lib/item_builder/modes.rb,
lib/item_builder/version.rb,
lib/item_builder/modes/price/base.rb,
lib/item_builder/modes/update/base.rb,
lib/item_builder/modes/base_service.rb,
lib/item_builder/modes/price_service.rb,
lib/item_builder/modes/quantity/base.rb,
lib/item_builder/get_quantity_service.rb,
lib/item_builder/modes/active_service.rb,
lib/item_builder/modes/simple_service.rb,
lib/item_builder/modes/update_service.rb,
lib/item_builder/modes/price/jd_service.rb,
lib/item_builder/modes/quantity_service.rb,
lib/item_builder/modes/update/jd_service.rb,
lib/item_builder/modes/price/blibli_service.rb,
lib/item_builder/modes/price/zalora_service.rb,
lib/item_builder/modes/price/shopify_service.rb,
lib/item_builder/modes/update/blibli_service.rb,
lib/item_builder/modes/update/lazada_service.rb,
lib/item_builder/modes/update/zalora_service.rb,
lib/item_builder/modes/update/shopify_service.rb,
lib/item_builder/modes/price/bukalapak_service.rb,
lib/item_builder/modes/price/sale_price_policy.rb,
lib/item_builder/modes/quantity/blibli_service.rb,
lib/item_builder/modes/quantity/lazada_service.rb,
lib/item_builder/modes/quantity/zalora_service.rb,
lib/item_builder/modes/update/bukalapak_service.rb,
lib/item_builder/modes/update/tokopedia_service.rb
Defined Under Namespace
Modules: Modes Classes: GetQuantityService
Constant Summary collapse
- VERSION =
'0.1.14'
Class Attribute Summary collapse
-
.listing_ids ⇒ Object
readonly
Returns the value of attribute listing_ids.
-
.listings ⇒ Object
readonly
Returns the value of attribute listings.
-
.mode ⇒ Object
readonly
Returns the value of attribute mode.
-
.variant_ids ⇒ Object
readonly
Returns the value of attribute variant_ids.
-
.variants ⇒ Object
readonly
Returns the value of attribute variants.
-
.wh_spaces ⇒ Object
readonly
Returns the value of attribute wh_spaces.
Class Method Summary collapse
- .build(listing_ids, mode) ⇒ Object
- .default ⇒ Object
- .mode_check ⇒ Object
- .modes ⇒ Object
- .quantity_mode ⇒ Object
Class Attribute Details
.listing_ids ⇒ Object (readonly)
Returns the value of attribute listing_ids.
13 14 15 |
# File 'lib/item_builder.rb', line 13 def listing_ids @listing_ids end |
.listings ⇒ Object (readonly)
Returns the value of attribute listings.
14 15 16 |
# File 'lib/item_builder.rb', line 14 def listings @listings end |
.mode ⇒ Object (readonly)
Returns the value of attribute mode.
15 16 17 |
# File 'lib/item_builder.rb', line 15 def mode @mode end |
.variant_ids ⇒ Object (readonly)
Returns the value of attribute variant_ids.
18 19 20 |
# File 'lib/item_builder.rb', line 18 def variant_ids @variant_ids end |
.variants ⇒ Object (readonly)
Returns the value of attribute variants.
17 18 19 |
# File 'lib/item_builder.rb', line 17 def variants @variants end |
.wh_spaces ⇒ Object (readonly)
Returns the value of attribute wh_spaces.
16 17 18 |
# File 'lib/item_builder.rb', line 16 def wh_spaces @wh_spaces end |
Class Method Details
.build(listing_ids, mode) ⇒ Object
19 20 21 22 23 |
# File 'lib/item_builder.rb', line 19 def build(listing_ids, mode) @listing_ids = listing_ids @mode = mode mode_check end |
.default ⇒ Object
43 44 45 46 47 |
# File 'lib/item_builder.rb', line 43 def default listings.map do |listing| modes[mode].new(listing: listing).perform end end |
.mode_check ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/item_builder.rb', line 25 def mode_check if mode == :quantity quantity_mode else default end end |
.modes ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/item_builder.rb', line 65 def modes { price: ItemBuilder::Modes::PriceService, quantity: ItemBuilder::Modes::QuantityService, simple: ItemBuilder::Modes::SimpleService, active: ItemBuilder::Modes::ActiveService, update: ItemBuilder::Modes::UpdateService } end |
.quantity_mode ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/item_builder.rb', line 33 def quantity_mode listings.map do |listing| modes[mode].new( listing: listing, wh_spaces: wh_spaces, variants: variants ).perform end end |