class SolidusShipstation::Api::ThresholdVerifier
Public Class Methods
call(shipment)
click to toggle source
# File lib/solidus_shipstation/api/threshold_verifier.rb, line 7 def call(shipment) return false unless shipment.order.completed? !!(shipment_requires_creation?(shipment) || shipment_requires_update?(shipment)) end
Private Class Methods
shipment_requires_creation?(shipment)
click to toggle source
# File lib/solidus_shipstation/api/threshold_verifier.rb, line 15 def shipment_requires_creation?(shipment) shipment.shipstation_synced_at.nil? && Time.zone.now - shipment.order.updated_at < SolidusShipstation.config.api_sync_threshold end
shipment_requires_update?(shipment)
click to toggle source
# File lib/solidus_shipstation/api/threshold_verifier.rb, line 20 def shipment_requires_update?(shipment) shipment.shipstation_synced_at && shipment.shipstation_synced_at < shipment.order.updated_at && Time.zone.now - shipment.order.updated_at < SolidusShipstation.config.api_sync_threshold end