Skip to content

Commit

Permalink
(#31) CU-86azhufyt - NameError: uninitialized constant Spree::Event
Browse files Browse the repository at this point in the history
  • Loading branch information
mrshahsuvie committed May 31, 2024
1 parent 2a12ea0 commit 5e47f53
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
5 changes: 1 addition & 4 deletions app/jobs/solidus_bactracs/api/sync_shipments_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ def select_shipments(shipments)
if ThresholdVerifier.call(shipment)
true
else
::Spree::Event.fire(
'solidus_bactracs.api.sync_skipped',
shipment: shipment,
)
::Spree::Bus.publish(:'solidus_bactracs.api.sync_skipped', shipment:)

false
end
Expand Down
13 changes: 2 additions & 11 deletions lib/solidus_bactracs/api/batch_syncer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,10 @@ def call(shipments)
begin
response = client.bulk_create_orders(shipments)
rescue RateLimitedError => e
::Spree::Event.fire(
'solidus_bactracs.api.rate_limited',
shipments: shipments,
error: e,
)

::Spree::Bus.publish(:'solidus_bactracs.api.rate_limited', shipments: shipments, error: e)
raise e
rescue RequestError => e
::Spree::Event.fire(
'solidus_bactracs.api.sync_errored',
shipments: shipments,
error: e,
)
::Spree::Bus.publish(:'solidus_bactracs.api.sync_errored', shipments: shipments, error: e)

raise e
end
Expand Down
10 changes: 2 additions & 8 deletions lib/solidus_bactracs/api/request_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,11 @@ def rma_fail?(response)
def shipment_synced(shipment)
shipment.update_attribute(:bactracs_synced_at, Time.zone.now)

::Spree::Event.fire(
'solidus_bactracs.api.sync_completed',
shipment: shipment
)
::Spree::Bus.publish(:'solidus_bactracs.api.sync_completed', shipment:)
end

def shipment_sync_failed(shipment)
::Spree::Event.fire(
'solidus_bactracs.api.sync_failed',
shipment: shipment
)
::Spree::Bus.publish(:'solidus_bactracs.api.sync_failed', shipment:)
end
end
end
Expand Down

0 comments on commit 5e47f53

Please sign in to comment.