Class: ItemBuilderMwh::Modes::MapCreate::ShopeeService
- Inherits:
-
Base
- Object
- Base
- ItemBuilderMwh::Modes::MapCreate::ShopeeService
show all
- Defined in:
- lib/item_builder_mwh/modes/map_create/shopee_service.rb
Instance Attribute Summary
Attributes inherited from Base
#listing
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#item_custom_fields ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/item_builder_mwh/modes/map_create/shopee_service.rb', line 16
def item_custom_fields
listing.item_listing_custom_fields.map do |item|
next unless available_custom_field_ids.include?(item&.shopee&.id)
{
value: item.value,
local_id: item&.shopee&.local_id,
data_type: item&.shopee&.data_type,
input_type: item&.shopee&.input_type,
options: item&.shopee&.options.map do |option|
{
id: option.id,
name: option.name,
local_id: option.local_id
}
end
}
end.compact
end
|
8
9
10
11
12
13
14
|
# File 'lib/item_builder_mwh/modes/map_create/shopee_service.rb', line 8
def perform
{
item_custom_fields: item_custom_fields,
variant_custom_fields: variant_custom_fields,
shipping_providers: shipping_providers
}
end
|
#shipping_providers ⇒ Object
47
48
49
50
51
52
53
|
# File 'lib/item_builder_mwh/modes/map_create/shopee_service.rb', line 47
def shipping_providers
listing.shopee_shipping_providers.map do |shipping_provider|
{
logistic_id: shipping_provider['logistic_id']
}
end
end
|
#variant_custom_fields ⇒ Object
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/item_builder_mwh/modes/map_create/shopee_service.rb', line 36
def variant_custom_fields
listing.item_listing_variant_custom_fields.map do |variant|
{
value: variant.value,
local_id: variant&.shopee&.local_id,
data_type: variant&.shopee&.data_type,
input_type: variant&.shopee&.input_type
}
end
end
|