Class: FlowcommerceSpree::ImportItem
- Inherits:
-
Object
- Object
- FlowcommerceSpree::ImportItem
- Defined in:
- app/services/flowcommerce_spree/import_item.rb
Overview
A service object to import the data for product variants belonging to a flow.io Experience
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.run(variant, client: FlowcommerceSpree.client, organization: ORGANIZATION) ⇒ Object
6 7 8 |
# File 'app/services/flowcommerce_spree/import_item.rb', line 6 def self.run(variant, client: FlowcommerceSpree.client, organization: ORGANIZATION) new(variant, client: client, organization: organization).run end |
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/services/flowcommerce_spree/import_item.rb', line 10 def run @client.experiences.get(@organization, status: 'active').each do |experience| experience_key = experience.key zone = Spree::Zones::Product.find_by(name: experience_key.titleize) next unless zone import_data(zone) end end |