reactive_shipping 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (247) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.travis.yml +33 -0
  4. data/.yardopts +13 -0
  5. data/CHANGELOG.md +225 -0
  6. data/CONTRIBUTING.md +23 -0
  7. data/Gemfile +3 -0
  8. data/MIT-LICENSE +21 -0
  9. data/README.md +158 -0
  10. data/Rakefile +35 -0
  11. data/dev.yml +17 -0
  12. data/gemfiles/activesupport42.gemfile +5 -0
  13. data/gemfiles/activesupport50.gemfile +6 -0
  14. data/gemfiles/activesupport51.gemfile +5 -0
  15. data/gemfiles/activesupport52.gemfile +5 -0
  16. data/gemfiles/activesupport_master.gemfile +5 -0
  17. data/lib/certs/eParcel.dtd +111 -0
  18. data/lib/reactive_shipping.rb +26 -0
  19. data/lib/reactive_shipping/address_validation_response.rb +30 -0
  20. data/lib/reactive_shipping/carrier.rb +184 -0
  21. data/lib/reactive_shipping/carriers.rb +35 -0
  22. data/lib/reactive_shipping/carriers/australia_post.rb +248 -0
  23. data/lib/reactive_shipping/carriers/benchmark_carrier.rb +31 -0
  24. data/lib/reactive_shipping/carriers/bogus_carrier.rb +12 -0
  25. data/lib/reactive_shipping/carriers/canada_post.rb +263 -0
  26. data/lib/reactive_shipping/carriers/canada_post_pws.rb +908 -0
  27. data/lib/reactive_shipping/carriers/fedex.rb +797 -0
  28. data/lib/reactive_shipping/carriers/kunaki.rb +155 -0
  29. data/lib/reactive_shipping/carriers/new_zealand_post.rb +260 -0
  30. data/lib/reactive_shipping/carriers/shipwire.rb +178 -0
  31. data/lib/reactive_shipping/carriers/stamps.rb +860 -0
  32. data/lib/reactive_shipping/carriers/ups.rb +1060 -0
  33. data/lib/reactive_shipping/carriers/usps.rb +708 -0
  34. data/lib/reactive_shipping/carriers/usps_returns.rb +86 -0
  35. data/lib/reactive_shipping/delivery_date_estimate.rb +20 -0
  36. data/lib/reactive_shipping/delivery_date_estimates_response.rb +11 -0
  37. data/lib/reactive_shipping/errors.rb +35 -0
  38. data/lib/reactive_shipping/external_return_label_request.rb +417 -0
  39. data/lib/reactive_shipping/external_return_label_response.rb +26 -0
  40. data/lib/reactive_shipping/label.rb +10 -0
  41. data/lib/reactive_shipping/label_response.rb +10 -0
  42. data/lib/reactive_shipping/location.rb +166 -0
  43. data/lib/reactive_shipping/package.rb +165 -0
  44. data/lib/reactive_shipping/package_item.rb +60 -0
  45. data/lib/reactive_shipping/rate_estimate.rb +197 -0
  46. data/lib/reactive_shipping/rate_response.rb +33 -0
  47. data/lib/reactive_shipping/response.rb +44 -0
  48. data/lib/reactive_shipping/shipment_event.rb +22 -0
  49. data/lib/reactive_shipping/shipment_packer.rb +108 -0
  50. data/lib/reactive_shipping/shipping_response.rb +34 -0
  51. data/lib/reactive_shipping/tracking_response.rb +120 -0
  52. data/lib/reactive_shipping/version.rb +3 -0
  53. data/reactive_shipping.gemspec +38 -0
  54. data/shipit.rubygems.yml +1 -0
  55. data/test/console.rb +39 -0
  56. data/test/credentials.yml +76 -0
  57. data/test/fixtures/files/label1.pdf +0 -0
  58. data/test/fixtures/files/ups-shipping-label.gif +0 -0
  59. data/test/fixtures/json/australia_post/calculate_domestic.json +13 -0
  60. data/test/fixtures/json/australia_post/calculate_domestic_2.json +19 -0
  61. data/test/fixtures/json/australia_post/calculate_international.json +12 -0
  62. data/test/fixtures/json/australia_post/calculate_international_2.json +15 -0
  63. data/test/fixtures/json/australia_post/error_message.json +5 -0
  64. data/test/fixtures/json/australia_post/service_domestic.json +117 -0
  65. data/test/fixtures/json/australia_post/service_domestic_2.json +117 -0
  66. data/test/fixtures/json/australia_post/service_international.json +76 -0
  67. data/test/fixtures/json/australia_post/service_international_2.json +59 -0
  68. data/test/fixtures/json/newzealandpost/domestic_book.json +1 -0
  69. data/test/fixtures/json/newzealandpost/domestic_default.json +1 -0
  70. data/test/fixtures/json/newzealandpost/domestic_error.json +1 -0
  71. data/test/fixtures/json/newzealandpost/domestic_poster.json +1 -0
  72. data/test/fixtures/json/newzealandpost/domestic_small_half_pound.json +1 -0
  73. data/test/fixtures/json/newzealandpost/international_book.json +1 -0
  74. data/test/fixtures/json/newzealandpost/international_new_zealand_wii.json +1 -0
  75. data/test/fixtures/json/newzealandpost/international_small_half_pound.json +1 -0
  76. data/test/fixtures/json/newzealandpost/international_wii.json +1 -0
  77. data/test/fixtures/xml/canadapost/example_request.xml +25 -0
  78. data/test/fixtures/xml/canadapost/example_response.xml +130 -0
  79. data/test/fixtures/xml/canadapost/example_response_error.xml +16 -0
  80. data/test/fixtures/xml/canadapost/example_response_french.xml +122 -0
  81. data/test/fixtures/xml/canadapost/example_response_with_nil_value.xml +164 -0
  82. data/test/fixtures/xml/canadapost/example_response_with_postal_outlet.xml +155 -0
  83. data/test/fixtures/xml/canadapost/example_response_with_postal_outlet_french.xml +274 -0
  84. data/test/fixtures/xml/canadapost/example_response_with_strange_delivery_date.xml +130 -0
  85. data/test/fixtures/xml/canadapost_pws/dnc_tracking_details_en.xml +112 -0
  86. data/test/fixtures/xml/canadapost_pws/merchant_details_error.xml +7 -0
  87. data/test/fixtures/xml/canadapost_pws/merchant_details_response.xml +7 -0
  88. data/test/fixtures/xml/canadapost_pws/option_response.xml +13 -0
  89. data/test/fixtures/xml/canadapost_pws/option_response_no_conflicts.xml +7 -0
  90. data/test/fixtures/xml/canadapost_pws/rates_info.xml +190 -0
  91. data/test/fixtures/xml/canadapost_pws/rates_info_error.xml +7 -0
  92. data/test/fixtures/xml/canadapost_pws/receipt_response.xml +42 -0
  93. data/test/fixtures/xml/canadapost_pws/receipt_response_no_priced_options.xml +36 -0
  94. data/test/fixtures/xml/canadapost_pws/register_token_error.xml +7 -0
  95. data/test/fixtures/xml/canadapost_pws/register_token_response.xml +3 -0
  96. data/test/fixtures/xml/canadapost_pws/service_options_response.xml +42 -0
  97. data/test/fixtures/xml/canadapost_pws/services_error.xml +6 -0
  98. data/test/fixtures/xml/canadapost_pws/services_response.xml +32 -0
  99. data/test/fixtures/xml/canadapost_pws/shipment_domestic.xml +69 -0
  100. data/test/fixtures/xml/canadapost_pws/shipment_response.xml +20 -0
  101. data/test/fixtures/xml/canadapost_pws/shipment_us.xml +69 -0
  102. data/test/fixtures/xml/canadapost_pws/tracking_details_en.xml +152 -0
  103. data/test/fixtures/xml/canadapost_pws/tracking_details_en_error.xml +7 -0
  104. data/test/fixtures/xml/canadapost_pws/tracking_details_en_undelivered.xml +116 -0
  105. data/test/fixtures/xml/canadapost_pws/tracking_details_fr.xml +156 -0
  106. data/test/fixtures/xml/canadapost_pws/tracking_details_no_expected_delivery_date.xml +40 -0
  107. data/test/fixtures/xml/fedex/create_shipment_response.xml +2 -0
  108. data/test/fixtures/xml/fedex/freight_rate_request.xml +82 -0
  109. data/test/fixtures/xml/fedex/freight_rate_response.xml +506 -0
  110. data/test/fixtures/xml/fedex/invalid_fedex_reply.xml +27 -0
  111. data/test/fixtures/xml/fedex/ottawa_to_beverly_hills_commercial_rate_request.xml +79 -0
  112. data/test/fixtures/xml/fedex/ottawa_to_beverly_hills_no_saturday_rate_request.xml +79 -0
  113. data/test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_request.xml +80 -0
  114. data/test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_response.xml +214 -0
  115. data/test/fixtures/xml/fedex/raterequest_reply.xml +213 -0
  116. data/test/fixtures/xml/fedex/raterequest_response_with_ground_home_delivery.xml +206 -0
  117. data/test/fixtures/xml/fedex/reply_without_notifications.xml +185 -0
  118. data/test/fixtures/xml/fedex/tracking_request.xml +29 -0
  119. data/test/fixtures/xml/fedex/tracking_response_bad_tracking_number.xml +20 -0
  120. data/test/fixtures/xml/fedex/tracking_response_delivered_at_door.xml +254 -0
  121. data/test/fixtures/xml/fedex/tracking_response_delivered_at_facility.xml +403 -0
  122. data/test/fixtures/xml/fedex/tracking_response_delivered_with_signature.xml +269 -0
  123. data/test/fixtures/xml/fedex/tracking_response_empty_status_detail.xml +84 -0
  124. data/test/fixtures/xml/fedex/tracking_response_failure_code_9045.xml +52 -0
  125. data/test/fixtures/xml/fedex/tracking_response_failure_code_9080.xml +51 -0
  126. data/test/fixtures/xml/fedex/tracking_response_in_transit.xml +127 -0
  127. data/test/fixtures/xml/fedex/tracking_response_invalid_tracking_number.xml +52 -0
  128. data/test/fixtures/xml/fedex/tracking_response_missing_status_code.xml +89 -0
  129. data/test/fixtures/xml/fedex/tracking_response_multiple_results.xml +100 -0
  130. data/test/fixtures/xml/fedex/tracking_response_not_found.xml +52 -0
  131. data/test/fixtures/xml/fedex/tracking_response_shipment_exception.xml +209 -0
  132. data/test/fixtures/xml/fedex/tracking_response_unable_to_process.xml +32 -0
  133. data/test/fixtures/xml/fedex/tracking_response_with_blank_state.xml +107 -0
  134. data/test/fixtures/xml/fedex/unknown_fedex_document_reply.xml +3 -0
  135. data/test/fixtures/xml/kunaki/invalid_state_response.xml +3 -0
  136. data/test/fixtures/xml/kunaki/no_valid_items_response.xml +3 -0
  137. data/test/fixtures/xml/kunaki/successful_rates_response.xml +3 -0
  138. data/test/fixtures/xml/kunaki/unsuccessful_rates_response.xml +9 -0
  139. data/test/fixtures/xml/shipwire/international_rates_response.xml +17 -0
  140. data/test/fixtures/xml/shipwire/new_carrier_rate_response.xml +18 -0
  141. data/test/fixtures/xml/shipwire/no_rates_response.xml +7 -0
  142. data/test/fixtures/xml/shipwire/rates_response.xml +36 -0
  143. data/test/fixtures/xml/shipwire/rates_response_no_estimate.xml +14 -0
  144. data/test/fixtures/xml/stamps/authenticate_user_request.xml +15 -0
  145. data/test/fixtures/xml/stamps/authenticate_user_response.xml +10 -0
  146. data/test/fixtures/xml/stamps/cleanse_address_request.xml +19 -0
  147. data/test/fixtures/xml/stamps/cleanse_address_response.xml +27 -0
  148. data/test/fixtures/xml/stamps/create_indicium_request.xml +69 -0
  149. data/test/fixtures/xml/stamps/create_indicium_response.xml +40 -0
  150. data/test/fixtures/xml/stamps/expired_authenticator_response.xml +15 -0
  151. data/test/fixtures/xml/stamps/get_account_info_request.xml +11 -0
  152. data/test/fixtures/xml/stamps/get_account_info_response.xml +36 -0
  153. data/test/fixtures/xml/stamps/get_purchase_status_request.xml +12 -0
  154. data/test/fixtures/xml/stamps/get_purchase_status_response.xml +16 -0
  155. data/test/fixtures/xml/stamps/get_rates_request.xml +19 -0
  156. data/test/fixtures/xml/stamps/get_rates_response.xml +351 -0
  157. data/test/fixtures/xml/stamps/purchase_postage_request.xml +13 -0
  158. data/test/fixtures/xml/stamps/purchase_postage_response.xml +17 -0
  159. data/test/fixtures/xml/stamps/track_shipment_request.xml +12 -0
  160. data/test/fixtures/xml/stamps/track_shipment_response.xml +45 -0
  161. data/test/fixtures/xml/ups/access_request.xml +6 -0
  162. data/test/fixtures/xml/ups/delivered_shipment_with_refund.xml +290 -0
  163. data/test/fixtures/xml/ups/delivered_shipment_without_events_tracking_response.xml +62 -0
  164. data/test/fixtures/xml/ups/delivery_dates_response.xml +140 -0
  165. data/test/fixtures/xml/ups/example_tracking_response.xml +53 -0
  166. data/test/fixtures/xml/ups/in_transit_shipment.xml +183 -0
  167. data/test/fixtures/xml/ups/out_for_delivery_shipment.xml +165 -0
  168. data/test/fixtures/xml/ups/package_exceeds_maximum_length.xml +12 -0
  169. data/test/fixtures/xml/ups/rate_single_service.xml +54 -0
  170. data/test/fixtures/xml/ups/rescheduled_shipment.xml +204 -0
  171. data/test/fixtures/xml/ups/shipment_accept_response.xml +42 -0
  172. data/test/fixtures/xml/ups/shipment_confirm_response.xml +33 -0
  173. data/test/fixtures/xml/ups/shipment_from_tiger_direct.xml +222 -0
  174. data/test/fixtures/xml/ups/test_real_home_as_residential_destination_response.xml +290 -0
  175. data/test/fixtures/xml/ups/test_real_home_as_residential_destination_response_with_insured.xml +289 -0
  176. data/test/fixtures/xml/ups/test_real_home_as_residential_destination_with_origin_account_response.xml +311 -0
  177. data/test/fixtures/xml/ups/tracking_request.xml +9 -0
  178. data/test/fixtures/xml/ups/triple_accept_response.xml +72 -0
  179. data/test/fixtures/xml/ups/triple_confirm_response.xml +32 -0
  180. data/test/fixtures/xml/ups/void_shipment_response.xml +11 -0
  181. data/test/fixtures/xml/usps/api_error_rate_response.xml +53 -0
  182. data/test/fixtures/xml/usps/beverly_hills_to_new_york_book_commercial_base_rate_response.xml +2 -0
  183. data/test/fixtures/xml/usps/beverly_hills_to_new_york_book_commercial_plus_rate_response.xml +258 -0
  184. data/test/fixtures/xml/usps/beverly_hills_to_new_york_book_rate_response.xml +108 -0
  185. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_american_wii_commercial_base_rate_response.xml +84 -0
  186. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_american_wii_commercial_plus_rate_response.xml +212 -0
  187. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_american_wii_rate_response.xml +230 -0
  188. data/test/fixtures/xml/usps/first_class_packages_with_invalid_mail_type_response.xml +12 -0
  189. data/test/fixtures/xml/usps/first_class_packages_with_mail_type_response.xml +16 -0
  190. data/test/fixtures/xml/usps/first_class_packages_without_mail_type_response.xml +12 -0
  191. data/test/fixtures/xml/usps/invalid_xml_response.xml +10 -0
  192. data/test/fixtures/xml/usps/invalid_xml_tracking_response_error.xml +2 -0
  193. data/test/fixtures/xml/usps/tracking_request.xml +10 -0
  194. data/test/fixtures/xml/usps/tracking_request_batch.xml +12 -0
  195. data/test/fixtures/xml/usps/tracking_response.xml +162 -0
  196. data/test/fixtures/xml/usps/tracking_response_alt.xml +53 -0
  197. data/test/fixtures/xml/usps/tracking_response_batch.xml +231 -0
  198. data/test/fixtures/xml/usps/tracking_response_failure.xml +11 -0
  199. data/test/fixtures/xml/usps/tracking_response_not_available.xml +12 -0
  200. data/test/fixtures/xml/usps/tracking_response_test_error.xml +8 -0
  201. data/test/fixtures/xml/usps/us_rate_request.xml +18 -0
  202. data/test/fixtures/xml/usps/us_rate_request_large.xml +18 -0
  203. data/test/fixtures/xml/usps/world_rate_request_only_country.xml +22 -0
  204. data/test/fixtures/xml/usps/world_rate_request_with_value.xml +24 -0
  205. data/test/fixtures/xml/usps/world_rate_request_without_value.xml +24 -0
  206. data/test/fixtures/xml/usps_returns/external_return_label_response.xml +2 -0
  207. data/test/fixtures/xml/usps_returns/external_return_label_response_failure.xml +10 -0
  208. data/test/remote/australia_post_test.rb +140 -0
  209. data/test/remote/canada_post_pws_platform_test.rb +259 -0
  210. data/test/remote/canada_post_pws_test.rb +169 -0
  211. data/test/remote/canada_post_test.rb +55 -0
  212. data/test/remote/fedex_test.rb +400 -0
  213. data/test/remote/kunaki_test.rb +37 -0
  214. data/test/remote/new_zealand_post_test.rb +149 -0
  215. data/test/remote/shipwire_test.rb +84 -0
  216. data/test/remote/stamps_test.rb +396 -0
  217. data/test/remote/usps_returns_test.rb +72 -0
  218. data/test/remote/usps_test.rb +243 -0
  219. data/test/test_helper.rb +296 -0
  220. data/test/unit/carrier_test.rb +130 -0
  221. data/test/unit/carriers/australia_post_test.rb +181 -0
  222. data/test/unit/carriers/benchmark_test.rb +18 -0
  223. data/test/unit/carriers/canada_post_pws_rating_test.rb +379 -0
  224. data/test/unit/carriers/canada_post_pws_register_test.rb +76 -0
  225. data/test/unit/carriers/canada_post_pws_shipping_test.rb +258 -0
  226. data/test/unit/carriers/canada_post_pws_test.rb +59 -0
  227. data/test/unit/carriers/canada_post_pws_tracking_test.rb +154 -0
  228. data/test/unit/carriers/canada_post_test.rb +148 -0
  229. data/test/unit/carriers/fedex_test.rb +693 -0
  230. data/test/unit/carriers/kunaki_test.rb +56 -0
  231. data/test/unit/carriers/new_zealand_post_test.rb +177 -0
  232. data/test/unit/carriers/shipwire_test.rb +188 -0
  233. data/test/unit/carriers/stamps_test.rb +245 -0
  234. data/test/unit/carriers/ups_test.rb +580 -0
  235. data/test/unit/carriers/usps_returns_test.rb +45 -0
  236. data/test/unit/carriers/usps_test.rb +633 -0
  237. data/test/unit/carriers_test.rb +16 -0
  238. data/test/unit/external_return_label_request_test.rb +258 -0
  239. data/test/unit/location_test.rb +234 -0
  240. data/test/unit/package_item_test.rb +232 -0
  241. data/test/unit/package_test.rb +404 -0
  242. data/test/unit/rate_estimate_test.rb +93 -0
  243. data/test/unit/response_test.rb +38 -0
  244. data/test/unit/shipment_event_test.rb +20 -0
  245. data/test/unit/shipment_packer_test.rb +212 -0
  246. data/test/unit/tracking_response_test.rb +41 -0
  247. metadata +684 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c43d1a97e5cb9e2e72ade72b5d17e95c89668aa2
4
+ data.tar.gz: 87e454f7865af135094523003ef4e3b5b3f87d57
5
+ SHA512:
6
+ metadata.gz: 26e31650d140395aacfa6449f0b37f740361dff22ec8624ba012ac159589794505f84fdb23a4d00bdd67df60970d2e9b74de36e453a4530f2938c21cbd5a574f
7
+ data.tar.gz: 2f03e4f98d09d7dc7b5d9a2bf14ccb4bcb8afb2533cffb2f437ef15c70c32048b387d8ccd113bf69cfbc05f78dc816206fc19002e5f4daf893da8a7823d8da8c
@@ -0,0 +1,15 @@
1
+ .DS_Store
2
+ test.xml
3
+ sample.rb
4
+ *.orig
5
+ pkg
6
+ .dotest
7
+ Gemfile*.lock
8
+ .rvmrc
9
+ test/fixtures/live_credentials.yml
10
+ .rbenv-version
11
+ .yardoc/
12
+ doc/
13
+ .idea
14
+ .bundle
15
+ .byebug_history
@@ -0,0 +1,33 @@
1
+ # travis.yml
2
+
3
+ language: ruby
4
+ script: bundle exec rake test
5
+ sudo: false
6
+
7
+ rvm:
8
+ - "2.2.2"
9
+ - "2.3.1"
10
+ - "2.4.1"
11
+
12
+ gemfile:
13
+ - gemfiles/activesupport42.gemfile
14
+ - gemfiles/activesupport50.gemfile
15
+ - gemfiles/activesupport51.gemfile
16
+ - gemfiles/activesupport52.gemfile
17
+
18
+ matrix:
19
+ include:
20
+ - rvm: "2.4.1"
21
+ gemfile: gemfiles/activesupport_master.gemfile
22
+ exclude:
23
+ - rvm: "2.4.1"
24
+ gemfile: gemfiles/activesupport42.gemfile
25
+
26
+ env:
27
+ global:
28
+ - ACTIVESHIPPING_NEW_ZEALAND_POST_KEY=4d9dc0f0-dda0-012e-066f-000c29b44ac0
29
+ - ACTIVESHIPPING_CANADA_POST_LOGIN=CPC_DEMO_XML
30
+ - ACTIVESHIPPING_CANADA_POST_PWS_CUSTOMER_NUMBER=2004381
31
+ - ACTIVESHIPPING_CANADA_POST_PWS_API_KEY=6e93d53968881714
32
+ - ACTIVESHIPPING_CANADA_POST_PWS_SECRET=0bfa9fcb9853d1f51ee57a
33
+ - ACTIVESHIPPING_USPS_LOGIN=677JADED7283
@@ -0,0 +1,13 @@
1
+ --readme README.md
2
+ --title 'ActiveShipping API documentation'
3
+ --charset utf-8
4
+ --hide-void-return
5
+ --protected
6
+ --no-private
7
+ --markup markdown
8
+ --markup-provider redcarpet
9
+ -
10
+ README.md
11
+ CHANGELOG.md
12
+ CONTRIBUTING.md
13
+ MIT-LICENSE
@@ -0,0 +1,225 @@
1
+ # ReactiveShipping CHANGELOG
2
+
3
+ ### v3.0.0
4
+
5
+ - Change ActiveShipping name to ReactiveShipping
6
+ - Return UPS support
7
+
8
+ ## (Previous) ActiveShipping
9
+
10
+ ### v2.2.0
11
+ - Remove UPS integration from ActiveShipping repository as requested by UPS. For information about the UPS APIs see https://www.ups.com/upsdeveloperkit
12
+
13
+ ### v2.1.1
14
+ - Update README to clarify Shopify's involvement moving forward with v2.x
15
+
16
+ ### v2.1.0
17
+ - Add email field to Location
18
+
19
+ ### v2.0.0
20
+ - Drop support for < ruby 2.2, support ruby 2.4
21
+ - Drop support for < Rails 4.2.
22
+ - BREAKING CHANGE: Use shopify/measured instead of shopify/quantified for dimensions and units.
23
+
24
+ ### v1.14.2
25
+ - Make saturday delivery an option for fedex
26
+
27
+ ### v1.14.1
28
+ - Fix parsing of CanadaPostPWS service options response.
29
+
30
+ ### v1.14.0
31
+ - Update Correios default services list.
32
+ - Fix CanadaPostPWS from generating an empty options tag.
33
+ - Allow contract-number on CanadaPost merchant detail's response to be nil.
34
+ - Fix a flakey UPS remote test that would fail only on Fridays.
35
+
36
+ ### v1.13.4
37
+ - Upcase postal code for CanadaPostPWS
38
+ - Fix failing USPS test
39
+ - add .byebug_history to .gitignore
40
+
41
+ ### v1.13.3
42
+ - CanadaPostPWS no longer modifies locations passed to it
43
+
44
+ ### v1.13.2
45
+ - Bump active_utils to 3.3.1
46
+ - Allow activesupport <5.2.0
47
+
48
+ ### v1.13.1
49
+ - Fix up UPS tracker parsing for Kosovo (KV)
50
+
51
+ ### v1.13.0
52
+ - Add default location for CanadaPost PWS
53
+ - Patch UPS to use old Kosovo country code
54
+ - Add option to not include tax in rates for CP PWS
55
+
56
+ ### v1.12.1
57
+ - Explicitly set ssl_version for USPS
58
+ - Strip 9 digit origin zip code for USPS world rate requests
59
+
60
+ ### v1.12.0
61
+ - Update active_utils dependency to v3.3.0
62
+
63
+ ### v1.8.6
64
+ - Fix UPS TrackResponse with no status code
65
+ - Stop FedEx from raising for successful responses with no statuses
66
+ - Raise appropriate exception response for FedEx errors
67
+
68
+ ### v1.8.5
69
+ - Fix UPS TrackResponse parsing for missing elements
70
+
71
+ ### v1.8.4
72
+ - Add price details to rate estimates
73
+ - Fix encoding for UPS responses
74
+
75
+ ### v1.8.3
76
+ - Add description field to rate estimates
77
+
78
+ ### v1.8.2
79
+ - Add option for FedEx label format
80
+ - Fix kunaki remote tests broken due to more shipping options
81
+
82
+ ### v1.6.1
83
+ - Fix FedEx ShipmentEvents to include event type
84
+ - Skip broken Canada Post remote tests
85
+
86
+ ### v1.6.0
87
+ - Update active_utils dependency to v3.2.0
88
+
89
+ ### v1.5.0
90
+ - Fix Kunaki remote test
91
+ - Fix credentials for Canada Post PWS remote tests
92
+ - Add compare price to rate estimate options
93
+ - Add phone required to rate estimate options
94
+ - Update active_utils dependency to v3.1.0
95
+
96
+ ### v1.4.3
97
+
98
+ - Fix UPS SurePost for < 1 pound packages
99
+ - Use status type code in UPS tracking
100
+ - Fix USPS and Fedex remote tests
101
+
102
+ ### v1.4.2
103
+
104
+ - Fix USPS rates for commercial shipments
105
+
106
+ ### v1.4.1
107
+
108
+ - Raise error on invalid status code with FedEx
109
+ - Fix USPS tracking to certain countries
110
+ - Fix USPS tracking of events with no time
111
+ - Fix USPS batch tracking error messages.
112
+ - Fix FedEx logging exception
113
+
114
+ ### v1.4.0
115
+
116
+ - Added support for USPS merchant returns service
117
+ - Added support for UPS SurePost
118
+ - Added support for UPS third party billing
119
+ - Fix FedEx tracking response errors
120
+ - Add rake console command for development
121
+
122
+ ### v1.3.0
123
+
124
+ - Support voiding labels on UPS
125
+ - Parse FedEx ground delivery dates
126
+ - Add maximum address length field
127
+ - Fix UPS unknown country code when using SUREPOST
128
+
129
+ ### v1.2.2
130
+
131
+ - Fix "RECTANGULAR" errors with small USPS US->US package rate requests
132
+ - Fix error tracking USPS packages to other countries
133
+ - Fix USPS rate requests to destinations with only a country.
134
+
135
+ ### v1.2.1
136
+
137
+ - Fix compatibility with latest USPS WEBTOOLS international rate schema changes.
138
+
139
+ ### v1.2.0
140
+
141
+ - Added support for buying labels with FedEx
142
+ - Added support for batched tracking requests with USPS
143
+
144
+ ### v1.1.3
145
+
146
+ - Handle ZIP+4 numbers in USPS tracking
147
+ - Add a field for rate estimate references
148
+ - Add support for UPS mail innovations tracking option
149
+
150
+ ### v1.1.2
151
+
152
+ - Fix finding of error descriptions for USPS tracking
153
+
154
+ ### v1.1.1
155
+
156
+ - Fix bug with USPS tracking not handling optional fields being absent.
157
+
158
+ ### v1.1.0
159
+
160
+ - USPS: Allows package tracking disambiguation and exposes predicted arrival date and event codes.
161
+
162
+ ### v1.0.0
163
+
164
+ - **BREAKING CHANGE:** Change namespace from `ActiveMerchant::Shipping` to `ActiveShipping`
165
+ - Drop support for Ruby 1.8 and Ruby 1.9.
166
+ - Drop support for ActiveSupport < 3.2, support up to ActiveSupport 4.2.
167
+ - Updated Fedex to use latest API version for tracking
168
+ - Various improvements to UPS carrier implementation.
169
+ - Small bugfixes in USPS carrier implementation.
170
+ - Various small bugfixes in XML handling for several carriers.
171
+ - Rewite all carriers to use nokogiri for XML parsing and generating.
172
+ - Bump `active_utils` dependency to require 3.x to avoid conflicts with `ActiveMerchant`.
173
+ - Extracted `quantified` into separate gem.
174
+ - Removed vendored `XmlNode` library.
175
+ - Removed `builder` dependency.
176
+ - Improved test setup that allows running functional tests on CI.
177
+ - Improved documentation of the abstraction API.
178
+
179
+ ### v0.10.1
180
+
181
+ - Canada Post PWS: Makes wrapper act more consistently with the rest of the API [jnormore]
182
+ - UPS: Adds insurance charge to package object declarations [pbonnell]
183
+ - USPS: Improves how unavailable delivery information is handled [cyu]
184
+ - Shipment Packer: Prevents packing errors and consistently return an array when packing [christianblais]
185
+ - General: Improves tests such that they work with ruby 2.0 [Sirupsen]
186
+
187
+ ### 2011/04/21
188
+
189
+ * USPS updated to use new APIs [james]
190
+ * new :gift boolean option for Package [james]
191
+ * Location's :address_type can be "po_box" [james]
192
+
193
+ ### Earlier
194
+
195
+ * New Zealand Post [AbleTech]
196
+ * Include address name for rate requests to Shipwire if provided [dennis]
197
+ * Add support for address name to Location [dennis]
198
+ * Add fix for updated USPS API to strip any encoded html and trailing asterisks from rate names [dennis]
199
+ * Add carrier CanadaPost [william]
200
+ * Update FedEx rates and added ability to auto-generate rate name from code that gets returned by FedEx [dennis]
201
+ * Assume test_helper is in load path when running tests [cody]
202
+ * Add support Kunaki rating service [cody]
203
+ * Require active_support instead of activesupport to avoid deprecation warning in Rails 2.3.5 [cody]
204
+ * Remove ftools for Rails 1.9 compatibility and remove xml logging, as logging is now included in the connection [cody]
205
+ * Update connection code from ActiveMerchant [cody]
206
+ * Fix space-ridden USPS usernames when validating credentials [james]
207
+ * Remove extra slash from USPS URLs [james]
208
+ * Update Shipwire endpoint hostname [cody]
209
+ * Add missing ISO countries [Edward Ocampo-Gooding]
210
+ * Add support for Guernsey to country.rb [cody]
211
+ * Use :words_connector instead of connector in RequiresParameters [cody]
212
+ * Add name to Shipwire class [cody]
213
+ * Improve FedEx handling of some error conditions [cody]
214
+ * Add support for validating credentials to Shipwire [cody]
215
+ * Add support for ssl_get to PostsData. Update Carriers to use PostsData module. Turn on retry safety for carriers [cody]
216
+ * Add support for Shipwire Shipping Rate API [cody]
217
+ * Cleanup package tests [cody]
218
+ * Remove unused Carrier#setup method [cody]
219
+ * Don't use Array splat in Regex comparisons in Package [cody]
220
+ * Default the Location to use the :alpha2 country code format [cody]
221
+ * Add configurable timeouts from Active Merchant [cody]
222
+ * Update xml_node.rb from XML Node [cody]
223
+ * Update requires_parameters from ActiveMerchant [cody]
224
+ * Sync posts_data.rb with ActiveMerchant [cody]
225
+ * Don't use credentials fixtures in local tests [cody]
@@ -0,0 +1,23 @@
1
+ # Contributing to ReactiveShipping
2
+
3
+ We love receiving pull requests! Anything from new carriers to documentation fixes.
4
+
5
+ Also, we are looking for maintainers for the current version of ReactiveShipping 2.0.
6
+
7
+ ## Standards
8
+
9
+ * PR should explain what the feature does, and why the change exists.
10
+ * PR should include any carrier specific documentation explaining how it works.
11
+ * Code _must_ be tested, including both unit and remote tests where applicable.
12
+ * Be consistent. Write clean code that follows [Ruby community standards](https://github.com/bbatsov/ruby-style-guide).
13
+ * Code should be generic and reusable.
14
+
15
+ If you're stuck, ask questions!
16
+
17
+ ## How to contribute
18
+
19
+ 1. Fork it ( https://github.com/realsubpop/reactive_shipping/fork )
20
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
21
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
22
+ 4. Push to the branch (`git push origin my-new-feature`)
23
+ 5. Create a new Pull Request
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,21 @@
1
+ Copyright for portions of project ReactiveShipping are held by Shopify 2016 as part of project ActiveShipping.
2
+ All other copyright for project ReactiveShipping are held by Sub Pop Records, 2018.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,158 @@
1
+ # ReactiveShipping [![Build status](https://travis-ci.org/realsubpop/reactive_shipping.svg?branch=master)](https://travis-ci.org/realsubpop/reactive_shipping)
2
+
3
+ This library interfaces with the web services of various shipping carriers. The goal is to abstract the features that are most frequently used into a pleasant and consistent Ruby API:
4
+
5
+ - Finding shipping rates
6
+ - Registering shipments
7
+ - Tracking shipments
8
+ - Purchasing shipping labels
9
+
10
+ ## Supported Shipping Carriers
11
+
12
+
13
+ * [UPS](http://www.ups.com)
14
+ * [USPS](http://www.usps.com)
15
+ * [USPS Returns](http://returns.usps.com)
16
+ * [FedEx](http://www.fedex.com)
17
+ * [Canada Post](http://www.canadapost.ca)
18
+ * [New Zealand Post](http://www.nzpost.co.nz)
19
+ * [Shipwire](http://www.shipwire.com)
20
+ * [Stamps](http://www.stamps.com)
21
+ * [Kunaki](http://www.kunaki.com)
22
+ * [Australia Post](http://auspost.com.au/)
23
+
24
+ ## Installation
25
+
26
+ Using bundler, add to the `Gemfile`:
27
+
28
+ ```ruby
29
+ gem 'reactive_shipping'
30
+ ```
31
+
32
+ Or stand alone:
33
+
34
+ ```
35
+ $ gem install reactive_shipping
36
+ ```
37
+
38
+
39
+ ## Sample Usage
40
+
41
+ ### Compare rates from different carriers
42
+
43
+ ```ruby
44
+ require 'reactive_shipping'
45
+
46
+ # Package up a poster and a Wii for your nephew.
47
+ packages = [
48
+ ReactiveShipping::Package.new(100, # 100 grams
49
+ [93,10], # 93 cm long, 10 cm diameter
50
+ cylinder: true), # cylinders have different volume calculations
51
+
52
+ ReactiveShipping::Package.new(7.5 * 16, # 7.5 lbs, times 16 oz/lb.
53
+ [15, 10, 4.5], # 15x10x4.5 inches
54
+ units: :imperial) # not grams, not centimetres
55
+ ]
56
+
57
+ # You live in Beverly Hills, he lives in Ottawa
58
+ origin = ReactiveShipping::Location.new(country: 'US',
59
+ state: 'CA',
60
+ city: 'Beverly Hills',
61
+ zip: '90210')
62
+
63
+ destination = ReactiveShipping::Location.new(country: 'CA',
64
+ province: 'ON',
65
+ city: 'Ottawa',
66
+ postal_code: 'K1P 1J1')
67
+
68
+ # Find out how much it'll be.
69
+ usps = ReactiveShipping::USPS.new(login: 'developer-key')
70
+ response = usps.find_rates(origin, destination, packages)
71
+
72
+ usps_rates = response.rates.sort_by(&:price).collect {|rate| [rate.service_name, rate.price]}
73
+ # => [["USPS Priority Mail International", 4110],
74
+ # ["USPS Express Mail International (EMS)", 5750],
75
+ # ["USPS Global Express Guaranteed Non-Document Non-Rectangular", 9400],
76
+ # ["USPS GXG Envelopes", 9400],
77
+ # ["USPS Global Express Guaranteed Non-Document Rectangular", 9400],
78
+ # ["USPS Global Express Guaranteed", 9400]]
79
+ ```
80
+
81
+ Dimensions for packages are in `Height x Width x Length` order.
82
+
83
+ ### Track a FedEx package
84
+
85
+ ```ruby
86
+ fedex = ReactiveShipping::FedEx.new(login: '999999999', password: '7777777', key: '1BXXXXXXXXXxrcB', account: '51XXXXX20')
87
+ tracking_info = fedex.find_tracking_info('tracking-number', carrier_code: 'fedex_ground') # Ground package
88
+
89
+ tracking_info.shipment_events.each do |event|
90
+ puts "#{event.name} at #{event.location.city}, #{event.location.state} on #{event.time}. #{event.message}"
91
+ end
92
+ # => Package information transmitted to FedEx at NASHVILLE LOCAL, TN on Thu Oct 23 00:00:00 UTC 2008.
93
+ # Picked up by FedEx at NASHVILLE LOCAL, TN on Thu Oct 23 17:30:00 UTC 2008.
94
+ # Scanned at FedEx sort facility at NASHVILLE, TN on Thu Oct 23 18:50:00 UTC 2008.
95
+ # Departed FedEx sort facility at NASHVILLE, TN on Thu Oct 23 22:33:00 UTC 2008.
96
+ # Arrived at FedEx sort facility at KNOXVILLE, TN on Fri Oct 24 02:45:00 UTC 2008.
97
+ # Scanned at FedEx sort facility at KNOXVILLE, TN on Fri Oct 24 05:56:00 UTC 2008.
98
+ # Delivered at Knoxville, TN on Fri Oct 24 16:45:00 UTC 2008. Signed for by: T.BAKER
99
+ ```
100
+
101
+ ## Carrier specific notes
102
+
103
+ ### FedEx connection
104
+
105
+ The `:login` key passed to `ReactiveShipping::FedEx.new()` is really the FedEx meter number, not the FedEx login.
106
+
107
+ When developing with test credentials, be sure to pass `test: true` to `ReactiveShipping::FedEx.new()`.
108
+
109
+
110
+ ## Tests
111
+
112
+ You can run the unit tests with:
113
+
114
+ ```
115
+ bundle exec rake test:unit
116
+ ```
117
+
118
+ and the remote tests with:
119
+
120
+ ```
121
+ bundle exec rake test:remote
122
+ ```
123
+
124
+ The unit tests mock out requests and responses so that everything runs locally, while the remote tests actually hit the carrier servers. For the remote tests, you'll need valid test credentials for any carriers' tests you want to run. The credentials should go in [`~/.reactive_shipping/credentials.yml`](https://github.com/realsubpop/reactive_shipping/blob/master/test/credentials.yml). For some carriers, we have public credentials you can use for testing in `.travis.yml`. Remote tests missing credentials will be skipped.
125
+
126
+
127
+ ## Contributing
128
+
129
+ See [CONTRIBUTING.md](https://github.com/realsubpop/reactive_shipping/blob/master/CONTRIBUTING.md).
130
+
131
+ We love getting pull requests! Anything from new features to documentation clean up.
132
+
133
+ If you're building a new carrier, a good place to start is in the [`Carrier` base class](https://github.com/realsubpop/reactive_shipping/blob/master/lib/reactive_shipping/carrier.rb).
134
+
135
+ It would also be good to familiarize yourself with [`Location`](https://github.com/realsubpop/reactive_shipping/blob/master/lib/reactive_shipping/location.rb), [`Package`](https://github.com/realsubpop/reactive_shipping/blob/master/lib/reactive_shipping/package.rb), and [`Response`](https://github.com/realsubpop/reactive_shipping/blob/master/lib/reactive_shipping/response.rb).
136
+
137
+ You can use the [`test/console.rb`](https://github.com/realsubpop/reactive_shipping/blob/master/test/console.rb) to do some local testing against real endpoints.
138
+
139
+ To log requests and responses, just set the `logger` on your Carrier class to some kind of `Logger` object:
140
+
141
+ ```ruby
142
+ ReactiveShipping::USPS.logger = Logger.new(STDOUT)
143
+ ```
144
+
145
+ ### Anatomy of a pull request
146
+
147
+ Any new features or carriers should have passing unit _and_ remote tests. Look at some existing carriers as examples.
148
+
149
+ When opening a pull request, include description of the feature, why it exists, and any supporting documentation to explain interaction with carriers.
150
+
151
+
152
+ ### How to contribute
153
+
154
+ 1. Fork it ( https://github.com/realsubpop/reactive_shipping/fork )
155
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
156
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
157
+ 4. Push to the branch (`git push origin my-new-feature`)
158
+ 5. Create a new Pull Request