Class: ItemBuilder::Modes::Create::TokopediaService

Inherits:
Base
  • Object
show all
Defined in:
lib/item_builder/modes/create/tokopedia_service.rb

Instance Attribute Summary

Attributes inherited from Base

#item_listing, #shipping_providers

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from ItemBuilder::Modes::Create::Base

Instance Method Details

#categoryObject



15
16
17
18
19
20
21
# File 'lib/item_builder/modes/create/tokopedia_service.rb', line 15

def category
  {
    id: item_listing&.item_listing_category&.id,
    local_id: item_listing&.item_listing_category&.tokopedia&.local_id,
    name: item_listing&.item_listing_category&.tokopedia&.name
  }
end

#master_option_typesObject



23
24
25
26
27
28
29
30
# File 'lib/item_builder/modes/create/tokopedia_service.rb', line 23

def master_option_types
  item.option_types.map do |option_type|
    {
      name: option_type.name,
      option_list: option_list(option_type)
    }
  end
end

#performObject



8
9
10
11
12
13
# File 'lib/item_builder/modes/create/tokopedia_service.rb', line 8

def perform
  {
    category: category,
    master_option_types: master_option_types
  }
end