Class: ReactiveShipping::Shipwire
- Defined in:
- lib/reactive_shipping/carriers/shipwire.rb
Constant Summary collapse
- URL =
'https://api.shipwire.com/exec/RateServices.php'
- SCHEMA_URL =
'http://www.shipwire.com/exec/download/RateRequest.dtd'
- WAREHOUSES =
{ 'CHI' => 'Chicago', 'LAX' => 'Los Angeles', 'REN' => 'Reno', 'VAN' => 'Vancouver', 'TOR' => 'Toronto', 'UK' => 'United Kingdom' }
- CARRIERS =
["UPS", "USPS", "FedEx", "Royal Mail", "Parcelforce", "Pharos", "Eurotrux", "Canada Post", "DHL"]
- SUCCESS =
"OK"
- SUCCESS_MESSAGE =
"Successfully received the shipping rates"
- NO_RATES_MESSAGE =
"No shipping rates could be found for the destination address"
- REQUIRED_OPTIONS =
[:login, :password].freeze
- @@name =
"Shipwire"
Instance Attribute Summary
Attributes inherited from Carrier
Instance Method Summary collapse
Methods inherited from Carrier
#available_services, #cancel_shipment, #create_shipment, default_location, #find_tracking_info, #initialize, #maximum_address_field_length, #maximum_weight, #save_request, #timestamp_from_business_day
Constructor Details
This class inherits a constructor from ReactiveShipping::Carrier
Instance Method Details
#find_rates(origin, destination, packages, options = {}) ⇒ Object
25 26 27 28 |
# File 'lib/reactive_shipping/carriers/shipwire.rb', line 25 def find_rates(origin, destination, packages, = {}) requires!(, :items) commit(origin, destination, ) end |
#valid_credentials? ⇒ Boolean
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/reactive_shipping/carriers/shipwire.rb', line 30 def valid_credentials? location = self.class.default_location find_rates(location, location, Package.new(100, [5, 15, 30]), :items => [{ :sku => '', :quantity => 1 }] ) rescue ReactiveShipping::ResponseError true rescue ActiveUtils::ResponseError => e e.response.code != '401' end |