Class: SpreeCmCommissioner::Integrations::Larryta
- Inherits:
-
SpreeCmCommissioner::Integration
- Object
- Spree::Base
- Base
- SpreeCmCommissioner::Integration
- SpreeCmCommissioner::Integrations::Larryta
- Defined in:
- app/models/spree_cm_commissioner/integrations/larryta.rb,
app/services/spree_cm_commissioner/integrations/larryta/inventory/external_inventory_items.rb,
app/services/spree_cm_commissioner/integrations/larryta/inventory/external_inventory_item_status.rb
Defined Under Namespace
Modules: ExternalClient, Inventory, Polling, Resources, SyncStrategies Classes: SyncManager
Instance Method Summary collapse
- #client ⇒ Object
-
#external_inventory_item_status(order, options) ⇒ Object
override - Fetch detailed status for a specific external inventory item.
-
#external_inventory_items(order) ⇒ Object
override - Fetch all external inventory items for an order.
- #hold_inventory!(order, line_items) ⇒ Object
- #release_inventory!(order, line_items) ⇒ Object
- #restock_external_inventory!(_order, _line_items) ⇒ Object
- #supports_auto_release_inventory? ⇒ Boolean
- #supports_external_inventory_holding? ⇒ Boolean
- #sync_item_availability!(options = {}) ⇒ Object
- #sync_manager ⇒ Object
- #unstock_external_inventory!(order, line_items) ⇒ Object
Instance Method Details
#client ⇒ Object
78 79 80 |
# File 'app/models/spree_cm_commissioner/integrations/larryta.rb', line 78 def client @client ||= SpreeCmCommissioner::Integrations::Larryta::ExternalClient::Client.new(integration: self) end |
#external_inventory_item_status(order, options) ⇒ Object
override - Fetch detailed status for a specific external inventory item
70 71 72 73 74 75 76 |
# File 'app/models/spree_cm_commissioner/integrations/larryta.rb', line 70 def external_inventory_item_status(order, ) SpreeCmCommissioner::Integrations::Larryta::Inventory::ExternalInventoryItemStatus.new.call( integration: self, order: order, options: ) end |
#external_inventory_items(order) ⇒ Object
override - Fetch all external inventory items for an order
62 63 64 65 66 67 |
# File 'app/models/spree_cm_commissioner/integrations/larryta.rb', line 62 def external_inventory_items(order) SpreeCmCommissioner::Integrations::Larryta::Inventory::ExternalInventoryItems.new.call( integration: self, order: order ) end |
#hold_inventory!(order, line_items) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/models/spree_cm_commissioner/integrations/larryta.rb', line 12 def hold_inventory!(order, line_items) result = SpreeCmCommissioner::Integrations::Larryta::Inventory::HoldSeats.new.call( integration: self, order: order, line_items: line_items ) raise SpreeCmCommissioner::Integrations::SyncError, result.error unless result.success? end |
#release_inventory!(order, line_items) ⇒ Object
44 45 46 47 48 49 50 |
# File 'app/models/spree_cm_commissioner/integrations/larryta.rb', line 44 def release_inventory!(order, line_items) SpreeCmCommissioner::Integrations::Larryta::Inventory::ReleaseSeats.new.call( integration: self, order: order, line_items: line_items ) end |
#restock_external_inventory!(_order, _line_items) ⇒ Object
36 37 38 |
# File 'app/models/spree_cm_commissioner/integrations/larryta.rb', line 36 def restock_external_inventory!(_order, _line_items) raise SpreeCmCommissioner::Integrations::SyncError, 'Booking cannot be cancelled once confirmed' end |
#supports_auto_release_inventory? ⇒ Boolean
40 41 42 |
# File 'app/models/spree_cm_commissioner/integrations/larryta.rb', line 40 def supports_auto_release_inventory? true end |
#supports_external_inventory_holding? ⇒ Boolean
32 33 34 |
# File 'app/models/spree_cm_commissioner/integrations/larryta.rb', line 32 def supports_external_inventory_holding? true end |
#sync_item_availability!(options = {}) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'app/models/spree_cm_commissioner/integrations/larryta.rb', line 52 def sync_item_availability!( = {}) SpreeCmCommissioner::Integrations::Larryta::Polling::SyncItemAvailability.new( integration: self ).call( trip_id: [:trip_id], on_date: [:on_date] ) end |
#sync_manager ⇒ Object
8 9 10 |
# File 'app/models/spree_cm_commissioner/integrations/larryta.rb', line 8 def sync_manager SpreeCmCommissioner::Integrations::Larryta::SyncManager.new(integration: self) end |
#unstock_external_inventory!(order, line_items) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'app/models/spree_cm_commissioner/integrations/larryta.rb', line 22 def unstock_external_inventory!(order, line_items) result = SpreeCmCommissioner::Integrations::Larryta::Inventory::UnstockInventory.new.call( integration: self, order: order, line_items: line_items ) raise SpreeCmCommissioner::Integrations::SyncError, result.error unless result.success? end |