active_shipping 1.6.2 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_shipping/carriers/ups.rb +18 -6
- data/lib/active_shipping/version.rb +1 -1
- data/test/remote/ups_test.rb +28 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9a6c28f3db40c57a1e0867e54f2ef39eddbd137
|
4
|
+
data.tar.gz: 57b27cc5be5e949d436c1b0cd5dc40538de8612a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28d093af4fc4bfbe762f7aeefff77201277f08eb25e07897d498b6f71d03ff40fa8d6bbcae0ea32f6fccc6c3c6bc925a86e14c1bf8b87026dd7705086022374d
|
7
|
+
data.tar.gz: eee9c390eabaccd2c95f4991fa761a0c90334e6fa5ad08416f82e9740e232a1637f614447afe534cb9bfc8555724ca57f26d86e8d79688cc1a07570e0e617ab2
|
@@ -481,15 +481,27 @@ module ActiveShipping
|
|
481
481
|
end
|
482
482
|
end
|
483
483
|
|
484
|
-
#
|
485
|
-
#
|
484
|
+
# Supported label formats:
|
485
|
+
# GIF, EPL, ZPL, STARPL and SPL
|
486
|
+
label_format = options[:label_format] ? options[:label_format].upcase : 'GIF'
|
487
|
+
label_size = options[:label_size] ? options[:label_size] : [4, 6]
|
488
|
+
|
486
489
|
xml.LabelSpecification do
|
490
|
+
xml.LabelStockSize do
|
491
|
+
xml.Height(label_size[0])
|
492
|
+
xml.Width(label_size[1])
|
493
|
+
end
|
494
|
+
|
487
495
|
xml.LabelPrintMethod do
|
488
|
-
xml.Code(
|
496
|
+
xml.Code(label_format)
|
489
497
|
end
|
490
|
-
|
491
|
-
|
492
|
-
|
498
|
+
|
499
|
+
# API requires these only if returning a GIF formated label
|
500
|
+
if label_format == 'GIF'
|
501
|
+
xml.HTTPUserAgent('Mozilla/4.5')
|
502
|
+
xml.LabelImageFormat(label_format) do
|
503
|
+
xml.Code(label_format)
|
504
|
+
end
|
493
505
|
end
|
494
506
|
end
|
495
507
|
end
|
data/test/remote/ups_test.rb
CHANGED
@@ -398,4 +398,32 @@ class RemoteUPSTest < Minitest::Test
|
|
398
398
|
|
399
399
|
assert_instance_of ActiveShipping::LabelResponse, response
|
400
400
|
end
|
401
|
+
|
402
|
+
def test_obtain_shipping_label_zpl_format
|
403
|
+
response = @carrier.create_shipment(
|
404
|
+
location_fixtures[:beverly_hills],
|
405
|
+
location_fixtures[:new_york_with_name],
|
406
|
+
package_fixtures.values_at(:american_wii),
|
407
|
+
:label_format => "ZPL",
|
408
|
+
:test => true
|
409
|
+
)
|
410
|
+
|
411
|
+
assert response.success?
|
412
|
+
assert_instance_of ActiveShipping::LabelResponse, response
|
413
|
+
assert_equal "ZPL", response.params['ShipmentResults']['PackageResults']['LabelImage']['LabelImageFormat']['Code']
|
414
|
+
end
|
415
|
+
|
416
|
+
def test_obtain_shipping_label_defaults_to_gif_format
|
417
|
+
response = @carrier.create_shipment(
|
418
|
+
location_fixtures[:beverly_hills],
|
419
|
+
location_fixtures[:new_york_with_name],
|
420
|
+
package_fixtures.values_at(:american_wii),
|
421
|
+
:label_format => nil,
|
422
|
+
:test => true
|
423
|
+
)
|
424
|
+
|
425
|
+
assert response.success?
|
426
|
+
assert_instance_of ActiveShipping::LabelResponse, response
|
427
|
+
assert_equal "GIF", response.params['ShipmentResults']['PackageResults']['LabelImage']['LabelImageFormat']['Code']
|
428
|
+
end
|
401
429
|
end
|