active_shipping 1.0.0.pre2 → 1.0.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.gitignore +12 -0
  5. data/.travis.yml +14 -0
  6. data/.yardopts +14 -0
  7. data/Gemfile +3 -0
  8. data/Gemfile.activesupport32 +4 -0
  9. data/Gemfile.activesupport40 +4 -0
  10. data/Gemfile.activesupport41 +4 -0
  11. data/Gemfile.activesupport42 +4 -0
  12. data/Rakefile +23 -0
  13. data/active_shipping.gemspec +32 -0
  14. data/lib/active_shipping.rb +1 -1
  15. data/lib/active_shipping/carrier.rb +1 -1
  16. data/lib/active_shipping/carriers/shipwire.rb +32 -35
  17. data/lib/active_shipping/carriers/ups.rb +2 -2
  18. data/lib/active_shipping/carriers/usps.rb +103 -101
  19. data/lib/active_shipping/label_response.rb +1 -1
  20. data/lib/active_shipping/rate_estimate.rb +76 -15
  21. data/lib/active_shipping/rate_response.rb +20 -0
  22. data/lib/active_shipping/response.rb +17 -0
  23. data/lib/active_shipping/shipment_packer.rb +2 -2
  24. data/lib/active_shipping/shipping_response.rb +24 -2
  25. data/lib/active_shipping/tracking_response.rb +65 -17
  26. data/lib/active_shipping/version.rb +1 -1
  27. data/shipit.rubygems.yml +1 -0
  28. data/test/credentials.yml +47 -0
  29. data/test/fixtures/files/label1.pdf +0 -0
  30. data/test/fixtures/files/ups-shipping-label.gif +0 -0
  31. data/test/fixtures/json/newzealandpost/domestic_book.json +1 -0
  32. data/test/fixtures/json/newzealandpost/domestic_default.json +1 -0
  33. data/test/fixtures/json/newzealandpost/domestic_error.json +1 -0
  34. data/test/fixtures/json/newzealandpost/domestic_poster.json +1 -0
  35. data/test/fixtures/json/newzealandpost/domestic_small_half_pound.json +1 -0
  36. data/test/fixtures/json/newzealandpost/international_book.json +1 -0
  37. data/test/fixtures/json/newzealandpost/international_new_zealand_wii.json +1 -0
  38. data/test/fixtures/json/newzealandpost/international_small_half_pound.json +1 -0
  39. data/test/fixtures/json/newzealandpost/international_wii.json +1 -0
  40. data/test/fixtures/xml/canadapost/example_request.xml +25 -0
  41. data/test/fixtures/xml/canadapost/example_response.xml +130 -0
  42. data/test/fixtures/xml/canadapost/example_response_error.xml +16 -0
  43. data/test/fixtures/xml/canadapost/example_response_french.xml +122 -0
  44. data/test/fixtures/xml/canadapost/example_response_with_nil_value.xml +164 -0
  45. data/test/fixtures/xml/canadapost/example_response_with_postal_outlet.xml +155 -0
  46. data/test/fixtures/xml/canadapost/example_response_with_postal_outlet_french.xml +274 -0
  47. data/test/fixtures/xml/canadapost/example_response_with_strange_delivery_date.xml +130 -0
  48. data/test/fixtures/xml/canadapost_pws/dnc_tracking_details_en.xml +112 -0
  49. data/test/fixtures/xml/canadapost_pws/merchant_details_error.xml +7 -0
  50. data/test/fixtures/xml/canadapost_pws/merchant_details_response.xml +7 -0
  51. data/test/fixtures/xml/canadapost_pws/option_response.xml +13 -0
  52. data/test/fixtures/xml/canadapost_pws/option_response_no_conflicts.xml +7 -0
  53. data/test/fixtures/xml/canadapost_pws/rates_info.xml +190 -0
  54. data/test/fixtures/xml/canadapost_pws/rates_info_error.xml +7 -0
  55. data/test/fixtures/xml/canadapost_pws/receipt_response.xml +42 -0
  56. data/test/fixtures/xml/canadapost_pws/receipt_response_no_priced_options.xml +36 -0
  57. data/test/fixtures/xml/canadapost_pws/register_token_error.xml +7 -0
  58. data/test/fixtures/xml/canadapost_pws/register_token_response.xml +3 -0
  59. data/test/fixtures/xml/canadapost_pws/service_options_response.xml +42 -0
  60. data/test/fixtures/xml/canadapost_pws/services_error.xml +6 -0
  61. data/test/fixtures/xml/canadapost_pws/services_response.xml +32 -0
  62. data/test/fixtures/xml/canadapost_pws/shipment_domestic.xml +69 -0
  63. data/test/fixtures/xml/canadapost_pws/shipment_response.xml +20 -0
  64. data/test/fixtures/xml/canadapost_pws/shipment_us.xml +69 -0
  65. data/test/fixtures/xml/canadapost_pws/tracking_details_en.xml +152 -0
  66. data/test/fixtures/xml/canadapost_pws/tracking_details_en_error.xml +7 -0
  67. data/test/fixtures/xml/canadapost_pws/tracking_details_en_undelivered.xml +116 -0
  68. data/test/fixtures/xml/canadapost_pws/tracking_details_fr.xml +156 -0
  69. data/test/fixtures/xml/canadapost_pws/tracking_details_no_expected_delivery_date.xml +40 -0
  70. data/test/fixtures/xml/fedex/freight_rate_request.xml +82 -0
  71. data/test/fixtures/xml/fedex/freight_rate_response.xml +506 -0
  72. data/test/fixtures/xml/fedex/invalid_fedex_reply.xml +27 -0
  73. data/test/fixtures/xml/fedex/ottawa_to_beverly_hills_commercial_rate_request.xml +79 -0
  74. data/test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_request.xml +80 -0
  75. data/test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_response.xml +214 -0
  76. data/test/fixtures/xml/fedex/raterequest_reply.xml +213 -0
  77. data/test/fixtures/xml/fedex/reply_without_notifications.xml +185 -0
  78. data/test/fixtures/xml/fedex/tracking_request.xml +27 -0
  79. data/test/fixtures/xml/fedex/tracking_response.xml +151 -0
  80. data/test/fixtures/xml/fedex/tracking_response_empty_destination.xml +76 -0
  81. data/test/fixtures/xml/fedex/tracking_response_no_destination.xml +139 -0
  82. data/test/fixtures/xml/fedex/tracking_response_no_ship_time.xml +150 -0
  83. data/test/fixtures/xml/fedex/tracking_response_with_estimated_delivery_date.xml +95 -0
  84. data/test/fixtures/xml/fedex/tracking_response_with_shipper_address.xml +71 -0
  85. data/test/fixtures/xml/fedex/unknown_fedex_document_reply.xml +3 -0
  86. data/test/fixtures/xml/kunaki/invalid_state_response.xml +3 -0
  87. data/test/fixtures/xml/kunaki/no_valid_items_response.xml +3 -0
  88. data/test/fixtures/xml/kunaki/successful_rates_response.xml +3 -0
  89. data/test/fixtures/xml/kunaki/unsuccessful_rates_response.xml +9 -0
  90. data/test/fixtures/xml/shipwire/international_rates_response.xml +17 -0
  91. data/test/fixtures/xml/shipwire/new_carrier_rate_response.xml +18 -0
  92. data/test/fixtures/xml/shipwire/no_rates_response.xml +7 -0
  93. data/test/fixtures/xml/shipwire/rates_response.xml +36 -0
  94. data/test/fixtures/xml/shipwire/rates_response_no_estimate.xml +14 -0
  95. data/test/fixtures/xml/stamps/authenticate_user_request.xml +15 -0
  96. data/test/fixtures/xml/stamps/authenticate_user_response.xml +10 -0
  97. data/test/fixtures/xml/stamps/cleanse_address_request.xml +19 -0
  98. data/test/fixtures/xml/stamps/cleanse_address_response.xml +27 -0
  99. data/test/fixtures/xml/stamps/create_indicium_request.xml +69 -0
  100. data/test/fixtures/xml/stamps/create_indicium_response.xml +40 -0
  101. data/test/fixtures/xml/stamps/expired_authenticator_response.xml +15 -0
  102. data/test/fixtures/xml/stamps/get_account_info_request.xml +11 -0
  103. data/test/fixtures/xml/stamps/get_account_info_response.xml +36 -0
  104. data/test/fixtures/xml/stamps/get_purchase_status_request.xml +12 -0
  105. data/test/fixtures/xml/stamps/get_purchase_status_response.xml +16 -0
  106. data/test/fixtures/xml/stamps/get_rates_request.xml +19 -0
  107. data/test/fixtures/xml/stamps/get_rates_response.xml +351 -0
  108. data/test/fixtures/xml/stamps/purchase_postage_request.xml +13 -0
  109. data/test/fixtures/xml/stamps/purchase_postage_response.xml +17 -0
  110. data/test/fixtures/xml/stamps/track_shipment_request.xml +12 -0
  111. data/test/fixtures/xml/stamps/track_shipment_response.xml +45 -0
  112. data/test/fixtures/xml/ups/delivered_shipment_with_refund.xml +290 -0
  113. data/test/fixtures/xml/ups/delivered_shipment_without_events_tracking_response.xml +62 -0
  114. data/test/fixtures/xml/ups/example_tracking_response.xml +53 -0
  115. data/test/fixtures/xml/ups/in_transit_shipment.xml +183 -0
  116. data/test/fixtures/xml/ups/out_for_delivery_shipment.xml +165 -0
  117. data/test/fixtures/xml/ups/shipment_accept_response.xml +42 -0
  118. data/test/fixtures/xml/ups/shipment_confirm_response.xml +33 -0
  119. data/test/fixtures/xml/ups/shipment_from_tiger_direct.xml +222 -0
  120. data/test/fixtures/xml/ups/test_real_home_as_residential_destination_response.xml +1 -0
  121. data/test/fixtures/xml/ups/test_real_home_as_residential_destination_response_with_insured.xml +289 -0
  122. data/test/fixtures/xml/ups/test_real_home_as_residential_destination_with_origin_account_response.xml +311 -0
  123. data/test/fixtures/xml/ups/triple_accept_response.xml +72 -0
  124. data/test/fixtures/xml/ups/triple_confirm_response.xml +32 -0
  125. data/test/fixtures/xml/usps/beverly_hills_to_new_york_book_commercial_base_rate_response.xml +2 -0
  126. data/test/fixtures/xml/usps/beverly_hills_to_new_york_book_commercial_plus_rate_response.xml +258 -0
  127. data/test/fixtures/xml/usps/beverly_hills_to_new_york_book_rate_response.xml +108 -0
  128. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_american_wii_commercial_base_rate_response.xml +84 -0
  129. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_american_wii_commercial_plus_rate_response.xml +212 -0
  130. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_american_wii_rate_response.xml +230 -0
  131. data/test/fixtures/xml/usps/delivered_tracking_response.xml +11 -0
  132. data/test/fixtures/xml/usps/first_class_packages_with_invalid_mail_type_response.xml +12 -0
  133. data/test/fixtures/xml/usps/first_class_packages_with_mail_type_response.xml +16 -0
  134. data/test/fixtures/xml/usps/first_class_packages_without_mail_type_response.xml +12 -0
  135. data/test/fixtures/xml/usps/invalid_xml_tracking_response_error.xml +2 -0
  136. data/test/fixtures/xml/usps/tracking_request.xml +3 -0
  137. data/test/fixtures/xml/usps/tracking_response.xml +13 -0
  138. data/test/fixtures/xml/usps/tracking_response_failure.xml +3 -0
  139. data/test/fixtures/xml/usps/tracking_response_not_available.xml +12 -0
  140. data/test/fixtures/xml/usps/tracking_response_test_error.xml +8 -0
  141. data/test/fixtures/xml/usps/us_rate_request.xml +18 -0
  142. data/test/fixtures/xml/usps/world_rate_request_with_value.xml +20 -0
  143. data/test/fixtures/xml/usps/world_rate_request_without_value.xml +20 -0
  144. data/test/remote/canada_post_pws_platform_test.rb +246 -0
  145. data/test/remote/canada_post_pws_test.rb +171 -0
  146. data/test/remote/canada_post_test.rb +53 -0
  147. data/test/remote/fedex_test.rb +216 -0
  148. data/test/remote/kunaki_test.rb +36 -0
  149. data/test/remote/new_zealand_post_test.rb +147 -0
  150. data/test/remote/shipwire_test.rb +82 -0
  151. data/test/remote/stamps_test.rb +394 -0
  152. data/test/remote/ups_test.rb +257 -0
  153. data/test/remote/usps_test.rb +235 -0
  154. data/test/test_helper.rb +220 -0
  155. data/test/unit/carriers/benchmark_test.rb +18 -0
  156. data/test/unit/carriers/canada_post_pws_rating_test.rb +349 -0
  157. data/test/unit/carriers/canada_post_pws_register_test.rb +75 -0
  158. data/test/unit/carriers/canada_post_pws_shipping_test.rb +244 -0
  159. data/test/unit/carriers/canada_post_pws_tracking_test.rb +154 -0
  160. data/test/unit/carriers/canada_post_test.rb +145 -0
  161. data/test/unit/carriers/fedex_test.rb +408 -0
  162. data/test/unit/carriers/kunaki_test.rb +52 -0
  163. data/test/unit/carriers/new_zealand_post_test.rb +174 -0
  164. data/test/unit/carriers/shipwire_test.rb +187 -0
  165. data/test/unit/carriers/stamps_test.rb +241 -0
  166. data/test/unit/carriers/ups_test.rb +311 -0
  167. data/test/unit/carriers/usps_test.rb +484 -0
  168. data/test/unit/carriers_test.rb +17 -0
  169. data/test/unit/label_response_test.rb +15 -0
  170. data/test/unit/location_test.rb +138 -0
  171. data/test/unit/package_test.rb +68 -0
  172. data/test/unit/rate_estimate_test.rb +34 -0
  173. data/test/unit/response_test.rb +14 -0
  174. data/test/unit/shipment_packer_test.rb +174 -0
  175. metadata +331 -35
  176. metadata.gz.sig +0 -0
  177. data/lib/vendor/quantified/MIT-LICENSE +0 -22
  178. data/lib/vendor/quantified/README.markdown +0 -49
  179. data/lib/vendor/quantified/Rakefile +0 -13
  180. data/lib/vendor/quantified/init.rb +0 -0
  181. data/lib/vendor/quantified/lib/quantified.rb +0 -6
  182. data/lib/vendor/quantified/lib/quantified/attribute.rb +0 -211
  183. data/lib/vendor/quantified/lib/quantified/length.rb +0 -20
  184. data/lib/vendor/quantified/lib/quantified/mass.rb +0 -19
  185. data/lib/vendor/quantified/test/length_test.rb +0 -94
  186. data/lib/vendor/quantified/test/mass_test.rb +0 -96
  187. data/lib/vendor/quantified/test/test_helper.rb +0 -19
@@ -1,7 +1,7 @@
1
1
  module ActiveShipping
2
+
2
3
  # This is UPS specific for now; the hash is not at all generic
3
4
  # or common between carriers.
4
-
5
5
  class LabelResponse < Response
6
6
  attr :params # maybe?
7
7
 
@@ -1,18 +1,64 @@
1
- module ActiveShipping #:nodoc:
1
+ module ActiveShipping
2
+
3
+ # Class representing a shipping option with estimated price.
4
+ #
5
+ # @!attribute origin
6
+ # The origin of the shipment
7
+ # @return [ActiveShipping::Location]
8
+ #
9
+ # @!attribute desination
10
+ # The desination of the shipment
11
+ # @return [ActiveShipping::Location]
12
+ #
13
+ # @!attribute package_rates
14
+ # A list of rates for all the packages in the shipment.
15
+ # @return [Array<{:rate => Integer, :package => ActiveShipping::Package}>]
16
+ #
17
+ # @!attribute carrier
18
+ # The name of the carrier (i.e. , e.g. 'USPS', 'FedEx')
19
+ # @return [String]
20
+ # @see ActiveShipping::Carrier.name
21
+ #
22
+ # @!attribute service_name
23
+ # The name of the shipping service (e.g. `"First Class Ground"`)
24
+ # @return [String]
25
+ #
26
+ # @!attribute service_code
27
+ # The code of the shipping service
28
+ # @return [String]
29
+ #
30
+ # @!attribute shipping_date
31
+ # The date on which the shipment will be expected. Normally, this means that the
32
+ # delivery date range can only pe prmoised if the shipment is handed over on or
33
+ # before this date.
34
+ # @return [Date]
35
+ #
36
+ # @!attribute delivery_date
37
+ # The date on which the shipment will be delivered. This is usually only availablee
38
+ # for express shipments; in order cases a {#delivery_range} is given instead.
39
+ # @return [Date]
40
+ #
41
+ # @!attribute delivery_range
42
+ # The minimum and maximum date of when the shipment is expected to be delivered.
43
+ # @return [Array<Date>]
44
+ #
45
+ # @!attribute currency
46
+ # ISO4217 currency code of the quoted rate estimates, e.g. `CAD`, `EUR`, or `USD`.
47
+ # @return [String]
48
+ # @see http://en.wikipedia.org/wiki/ISO_4217
49
+ #
50
+ # @!attribute negotiated_rate
51
+ # The negotiated rate in cents
52
+ # @return [Integer]
53
+ #
54
+ # @!attribute insurance_price
55
+ # The price of insurance in cents.
56
+ # @return [Integer]
2
57
  class RateEstimate
3
- attr_reader :origin # Location objects
4
- attr_reader :destination
5
- attr_reader :package_rates # array of hashes in the form of {:package => <Package>, :rate => 500}
6
- attr_reader :carrier # Carrier.name ('USPS', 'FedEx', etc.)
7
- attr_reader :service_name # name of service ("First Class Ground", etc.)
8
- attr_reader :service_code
9
- attr_reader :currency # 'USD', 'CAD', etc.
10
- # http://en.wikipedia.org/wiki/ISO_4217
11
- attr_reader :shipping_date
12
- attr_reader :delivery_date # Usually only available for express shipments
13
- attr_reader :delivery_range # Min and max delivery estimate in days
14
- attr_reader :negotiated_rate
15
- attr_reader :insurance_price
58
+ attr_reader :origin, :destination, :package_rates,
59
+ :carrier, :service_name, :service_code,
60
+ :shipping_date, :delivery_date, :delivery_range,
61
+ :currency, :negotiated_rate, :insurance_price
16
62
 
17
63
  def initialize(origin, destination, carrier, service_name, options = {})
18
64
  @origin, @destination, @carrier, @service_name = origin, destination, carrier, service_name
@@ -31,13 +77,20 @@ module ActiveShipping #:nodoc:
31
77
  @insurance_price = Package.cents_from(options[:insurance_price])
32
78
  end
33
79
 
80
+ # The total price of the shipments in cents.
81
+ # @return [Integer]
34
82
  def total_price
35
- @total_price || @package_rates.sum { |p| p[:rate] }
83
+ @total_price || @package_rates.sum { |pr| pr[:rate] }
36
84
  rescue NoMethodError
37
85
  raise ArgumentError.new("RateEstimate must have a total_price set, or have a full set of valid package rates.")
38
86
  end
39
87
  alias_method :price, :total_price
40
88
 
89
+ # Adds a package to this rate estimate
90
+ # @param package [ActiveShipping::Package] The package to add.
91
+ # @param rate [#cents, Float, String, nil] The rate for this package. This is only required if
92
+ # there is no total price for this shipment
93
+ # @return [self]
41
94
  def add(package, rate = nil)
42
95
  cents = Package.cents_from(rate)
43
96
  raise ArgumentError.new("New packages must have valid rate information since this RateEstimate has no total_price set.") if cents.nil? and total_price.nil?
@@ -45,16 +98,24 @@ module ActiveShipping #:nodoc:
45
98
  self
46
99
  end
47
100
 
101
+ # The list of packages for which rate estimates are given.
102
+ # @return [Array<ActiveShipping::Package>]
48
103
  def packages
49
104
  package_rates.map { |p| p[:package] }
50
105
  end
51
106
 
107
+ # The number of packages for which rate estimates are given.
108
+ # @return [Integer]
52
109
  def package_count
53
110
  package_rates.length
54
111
  end
55
112
 
56
113
  private
57
114
 
115
+ # Returns a Date object for a given input
116
+ # @param [String, Date, Time, DateTime, ...] The object to infer a date from.
117
+ # @return [Date, nil] The Date object absed on the input, or `nil` if no date
118
+ # could be determined.
58
119
  def date_for(date)
59
120
  date && DateTime.strptime(date.to_s, "%Y-%m-%d")
60
121
  rescue ArgumentError
@@ -1,7 +1,27 @@
1
1
  module ActiveShipping
2
+
3
+ # The `RateResponse` object is returned by the {ActiveShipping::Carrier#find_rates}
4
+ # call. The most important method is {#rates}, which will return a list of possible
5
+ # shipping options with ane stiated price.
6
+ #
7
+ # @note Some carriers provide more information that others, so not all attributes
8
+ # will be set, depending on what carrier you are using.
9
+ #
10
+ # @!attribute rates
11
+ # The available rate options for the shipment, with an estimated price.
12
+ # @return [Array<ActiveShipping::RateEstimate>]
2
13
  class RateResponse < Response
14
+
3
15
  attr_reader :rates
4
16
 
17
+ # Initializes a new RateResponse instance.
18
+ #
19
+ # @param success (see ActiveShipping::Response#initialize)
20
+ # @param message (see ActiveShipping::Response#initialize)
21
+ # @param params (see ActiveShipping::Response#initialize)
22
+ # @option options (see ActiveShipping::Response#initialize)
23
+ # @option options [Array<ActiveShipping::RateEstimate>] :rates The rate estimates to
24
+ # populate the {#rates} method with.
5
25
  def initialize(success, message, params = {}, options = {})
6
26
  @rates = Array(options[:estimates] || options[:rates] || options[:rate_estimates])
7
27
  super
@@ -15,6 +15,7 @@ module ActiveShipping #:nodoc:
15
15
  end
16
16
  end
17
17
 
18
+ # Basic Response class for requests against a carrier's API.
18
19
  class Response
19
20
  attr_reader :params
20
21
  attr_reader :message
@@ -22,6 +23,16 @@ module ActiveShipping #:nodoc:
22
23
  attr_reader :xml
23
24
  attr_reader :request
24
25
 
26
+ # @param success [Boolean] Whether the request was considered successful, i.e. this
27
+ # response object will have the expected data set.
28
+ # @param message [String] A status message. Usuaully set when `success` is `false`,
29
+ # but can also be set for successful responses.
30
+ # @param params [Hash] Response parameters
31
+ # @param options [Hash]
32
+ # @option options [Boolean] :test (default: false) Whether this reponse was a result
33
+ # of a request executed against the sandbox or test environment of the carrier's API.
34
+ # @option options [String] :xml The raw XML of the response.
35
+ # @option options [String] :request The payload of the request.
25
36
  def initialize(success, message, params = {}, options = {})
26
37
  @success, @message, @params = success, message, params.stringify_keys
27
38
  @test = options[:test] || false
@@ -30,10 +41,16 @@ module ActiveShipping #:nodoc:
30
41
  raise ResponseError.new(self) unless success
31
42
  end
32
43
 
44
+ # Whether the request was executed successfully or not.
45
+ # @return [Boolean] Should only return `true` if the attributes of teh response
46
+ # instance are set with useful values.
33
47
  def success?
34
48
  @success ? true : false
35
49
  end
36
50
 
51
+ # Whether this request was executed against the sandbox or test environment instead of
52
+ # the production environment of the carrier.
53
+ # @return [Boolean]
37
54
  def test?
38
55
  @test ? true : false
39
56
  end
@@ -7,8 +7,8 @@ module ActiveShipping
7
7
  class ExcessPackageQuantity < StandardError; end
8
8
 
9
9
  # items - array of hashes containing quantity, grams and price.
10
- # ex. [{:quantity => 2, :price => 1.0, :grams => 50}]
11
- # dimensions - [5.0, 15.0, 30.0]
10
+ # ex. `[{:quantity => 2, :price => 1.0, :grams => 50}]`
11
+ # dimensions - `[5.0, 15.0, 30.0]`
12
12
  # maximum_weight - maximum weight in grams
13
13
  # currency - ISO currency code
14
14
  def self.pack(items, dimensions, maximum_weight, currency)
@@ -1,8 +1,30 @@
1
1
  module ActiveShipping
2
+
3
+ # Responce object class for calls to {ActiveShipping::Carrier#create_shipment}.
4
+ #
5
+ # @note Some carriers provide more information that others, so not all attributes
6
+ # will be set, depending on what carrier you are using.
7
+ #
8
+ # @!attribute shipping_id
9
+ # The unique identifier of the shipment, which can be used to further interact
10
+ # with the carrier's API.
11
+ # @return [String]
12
+ #
13
+ # @!attribute tracking_number
14
+ # The tracking number of the shipments, witch can be shared with the customer and
15
+ # be used for {ActiveShipping::Carrier#find_tracking_info}.
16
+ # @return [String]
2
17
  class ShippingResponse < Response
3
- attr_reader :shipping_id # string
4
- attr_reader :tracking_number # string
18
+ attr_reader :shipping_id, :tracking_number
5
19
 
20
+ # Initializes a new ShippingResponse instance.
21
+ #
22
+ # @param success (see ActiveShipping::Response#initialize)
23
+ # @param message (see ActiveShipping::Response#initialize)
24
+ # @param params (see ActiveShipping::Response#initialize)
25
+ # @option options (see ActiveShipping::Response#initialize)
26
+ # @option options [String] :shipping_id Populates {#shipping_id}.
27
+ # @option options [String] :tracking_number Populates {#tracking_number}.
6
28
  def initialize(success, message, params = {}, options = {})
7
29
  @shipping_id = options[:shipping_id]
8
30
  @tracking_number = options[:tracking_number]
@@ -1,18 +1,59 @@
1
1
  module ActiveShipping
2
+
3
+ # Represents the response to a {ActiveShipping::Carrier#find_tracking_info} call.
4
+ #
5
+ # @note Some carriers provide more information that others, so not all attributes
6
+ # will be set, depending on what carrier you are using.
7
+ #
8
+ # @!attribute carrier
9
+ # @return [Symbol]
10
+ #
11
+ # @!attribute carrier_name
12
+ # @return [String]
13
+ #
14
+ # @!attribute status
15
+ # @return [Symbol]
16
+ #
17
+ # @!attribute status_code
18
+ # @return [string]
19
+ #
20
+ # @!attribute status_description
21
+ # @return [String]
22
+ #
23
+ # @!attribute ship_time
24
+ # @return [Date, Time]
25
+ #
26
+ # @!attribute scheduled_delivery_date
27
+ # @return [Date, Time]
28
+ #
29
+ # @!attribute actual_delivery_date
30
+ # @return [Date, Time]
31
+ #
32
+ # @!attribute delivery_signature
33
+ # @return [String]
34
+ #
35
+ # @!attribute tracking_number
36
+ # @return [String]
37
+ #
38
+ # @!attribute shipment_events
39
+ # @return [Array<ActiveShipping::ShipmentEvent>]
40
+ #
41
+ # @!attribute shipper_address
42
+ # @return [ActiveShipping::Location]
43
+ #
44
+ # @!attribute origin
45
+ # @return [ActiveShipping::Location]
46
+ #
47
+ # @!attribute destination
48
+ # @return [ActiveShipping::Location]
2
49
  class TrackingResponse < Response
3
- attr_reader :carrier # symbol
4
- attr_reader :carrier_name # string
5
- attr_reader :status # symbol
6
- attr_reader :status_code # string
7
- attr_reader :status_description # string
8
- attr_reader :ship_time # time
9
- attr_reader :scheduled_delivery_date # time
10
- attr_reader :actual_delivery_date # time
11
- attr_reader :delivery_signature # string
12
- attr_reader :tracking_number # string
13
- attr_reader :shipment_events # array of ShipmentEvents in chronological order
14
- attr_reader :shipper_address, :origin, :destination # Location objects
50
+ attr_reader :carrier,:carrier_name,
51
+ :status,:status_code, :status_description,
52
+ :ship_time, :scheduled_delivery_date, :actual_delivery_date,
53
+ :delivery_signature, :tracking_number, :shipment_events,
54
+ :shipper_address, :origin, :destination
15
55
 
56
+ # @params (see ActiveShipping::Response#initialize)
16
57
  def initialize(success, message, params = {}, options = {})
17
58
  @carrier = options[:carrier].parameterize.to_sym
18
59
  @carrier_name = options[:carrier]
@@ -31,22 +72,29 @@ module ActiveShipping
31
72
  super
32
73
  end
33
74
 
75
+ # The latest tracking event for this shipment, i.e. the current status.
76
+ # @return [ActiveShipping::ShipmentEvent]
34
77
  def latest_event
35
78
  @shipment_events.last
36
79
  end
37
80
 
81
+ # Returns `true` if something the shipment has arrived at the destination.
82
+ # @return [Boolean]
38
83
  def is_delivered?
39
84
  @status == :delivered
40
85
  end
41
86
 
87
+ # Returns `true` if something out of the ordinary has happened during
88
+ # the delivery of this package.
89
+ # @return [Boolean]
42
90
  def has_exception?
43
91
  @status == :exception
44
92
  end
45
93
 
46
- alias_method(:exception_event, :latest_event)
47
- alias_method(:delivered?, :is_delivered?)
48
- alias_method(:exception?, :has_exception?)
49
- alias_method(:scheduled_delivery_time, :scheduled_delivery_date)
50
- alias_method(:actual_delivery_time, :actual_delivery_date)
94
+ alias_method :exception_event, :latest_event
95
+ alias_method :delivered?, :is_delivered?
96
+ alias_method :exception?, :has_exception?
97
+ alias_method :scheduled_delivery_time, :scheduled_delivery_date
98
+ alias_method :actual_delivery_time, :actual_delivery_date
51
99
  end
52
100
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveShipping
2
- VERSION = "1.0.0.pre2"
2
+ VERSION = "1.0.0.pre3"
3
3
  end
@@ -0,0 +1 @@
1
+ # using the default shipit config
@@ -0,0 +1,47 @@
1
+ usps:
2
+ login: APIKey
3
+ ups:
4
+ key: XmlAccessKey
5
+ login: UPSDotComLogin
6
+ password: UPSDotComPassword
7
+
8
+ fedex:
9
+ account: FedExAccountNumber
10
+ login: FedExMeterNumber
11
+ password: FedExMeterPassword
12
+ test: true
13
+ key: FedExDeveloperKey
14
+
15
+ fedex_freight:
16
+ account: FedExFreightAccountNumber
17
+ shipping_address1: FedExShippingAddress1
18
+ shipping_address2: FedExShippingAddress2
19
+ shipping_city: FedExShippingCity
20
+ shipping_postal_code: FedExShippingPostalCode
21
+ shipping_state: FedExShippingState
22
+ shipping_country: FedExShippingCountry
23
+ billing_address1: FedExBillingAddress1
24
+ billing_address2: FedExBillingAddress2
25
+ billing_city: FedExBillingCity
26
+ billing_postal_code: FedExBillingPostalCode
27
+ billing_state: FedExBillingState
28
+ billing_country: FedExBillingCountry
29
+ payment_type: SENDER
30
+ freight_class: CLASS_050
31
+ packaging: PALLET
32
+ role: SHIPPER
33
+
34
+ shipwire:
35
+ login: EmailAddress
36
+ password: Password
37
+
38
+ canada_post:
39
+ login: CPC_DEMO_XML
40
+
41
+ new_zealand_post:
42
+ key: '4d9dc0f0-dda0-012e-066f-000c29b44ac0'
43
+
44
+ canada_post_pws:
45
+ platform_id: 12345678
46
+ api_key: 1234789
47
+ secret: 1245743
Binary file
@@ -0,0 +1 @@
1
+ {"courier_defaulting_to_nationwide":false,"post_defaulting_to_nationwide":false,"post_large_delivery_type":"within_island","info":{"lat_long_src":"-41.2829189300537,174.7841796875","dimensions":"Weight 0.25kg; Volumetric Weight 0.1064kg; 190.0x140.0x20.0","resolved_postcode_dest":"1010","resolved_postcode_src":"6011","resolved_dest_txt":"1010","lat_long_dest":"-36.8051338195801,174.981109619141","resolved_source_txt":"6011"},"products":[{"size":"C5","cost":"3.00","code":"PKTC5","image_url":null,"product_url":null,"delivery_rank":1.5,"tracked":false,"service":"parcel_post","weight":1.5,"product_max_dimensions":"165*235*70 1500gms","priority":"parcel_post","signature":false,"carrier":"nzpost","label_url":"https://www.nzpost.co.nz/cart/checkout?code=5-c5-PKTC5","service_code":"PKPC5","height":165,"service_group_description":"ParcelPost","packaging":"postage_only","speed_description":"1 - 3 working days","length":235,"description":"C5 Postage Only","width":70},{"size":"C5","cost":"3.60","code":"PKTC5,PKTEF","image_url":null,"product_url":null,"delivery_rank":1,"tracked":false,"service":"parcel_post_fast","weight":1.5,"product_max_dimensions":"165*235*70 1500gms","priority":"parcel_post_fast","signature":false,"carrier":"nzpost","label_url":"https://www.nzpost.co.nz/cart/checkout?code=6-c5-PKTC5,PKTEF","service_code":"PKFC5","height":165,"service_group_description":"ParcelPost Fast","packaging":"postage_only","speed_description":"Next working day","length":235,"description":"C5 Postage Only","width":70},{"size":"C5","cost":"4.00","code":"PIKFC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2086/pikfc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/13-c5-PIKFC5","delivery_rank":1.5,"tracked":false,"service":"parcel_post","weight":1.5,"product_max_dimensions":"185*270* 1500gms","priority":"parcel_post","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost","packaging":"flat","speed_description":"1 - 3 working days","length":270,"description":"C5 Flat Bag","width":null},{"size":"C5","cost":"4.20","code":"PCB3C5","image_url":null,"product_url":null,"delivery_rank":1.5,"tracked":true,"service":"parcel_post_tracked","weight":3.0,"product_max_dimensions":"165*235*70 3000gms","priority":"parcel_post_tracked","signature":false,"carrier":"nzpost","label_url":"https://www.nzpost.co.nz/cart/checkout?code=21-c5-PCB3C5","service_code":"PCM3C5","height":165,"service_group_description":"ParcelPost Tracked","packaging":"postage_only","speed_description":"1 - 3 working days","length":235,"description":"C5 Postage Only - Tracked","width":70},{"size":"C5","cost":"4.50","code":"PIFFC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2090/piffc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/15-c5-PIFFC5","delivery_rank":1,"tracked":false,"service":"parcel_post_fast","weight":1.5,"product_max_dimensions":"185*270* 1500gms","priority":"parcel_post_fast","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost Fast","packaging":"flat","speed_description":"Next working day","length":270,"description":"C5 Flat Bag","width":null},{"size":"C5","cost":"4.50","code":"PIKBC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2088/pikbc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/14-c5-PIKBC5","delivery_rank":1.5,"tracked":false,"service":"parcel_post","weight":1.5,"product_max_dimensions":"185*270* 1500gms","priority":"parcel_post","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost","packaging":"bubble","speed_description":"1 - 3 working days","length":270,"description":"C5 Bubble Bag","width":null},{"size":"C5","cost":"5.00","code":"PICFC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2095/picfc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/26-c5-PICFC5","delivery_rank":1.5,"tracked":true,"service":"parcel_post_tracked","weight":3.0,"product_max_dimensions":"185*270* 3000gms","priority":"parcel_post_tracked","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost Tracked","packaging":"flat","speed_description":"1 - 3 working days","length":270,"description":"C5 Flat Bag - Tracked","width":null},{"size":"C5","cost":"5.00","code":"PIFBC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2092/pifbc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/16-c5-PIFBC5","delivery_rank":1,"tracked":false,"service":"parcel_post_fast","weight":1.5,"product_max_dimensions":"185*270* 1500gms","priority":"parcel_post_fast","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost Fast","packaging":"bubble","speed_description":"Next working day","length":270,"description":"C5 Bubble Bag","width":null},{"size":"C5","cost":"5.50","code":"PICBC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2099/picbc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/27-c5-PICBC5","delivery_rank":1.5,"tracked":true,"service":"parcel_post_tracked","weight":3.0,"product_max_dimensions":"185*270* 3000gms","priority":"parcel_post_tracked","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost Tracked","packaging":"bubble","speed_description":"1 - 3 working days","length":270,"description":"C5 Bubble Bag - Tracked","width":null},{"size":"C5","cost":"6.55","code":"NZPROA5","image_url":null,"product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/44-c5-NZPROA5","delivery_rank":1,"tracked":true,"service":"courier","weight":3.0,"product_max_dimensions":"185*280* 3000gms","priority":"courier","signature":false,"carrier":"courierpost","label_url":null,"service_code":null,"height":185,"service_group_description":"Courier","packaging":"flat","speed_description":"Next working day","length":280,"description":"C5 Ready To Go Courier Flat Bag","width":null},{"size":"C5","cost":"7.15","code":"NZPRBA5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2040/nzprba5.jpg","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/46-c5-NZPRBA5","delivery_rank":1,"tracked":true,"service":"courier","weight":3.0,"product_max_dimensions":"185*280* 3000gms","priority":"courier","signature":false,"carrier":"courierpost","label_url":null,"service_code":null,"height":185,"service_group_description":"Courier","packaging":"bubble","speed_description":"Next working day","length":280,"description":"C5 Ready To Go Courier Bubble Bag","width":null},{"size":"C5","cost":"8.80","code":"NZSROA5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2039/nzproa5.jpg","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/45-c5-NZSROA5","delivery_rank":1,"tracked":true,"service":"courier","weight":3.0,"product_max_dimensions":"185*280* 3000gms","priority":"courier","signature":true,"carrier":"courierpost","label_url":null,"service_code":null,"height":185,"service_group_description":"Courier","packaging":"flat","speed_description":"Next working day","length":280,"description":"C5 Ready To Go Courier Flat Bag S/R","width":null},{"size":"C5","cost":"8.90","code":"NZSRBA5","image_url":null,"product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/47-c5-NZSRBA5","delivery_rank":1,"tracked":true,"service":"courier","weight":3.0,"product_max_dimensions":"185*280* 3000gms","priority":"courier","signature":true,"carrier":"courierpost","label_url":null,"service_code":null,"height":185,"service_group_description":"Courier","packaging":"bubble","speed_description":"Next working day","length":280,"description":"C5 Ready To Go Courier Bubble Bag S/R","width":null}],"courier_large_delivery_type":null,"status":"success"}
@@ -0,0 +1 @@
1
+ {"courier_defaulting_to_nationwide":false,"post_defaulting_to_nationwide":false,"post_large_delivery_type":"within_island","info":{"lat_long_src":"-41.2829189300537,174.7841796875","dimensions":"Weight 0.0kg; Volumetric Weight 0.0kg; 0.0x0.0x0.0","resolved_postcode_dest":"1010","resolved_postcode_src":"6011","resolved_dest_txt":"1010","lat_long_dest":"-36.8051338195801,174.981109619141","resolved_source_txt":"6011"},"products":[{"size":"DLE","cost":"2.40","code":"PKTDLE","image_url":null,"product_url":null,"delivery_rank":1.5,"tracked":false,"service":"parcel_post","weight":1.5,"product_max_dimensions":"130*235*70 1500gms","priority":"parcel_post","signature":false,"carrier":"nzpost","label_url":"https://www.nzpost.co.nz/cart/checkout?code=1-dle-PKTDLE","service_code":"PKPDLE","height":130,"service_group_description":"ParcelPost","packaging":"postage_only","speed_description":"1 - 3 working days","length":235,"description":"DLE Postage Only","width":70},{"size":"DLE","cost":"3.00","code":"PKTDLE,PKTEF","image_url":null,"product_url":null,"delivery_rank":1,"tracked":false,"service":"parcel_post_fast","weight":1.5,"product_max_dimensions":"130*235*70 1500gms","priority":"parcel_post_fast","signature":false,"carrier":"nzpost","label_url":"https://www.nzpost.co.nz/cart/checkout?code=2-dle-PKTDLE,PKTEF","service_code":"PKFDLE","height":130,"service_group_description":"ParcelPost Fast","packaging":"postage_only","speed_description":"Next working day","length":235,"description":"DLE Postage Only","width":70},{"size":"C5","cost":"4.00","code":"PIKFC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2086/pikfc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/13-c5-PIKFC5","delivery_rank":1.5,"tracked":false,"service":"parcel_post","weight":1.5,"product_max_dimensions":"185*270* 1500gms","priority":"parcel_post","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost","packaging":"flat","speed_description":"1 - 3 working days","length":270,"description":"C5 Flat Bag","width":null},{"size":"C5","cost":"4.20","code":"PCB3C5","image_url":null,"product_url":null,"delivery_rank":1.5,"tracked":true,"service":"parcel_post_tracked","weight":3.0,"product_max_dimensions":"165*235*70 3000gms","priority":"parcel_post_tracked","signature":false,"carrier":"nzpost","label_url":"https://www.nzpost.co.nz/cart/checkout?code=21-c5-PCB3C5","service_code":"PCM3C5","height":165,"service_group_description":"ParcelPost Tracked","packaging":"postage_only","speed_description":"1 - 3 working days","length":235,"description":"C5 Postage Only - Tracked","width":70},{"size":"DLE","cost":"4.50","code":"PICFDLE","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2094/picfdle_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/25-dle-PICFDLE","delivery_rank":1.5,"tracked":true,"service":"parcel_post_tracked","weight":3.0,"product_max_dimensions":"125*230* 3000gms","priority":"parcel_post_tracked","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":125,"service_group_description":"ParcelPost Tracked","packaging":"flat","speed_description":"1 - 3 working days","length":230,"description":"DLE Flat Bag - Tracked","width":null},{"size":"C5","cost":"4.50","code":"PIFFC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2090/piffc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/15-c5-PIFFC5","delivery_rank":1,"tracked":false,"service":"parcel_post_fast","weight":1.5,"product_max_dimensions":"185*270* 1500gms","priority":"parcel_post_fast","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost Fast","packaging":"flat","speed_description":"Next working day","length":270,"description":"C5 Flat Bag","width":null},{"size":"C5","cost":"4.50","code":"PIKBC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2088/pikbc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/14-c5-PIKBC5","delivery_rank":1.5,"tracked":false,"service":"parcel_post","weight":1.5,"product_max_dimensions":"185*270* 1500gms","priority":"parcel_post","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost","packaging":"bubble","speed_description":"1 - 3 working days","length":270,"description":"C5 Bubble Bag","width":null},{"size":"C5","cost":"5.00","code":"PIFBC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2092/pifbc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/16-c5-PIFBC5","delivery_rank":1,"tracked":false,"service":"parcel_post_fast","weight":1.5,"product_max_dimensions":"185*270* 1500gms","priority":"parcel_post_fast","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost Fast","packaging":"bubble","speed_description":"Next working day","length":270,"description":"C5 Bubble Bag","width":null},{"size":"C5","cost":"5.50","code":"PICBC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2099/picbc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/27-c5-PICBC5","delivery_rank":1.5,"tracked":true,"service":"parcel_post_tracked","weight":3.0,"product_max_dimensions":"185*270* 3000gms","priority":"parcel_post_tracked","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost Tracked","packaging":"bubble","speed_description":"1 - 3 working days","length":270,"description":"C5 Bubble Bag - Tracked","width":null},{"size":"DLE","cost":"5.89","code":"NZPRODL","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2037/nzprodl.jpg","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/42-dle-NZPRODL","delivery_rank":1,"tracked":true,"service":"courier","weight":3.0,"product_max_dimensions":"130*240* 3000gms","priority":"courier","signature":false,"carrier":"courierpost","label_url":null,"service_code":null,"height":130,"service_group_description":"Courier","packaging":"flat","speed_description":"Next working day","length":240,"description":"DLE Ready To Go Courier Flat Bag","width":null},{"size":"C5","cost":"7.15","code":"NZPRBA5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2040/nzprba5.jpg","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/46-c5-NZPRBA5","delivery_rank":1,"tracked":true,"service":"courier","weight":3.0,"product_max_dimensions":"185*280* 3000gms","priority":"courier","signature":false,"carrier":"courierpost","label_url":null,"service_code":null,"height":185,"service_group_description":"Courier","packaging":"bubble","speed_description":"Next working day","length":280,"description":"C5 Ready To Go Courier Bubble Bag","width":null},{"size":"DLE","cost":"8.30","code":"NZSRODL","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2038/nzprodl.jpg","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/43-dle-NZSRODL","delivery_rank":1,"tracked":true,"service":"courier","weight":3.0,"product_max_dimensions":"130*240* 3000gms","priority":"courier","signature":true,"carrier":"courierpost","label_url":null,"service_code":null,"height":130,"service_group_description":"Courier","packaging":"flat","speed_description":"Next working day","length":240,"description":"DLE Ready To Go Courier Flat Bag S/R","width":null},{"size":"C5","cost":"8.90","code":"NZSRBA5","image_url":null,"product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/47-c5-NZSRBA5","delivery_rank":1,"tracked":true,"service":"courier","weight":3.0,"product_max_dimensions":"185*280* 3000gms","priority":"courier","signature":true,"carrier":"courierpost","label_url":null,"service_code":null,"height":185,"service_group_description":"Courier","packaging":"bubble","speed_description":"Next working day","length":280,"description":"C5 Ready To Go Courier Bubble Bag S/R","width":null}],"courier_large_delivery_type":null,"status":"success"}
@@ -0,0 +1 @@
1
+ {"errors":["Weight can only be between 0 and 25kg"],"message":"Weight can only be between 0 and 25kg","status":"failure"}
@@ -0,0 +1 @@
1
+ {"courier_defaulting_to_nationwide":false,"post_defaulting_to_nationwide":false,"post_large_delivery_type":"within_island","info":{"lat_long_src":"-41.2829189300537,174.7841796875","dimensions":"Weight 0.1kg; Volumetric Weight 0.0kg; 930.0x0.0x0.0","resolved_postcode_dest":"1010","resolved_postcode_src":"6011","resolved_dest_txt":"1010","lat_long_dest":"-36.8051338195801,174.981109619141","resolved_source_txt":"6011"},"products":[{"size":null,"cost":"7.50","code":"PCBWI","image_url":null,"product_url":null,"delivery_rank":1.5,"tracked":true,"service":"parcel_post_tracked_zonal","weight":25.0,"product_max_dimensions":"15000*15000*15000 25000gms","priority":"parcel_post_tracked_zonal","signature":false,"carrier":"nzpost","label_url":"https://www.nzpost.co.nz/cart/checkout?code=37--PCBWI","service_code":"PCMW5","height":15000,"service_group_description":"ParcelPost Tracked Zonal","packaging":"postage_only","speed_description":"1 - 2 working days","length":15000,"description":"Postage Only - Zonal - Within Island - Tracked","width":15000}],"courier_large_delivery_type":null,"status":"success"}
@@ -0,0 +1 @@
1
+ {"courier_defaulting_to_nationwide":false,"post_defaulting_to_nationwide":false,"post_large_delivery_type":"within_island","info":{"lat_long_src":"-41.2829189300537,174.7841796875","dimensions":"Weight 0.226796185kg; Volumetric Weight 0.0032774128kg; 25.4x25.4x25.4","resolved_postcode_dest":"1010","resolved_postcode_src":"6011","resolved_dest_txt":"1010","lat_long_dest":"-36.8051338195801,174.981109619141","resolved_source_txt":"6011"},"products":[{"size":"DLE","cost":"2.40","code":"PKTDLE","image_url":null,"product_url":null,"delivery_rank":1.5,"tracked":false,"service":"parcel_post","weight":1.5,"product_max_dimensions":"130*235*70 1500gms","priority":"parcel_post","signature":false,"carrier":"nzpost","label_url":"https://www.nzpost.co.nz/cart/checkout?code=1-dle-PKTDLE","service_code":"PKPDLE","height":130,"service_group_description":"ParcelPost","packaging":"postage_only","speed_description":"1 - 3 working days","length":235,"description":"DLE Postage Only","width":70},{"size":"DLE","cost":"3.00","code":"PKTDLE,PKTEF","image_url":null,"product_url":null,"delivery_rank":1,"tracked":false,"service":"parcel_post_fast","weight":1.5,"product_max_dimensions":"130*235*70 1500gms","priority":"parcel_post_fast","signature":false,"carrier":"nzpost","label_url":"https://www.nzpost.co.nz/cart/checkout?code=2-dle-PKTDLE,PKTEF","service_code":"PKFDLE","height":130,"service_group_description":"ParcelPost Fast","packaging":"postage_only","speed_description":"Next working day","length":235,"description":"DLE Postage Only","width":70},{"size":"C5","cost":"4.00","code":"PIKFC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2086/pikfc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/13-c5-PIKFC5","delivery_rank":1.5,"tracked":false,"service":"parcel_post","weight":1.5,"product_max_dimensions":"185*270* 1500gms","priority":"parcel_post","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost","packaging":"flat","speed_description":"1 - 3 working days","length":270,"description":"C5 Flat Bag","width":null},{"size":"C5","cost":"4.20","code":"PCB3C5","image_url":null,"product_url":null,"delivery_rank":1.5,"tracked":true,"service":"parcel_post_tracked","weight":3.0,"product_max_dimensions":"165*235*70 3000gms","priority":"parcel_post_tracked","signature":false,"carrier":"nzpost","label_url":"https://www.nzpost.co.nz/cart/checkout?code=21-c5-PCB3C5","service_code":"PCM3C5","height":165,"service_group_description":"ParcelPost Tracked","packaging":"postage_only","speed_description":"1 - 3 working days","length":235,"description":"C5 Postage Only - Tracked","width":70},{"size":"DLE","cost":"4.50","code":"PICFDLE","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2094/picfdle_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/25-dle-PICFDLE","delivery_rank":1.5,"tracked":true,"service":"parcel_post_tracked","weight":3.0,"product_max_dimensions":"125*230* 3000gms","priority":"parcel_post_tracked","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":125,"service_group_description":"ParcelPost Tracked","packaging":"flat","speed_description":"1 - 3 working days","length":230,"description":"DLE Flat Bag - Tracked","width":null},{"size":"C5","cost":"4.50","code":"PIFFC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2090/piffc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/15-c5-PIFFC5","delivery_rank":1,"tracked":false,"service":"parcel_post_fast","weight":1.5,"product_max_dimensions":"185*270* 1500gms","priority":"parcel_post_fast","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost Fast","packaging":"flat","speed_description":"Next working day","length":270,"description":"C5 Flat Bag","width":null},{"size":"C5","cost":"4.50","code":"PIKBC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2088/pikbc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/14-c5-PIKBC5","delivery_rank":1.5,"tracked":false,"service":"parcel_post","weight":1.5,"product_max_dimensions":"185*270* 1500gms","priority":"parcel_post","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost","packaging":"bubble","speed_description":"1 - 3 working days","length":270,"description":"C5 Bubble Bag","width":null},{"size":"C5","cost":"5.00","code":"PIFBC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2092/pifbc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/16-c5-PIFBC5","delivery_rank":1,"tracked":false,"service":"parcel_post_fast","weight":1.5,"product_max_dimensions":"185*270* 1500gms","priority":"parcel_post_fast","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost Fast","packaging":"bubble","speed_description":"Next working day","length":270,"description":"C5 Bubble Bag","width":null},{"size":"C5","cost":"5.50","code":"PICBC5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2099/picbc5_0.gif","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/27-c5-PICBC5","delivery_rank":1.5,"tracked":true,"service":"parcel_post_tracked","weight":3.0,"product_max_dimensions":"185*270* 3000gms","priority":"parcel_post_tracked","signature":false,"carrier":"nzpost","label_url":null,"service_code":null,"height":185,"service_group_description":"ParcelPost Tracked","packaging":"bubble","speed_description":"1 - 3 working days","length":270,"description":"C5 Bubble Bag - Tracked","width":null},{"size":"DLE","cost":"5.89","code":"NZPRODL","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2037/nzprodl.jpg","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/42-dle-NZPRODL","delivery_rank":1,"tracked":true,"service":"courier","weight":3.0,"product_max_dimensions":"130*240* 3000gms","priority":"courier","signature":false,"carrier":"courierpost","label_url":null,"service_code":null,"height":130,"service_group_description":"Courier","packaging":"flat","speed_description":"Next working day","length":240,"description":"DLE Ready To Go Courier Flat Bag","width":null},{"size":"C5","cost":"7.15","code":"NZPRBA5","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2040/nzprba5.jpg","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/46-c5-NZPRBA5","delivery_rank":1,"tracked":true,"service":"courier","weight":3.0,"product_max_dimensions":"185*280* 3000gms","priority":"courier","signature":false,"carrier":"courierpost","label_url":null,"service_code":null,"height":185,"service_group_description":"Courier","packaging":"bubble","speed_description":"Next working day","length":280,"description":"C5 Ready To Go Courier Bubble Bag","width":null},{"size":"DLE","cost":"8.30","code":"NZSRODL","image_url":"http://www.nzpost.co.nz/sites/default/files/imagecache/product_full/product/2038/nzprodl.jpg","product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/43-dle-NZSRODL","delivery_rank":1,"tracked":true,"service":"courier","weight":3.0,"product_max_dimensions":"130*240* 3000gms","priority":"courier","signature":true,"carrier":"courierpost","label_url":null,"service_code":null,"height":130,"service_group_description":"Courier","packaging":"flat","speed_description":"Next working day","length":240,"description":"DLE Ready To Go Courier Flat Bag S/R","width":null},{"size":"C5","cost":"8.90","code":"NZSRBA5","image_url":null,"product_url":"http://www.nzpost.co.nz/products-services/postage-packaging/47-c5-NZSRBA5","delivery_rank":1,"tracked":true,"service":"courier","weight":3.0,"product_max_dimensions":"185*280* 3000gms","priority":"courier","signature":true,"carrier":"courierpost","label_url":null,"service_code":null,"height":185,"service_group_description":"Courier","packaging":"bubble","speed_description":"Next working day","length":280,"description":"C5 Ready To Go Courier Bubble Bag S/R","width":null}],"courier_large_delivery_type":null,"status":"success"}
@@ -0,0 +1 @@
1
+ {"products":[{"group":"International Express Courier","price":"65.25","name":"Int Express Pcl Zone C 500gm","code":"ICPNC500","max_delivery_target":5,"signature_required":true,"min_delivery_target":1,"has_tracking":true},{"group":"International Economy Courier","price":"42.5","name":"Int Econ Cour Pcl Zn C 500gm","code":"IEZPC500","max_delivery_target":6,"signature_required":true,"min_delivery_target":2,"has_tracking":true},{"group":"International Air","price":"12.5","name":"Zone C AirPost Cust Pcl 500gm","code":"IACNC500","max_delivery_target":10,"signature_required":false,"min_delivery_target":3,"has_tracking":false},{"group":"International Economy","price":"11.25","name":"Zone C EconomyPost Pcl 500gm","code":"IECNC500","max_delivery_target":25,"signature_required":false,"min_delivery_target":10,"has_tracking":false}],"status":"success"}
@@ -0,0 +1 @@
1
+ {"products":[{"group":"International Express Courier","price":"130.73","name":"Int Express Pcl Zone C 3.5kg","code":"ICPNC35","max_delivery_target":5,"signature_required":true,"min_delivery_target":1,"has_tracking":true}],"status":"success"}
@@ -0,0 +1 @@
1
+ {"products":[{"group":"International Express Courier","price":"65.25","name":"Int Express Pcl Zone C 500gm","code":"ICPNC500","max_delivery_target":5,"signature_required":true,"min_delivery_target":1,"has_tracking":true},{"group":"International Economy Courier","price":"42.5","name":"Int Econ Cour Pcl Zn C 500gm","code":"IEZPC500","max_delivery_target":6,"signature_required":true,"min_delivery_target":2,"has_tracking":true},{"group":"International Air","price":"12.1","name":"Zone C AirPost Cust Pcl 500gm","code":"IACNC500","max_delivery_target":10,"signature_required":false,"min_delivery_target":3,"has_tracking":false},{"group":"International Economy","price":"10.89","name":"Zone C EconomyPost Pcl 500gm","code":"IECNC500","max_delivery_target":25,"signature_required":false,"min_delivery_target":10,"has_tracking":false}],"status":"success"}