friendly_shipping 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bb403d6836f79ac9aa2640acde019549c1bad34f811b83a89200fc42d2988d0
4
- data.tar.gz: cafc834f0f658fcbb642b05a63b0ae7a5199c4cb931a763d0fbe818e6120b507
3
+ metadata.gz: 752559509e8e61f905718631a73a9df4944367d3c3c24c292a49d8536eded1cd
4
+ data.tar.gz: 0ece2fb1fae5a77c20ddde481bc6995f143bdd02ead0cf1d82f718c649864010
5
5
  SHA512:
6
- metadata.gz: d57c7d63efe4b830468831b40dd0f983fd4c500da0a0a7bb27d75b0f789041fdf39f22ce737d4bbf9c5c8853fc0207133df1188b64a73e5389d6898dfc15add0
7
- data.tar.gz: d582a29e16a2d99bd397bb955ade4b0d220a93e749b0f0cbb96d645aa71c7ece47197b74fd5a65c2d2cd95988612b6f71c3599220aea4a97b3ae73606be4cb72
6
+ metadata.gz: c64b6cf5cc60a948b64cc30b889c88874f6aa5cd1d448f5e9168e8cf98771e3e25d8c710322c0b6752fa7932fac2eefe720d322eea6cd60ea74fe4b606136f4a
7
+ data.tar.gz: 18ee11e1c30eecb0a5e41ad81edda69081a7100bd40d05ce715dc2e8761f9961a12f21d54f63151b90cb6134fc6beb2d703256792caa3647a8396a5713902d02
data/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.5.2] - 2020-01-31
8
+
9
+ ### Added
10
+ - USPS Service: Added rectangular boolean to rate options class (#89)
11
+ - USPS Service: Added readable body to request class (#88)
12
+
13
+ ### Removed
14
+ - USPS Service: Drop deprecated rectangular container (#89)
15
+
7
16
  ## [0.5.1] - 2020-01-28
8
17
 
9
18
  ### Changed
@@ -6,13 +6,19 @@ module FriendlyShipping
6
6
 
7
7
  # @param [String] url The HTTP request URL
8
8
  # @param [String] body The HTTP request body
9
+ # # @param [String] readable_body Human-readable HTTP request body
9
10
  # @param [Hash] headers The HTTP request headers
10
11
  # @param [Boolean] debug Whether to debug the request
11
- def initialize(url:, body: nil, headers: {}, debug: false)
12
+ def initialize(url:, body: nil, readable_body: nil, headers: {}, debug: false)
12
13
  @url = url
13
14
  @body = body
15
+ @readable_body = readable_body
14
16
  @headers = headers
15
17
  @debug = debug
16
18
  end
19
+
20
+ def readable_body
21
+ @readable_body.presence || @body
22
+ end
17
23
  end
18
24
  end
@@ -74,6 +74,7 @@ module FriendlyShipping
74
74
  request = FriendlyShipping::Request.new(
75
75
  url: url,
76
76
  body: access_request_xml + rate_request_xml,
77
+ readable_body: rate_request_xml,
77
78
  debug: debug
78
79
  )
79
80
 
@@ -95,6 +96,7 @@ module FriendlyShipping
95
96
  request = FriendlyShipping::Request.new(
96
97
  url: time_in_transit_url,
97
98
  body: access_request_xml + time_in_transit_request_xml,
99
+ readable_body: time_in_transit_request_xml,
98
100
  debug: debug
99
101
  )
100
102
 
@@ -114,6 +116,7 @@ module FriendlyShipping
114
116
  ship_confirm_request = FriendlyShipping::Request.new(
115
117
  url: ship_confirm_url,
116
118
  body: access_request_xml + ship_confirm_request_xml,
119
+ readable_body: ship_confirm_request_xml,
117
120
  debug: debug
118
121
  )
119
122
 
@@ -132,6 +135,7 @@ module FriendlyShipping
132
135
  ship_accept_request = FriendlyShipping::Request.new(
133
136
  url: ship_accept_url,
134
137
  body: access_request_xml + ship_accept_request_xml,
138
+ readable_body: ship_accept_request_xml,
135
139
  debug: debug
136
140
  )
137
141
 
@@ -153,6 +157,7 @@ module FriendlyShipping
153
157
  request = FriendlyShipping::Request.new(
154
158
  url: url,
155
159
  body: access_request_xml + address_validation_request_xml,
160
+ readable_body: address_validation_request_xml,
156
161
  debug: debug
157
162
  )
158
163
 
@@ -170,6 +175,7 @@ module FriendlyShipping
170
175
  request = FriendlyShipping::Request.new(
171
176
  url: url,
172
177
  body: access_request_xml + address_validation_request_xml,
178
+ readable_body: address_validation_request_xml,
173
179
  debug: debug
174
180
  )
175
181
 
@@ -188,6 +194,7 @@ module FriendlyShipping
188
194
  request = FriendlyShipping::Request.new(
189
195
  url: url,
190
196
  body: access_request_xml + city_state_lookup_request_xml,
197
+ readable_body: city_state_lookup_request_xml,
191
198
  debug: debug
192
199
  )
193
200
 
@@ -202,6 +209,7 @@ module FriendlyShipping
202
209
  request = FriendlyShipping::Request.new(
203
210
  url: url,
204
211
  body: access_request_xml + void_request_xml,
212
+ readable_body: void_request_xml,
205
213
  debug: debug
206
214
  )
207
215
  client.post(request).bind do |response|
@@ -15,7 +15,8 @@ module FriendlyShipping
15
15
  :first_class_mail_type,
16
16
  :hold_for_pickup,
17
17
  :shipping_method,
18
- :transmit_dimensions
18
+ :transmit_dimensions,
19
+ :rectangular
19
20
 
20
21
  def initialize(
21
22
  box_name: :variable,
@@ -24,6 +25,7 @@ module FriendlyShipping
24
25
  hold_for_pickup: false,
25
26
  shipping_method: nil,
26
27
  transmit_dimensions: true,
28
+ rectangular: true,
27
29
  **kwargs
28
30
  )
29
31
  @box_name = CONTAINERS.key?(box_name) ? box_name : :variable
@@ -32,6 +34,7 @@ module FriendlyShipping
32
34
  @hold_for_pickup = hold_for_pickup
33
35
  @shipping_method = shipping_method
34
36
  @transmit_dimensions = transmit_dimensions
37
+ @rectangular = rectangular
35
38
  super kwargs
36
39
  end
37
40
 
@@ -10,8 +10,8 @@ module FriendlyShipping
10
10
 
11
11
  class << self
12
12
  # @param [Physical::Shipment] shipment The shipment we want to get rates for
13
- # shipment.packages[0].properties[:box_name] Can be :rectangular, :variable,
14
- # or a flat rate container defined in CONTAINERS.
13
+ # shipment.packages[0].properties[:box_name] Can be :variable or a
14
+ # flat rate container defined in CONTAINERS.
15
15
  # @param [String] login The USPS login code
16
16
  # @param [FriendlyShipping::Services::Usps::RateEstimateOptions] options The options
17
17
  # object to use with this request.
@@ -37,7 +37,13 @@ module FriendlyShipping
37
37
  xml.Width("%<width>0.2f" % { width: package.width.convert_to(:inches).value.to_f })
38
38
  xml.Length("%<length>0.2f" % { length: package.length.convert_to(:inches).value.to_f })
39
39
  xml.Height("%<height>0.2f" % { height: package.height.convert_to(:inches).value.to_f })
40
- xml.Girth("%<girth>0.2f" % { girth: girth(package) })
40
+
41
+ # When girth is present, the package is treated as non-rectangular
42
+ # when calculating dimensional weight. This results in a smaller
43
+ # dimensional weight than a rectangular package would have.
44
+ unless package_options.rectangular
45
+ xml.Girth("%<girth>0.2f" % { girth: girth(package) })
46
+ end
41
47
  end
42
48
  xml.Machinable(machinable(package))
43
49
  end
@@ -5,7 +5,6 @@ module FriendlyShipping
5
5
  class Usps
6
6
  CONTAINERS = {
7
7
  variable: 'VARIABLE',
8
- rectangular: 'RECTANGULAR',
9
8
  large_flat_rate_box: 'LG FLAT RATE BOX',
10
9
  medium_flat_rate_box: 'MD FLAT RATE BOX',
11
10
  small_flat_rate_box: 'SM FLAT RATE BOX',
@@ -18,7 +17,7 @@ module FriendlyShipping
18
17
  window_flat_rate_envelope: 'WINDOW FLAT RATE ENVELOPE',
19
18
  small_flat_rate_envelope: 'SM FLAT RATE ENVELOPE',
20
19
  cubic_soft_pack: 'CUBIC SOFT PACK',
21
- cubic_parcels: 'CUBIC_PARCELS'
20
+ cubic_parcels: 'CUBIC PARCELS'
22
21
  }.freeze
23
22
 
24
23
  FIRST_CLASS_MAIL_TYPES = {
@@ -112,6 +112,7 @@ module FriendlyShipping
112
112
  FriendlyShipping::Request.new(
113
113
  url: base_url,
114
114
  body: "API=#{RESOURCES[api]}&XML=#{CGI.escape xml}",
115
+ readable_body: xml,
115
116
  debug: debug
116
117
  )
117
118
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FriendlyShipping
4
- VERSION = "0.5.1"
4
+ VERSION = "0.5.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: friendly_shipping
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Meyerhoff
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-28 00:00:00.000000000 Z
11
+ date: 2020-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: data_uri
@@ -376,7 +376,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
376
376
  - !ruby/object:Gem::Version
377
377
  version: '0'
378
378
  requirements: []
379
- rubygems_version: 3.1.2
379
+ rubygems_version: 3.0.6
380
380
  signing_key:
381
381
  specification_version: 4
382
382
  summary: An integration layer for shipping services