Class: ActiveMerchant::Shipping::Stamps
- Defined in:
- lib/active_shipping/shipping/carriers/stamps.rb
Overview
Stamps.com integration for rating, tracking, address validation, and label generation Integration ID can be requested from Stamps.com
Constant Summary collapse
- LIVE_URL =
'https://swsim.stamps.com/swsim/swsimv34.asmx'- TEST_URL =
'https://swsim.testing.stamps.com/swsim/swsimv34.asmx'- NAMESPACE =
'http://stamps.com/xml/namespace/2014/01/swsim/swsimv34'- REQUIRED_OPTIONS =
[:integration_id, :username, :password].freeze
- PACKAGE =
[ 'Postcard', 'Letter', 'Large Envelope or Flat', 'Thick Envelope', 'Package', 'Flat Rate Box', 'Small Flat Rate Box', 'Large Flat Rate Box', 'Flat Rate Envelope', 'Flat Rate Padded Envelope', 'Large Package', 'Oversized Package', 'Regional Rate Box A', 'Regional Rate Box B', 'Regional Rate Box C', 'Legal Flat Rate Envelope' ].freeze
- US_POSSESSIONS =
["AS", "FM", "GU", "MH", "MP", "PW", "PR", "VI"]
- SERVICE_TYPES =
{ 'US-FC' => 'USPS First-Class Mail', 'US-MM' => 'USPS Media Mail', 'US-PM' => 'USPS Priority Mail', 'US-BP' => 'USPS BP', 'US-LM' => 'USPS LM', 'US-XM' => 'USPS Express Mail', 'US-EMI' => 'USPS Express Mail International', 'US-PMI' => 'USPS Priority Mail International', 'US-FCI' => 'USPS First Class Mail International', 'US-CM' => 'USPS Critical Mail', 'US-PS' => 'USPS Parcel Select' }
- ADD_ONS =
{ 'SC-A-HP' => 'Hidden Postage', 'SC-A-INS' => 'Insurance', 'SC-A-INSRM' => 'Insurance for Registered Mail', 'US-A-CM' => 'Certified Mail', 'US-A-COD' => 'Collect on Delivery', 'US-A-COM' => 'Certificate of Mailing', 'US-A-DC' => 'USPS Delivery Confirmation', 'US-A-ESH' => 'USPS Express - Sunday / Holiday Guaranteed', 'US-A-INS' => 'USPS Insurance', 'US-A-NDW' => 'USPS Express - No Delivery on Saturdays', 'US-A-RD' => 'Restricted Delivery', 'US-A-REG' => 'Registered Mail', 'US-A-RR' => 'Return Receipt Requested', 'US-A-RRM' => 'Return Receipt for Merchandise', 'US-A-SC' => 'USPS Signature Confirmation', 'US-A-SH' => 'Special Handling', 'US-A-NND' => 'Notice of non-delivery', 'US-A-SR' => 'Unknow Service Name SR', 'US-A-RRE' => 'Unknow Service Name RRE' }
- CARRIER_PICKUP_LOCATION =
{ 'FrontDoor' => 'Packages are at front door', 'BackDoor' => 'Packages are at back door', 'SideDoor' => 'Packages are at side door', 'KnockOnDoorOrRingBell' => 'Knock on door or ring bell', 'MailRoom' => 'Packages are in mail room', 'Office' => 'Packages are in office', 'Reception' => 'Packages are at reception area', 'InOrAtMailbox' => 'Packages are in mail box', 'Other' => 'Other Location' }
- PRINT_LAYOUTS =
[ 'Normal', 'NormalLeft', 'NormalRight', 'Normal4X6', 'Normal6X4', 'Normal75X2', 'NormalReceipt', 'NormalCN22', 'NormalCP72', 'Normal4X6CN22', 'Normal6X4CN22', 'Normal4X6CP72', 'Normal6X4CP72', 'Normal4X675', 'Normal4X675CN22', 'Normal4X675CP72', 'Return', 'ReturnCN22', 'ReturnCP72', 'Return4X675', 'Return4X675CN22', 'Return4X675CP72', 'SDC3510', 'SDC3520', 'SDC3530', 'SDC3610', 'SDC3710', 'SDC3810', 'SDC3820', 'SDC3910', 'Envelope9', 'Envelope10', 'Envelope11', 'Envelope12', 'EnvelopePersonal', 'EnvelopeMonarch', 'EnvelopeInvitation', 'EnvelopeGreeting' ]
- IMAGE_TYPE =
[ 'Auto', 'Epl', 'Gif', 'Jpg', 'Pdf', 'Png', 'Zpl' ]
- @@name =
'Stamps'
Instance Attribute Summary collapse
-
#last_swsim_method ⇒ Object
readonly
Returns the value of attribute last_swsim_method.
Attributes inherited from Carrier
Instance Method Summary collapse
- #account_info ⇒ Object
- #clear_authenticator ⇒ Object
- #create_shipment(origin, destination, package, line_items = [], options = {}) ⇒ Object
- #find_rates(origin, destination, package, options = {}) ⇒ Object
- #find_tracking_info(shipment_id, options = {}) ⇒ Object
- #namespace ⇒ Object
- #purchase_postage(purchase_amount, control_total) ⇒ Object
- #purchase_status(transaction_id) ⇒ Object
- #validate_address(address, options = {}) ⇒ Object
Methods inherited from Carrier
#initialize, #maximum_weight, #valid_credentials?
Constructor Details
This class inherits a constructor from ActiveMerchant::Shipping::Carrier
Instance Attribute Details
#last_swsim_method ⇒ Object (readonly)
Returns the value of attribute last_swsim_method.
16 17 18 |
# File 'lib/active_shipping/shipping/carriers/stamps.rb', line 16 def last_swsim_method @last_swsim_method end |
Instance Method Details
#account_info ⇒ Object
144 145 146 147 |
# File 'lib/active_shipping/shipping/carriers/stamps.rb', line 144 def account_info request = build_get_account_info_request response = commit(:GetAccountInfo, request) end |
#clear_authenticator ⇒ Object
191 192 193 |
# File 'lib/active_shipping/shipping/carriers/stamps.rb', line 191 def clear_authenticator @authenticator = nil end |
#create_shipment(origin, destination, package, line_items = [], options = {}) ⇒ Object
174 175 176 177 178 179 180 |
# File 'lib/active_shipping/shipping/carriers/stamps.rb', line 174 def create_shipment(origin, destination, package, line_items = [], = {}) origin = standardize_address(origin) destination = standardize_address(destination) request = build_create_indicium_request(origin, destination, package, line_items, ) response = commit(:CreateIndicium, request) end |
#find_rates(origin, destination, package, options = {}) ⇒ Object
166 167 168 169 170 171 172 |
# File 'lib/active_shipping/shipping/carriers/stamps.rb', line 166 def find_rates(origin, destination, package, = {}) origin = standardize_address(origin) destination = standardize_address(destination) request = build_rate_request(origin, destination, package, ) response = commit(:GetRates, request) end |
#find_tracking_info(shipment_id, options = {}) ⇒ Object
182 183 184 185 |
# File 'lib/active_shipping/shipping/carriers/stamps.rb', line 182 def find_tracking_info(shipment_id, = {}) request = build_track_shipment_request(shipment_id, ) response = commit(:TrackShipment, request) end |
#namespace ⇒ Object
187 188 189 |
# File 'lib/active_shipping/shipping/carriers/stamps.rb', line 187 def namespace NAMESPACE end |
#purchase_postage(purchase_amount, control_total) ⇒ Object
149 150 151 152 |
# File 'lib/active_shipping/shipping/carriers/stamps.rb', line 149 def purchase_postage(purchase_amount, control_total) request = build_purchase_postage_request(purchase_amount, control_total) response = commit(:PurchasePostage, request) end |
#purchase_status(transaction_id) ⇒ Object
154 155 156 157 |
# File 'lib/active_shipping/shipping/carriers/stamps.rb', line 154 def purchase_status(transaction_id) request = build_get_purchase_status(transaction_id) response = commit(:GetPurchaseStatus, request) end |
#validate_address(address, options = {}) ⇒ Object
159 160 161 162 163 164 |
# File 'lib/active_shipping/shipping/carriers/stamps.rb', line 159 def validate_address(address, = {}) address = standardize_address(address) request = build_cleanse_address_request(address) response = commit(:CleanseAddress, request) end |