Class: SpreeCmCommissioner::Integrations::BookMeBusV1::Inventory::ExternalInventoryItems
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::Integrations::BookMeBusV1::Inventory::ExternalInventoryItems
- Includes:
- Spree::ServiceModule::Base
- Defined in:
- app/services/spree_cm_commissioner/integrations/book_me_bus_v1/inventory/external_inventory_items.rb
Overview
Fetches all inventory items (seats) for an order from BookMeBus Uses the get_seat_layout! API to retrieve seat availability
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/book_me_bus_v1/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 |