Class: SpreeCmCommissioner::Integrations::Larryta::Inventory::ExternalInventoryItems
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::Integrations::Larryta::Inventory::ExternalInventoryItems
- Includes:
- Spree::ServiceModule::Base
- Defined in:
- app/services/spree_cm_commissioner/integrations/larryta/inventory/external_inventory_items.rb
Overview
Fetches all inventory items (seats) for an order from Larryta Uses get_available_seats! and get_unavailable_seats! APIs
Instance Method Summary collapse
Instance Method Details
#call(integration:, order:) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/inventory/external_inventory_items.rb', line 12 def call(integration:, order:) @integration = integration @order = order items = [] order.line_items.each do |line_item| items.concat(fetch_items_for_line_item(line_item)) end success(items: items) rescue SpreeCmCommissioner::Integrations::ExternalClientError => e failure(nil, e.) end |