active_shipping 1.6.2 → 1.6.3

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
  SHA1:
3
- metadata.gz: 838209b9accf6cfb537ac16786e8683d18155073
4
- data.tar.gz: 75036f0188503179ddb089ee25f99dc8b9fa4538
3
+ metadata.gz: b9a6c28f3db40c57a1e0867e54f2ef39eddbd137
4
+ data.tar.gz: 57b27cc5be5e949d436c1b0cd5dc40538de8612a
5
5
  SHA512:
6
- metadata.gz: 8d3e7c5b1b9cf6a46986c02725ebda6324724cd0d1c073f7fcded221314bf1ec6ebe360105f60c39e72f3612143d1749e0be36b648b135dc03eef97857098577
7
- data.tar.gz: fd34ef65e9404b1255c04a4e4867e6ad1fa3e0089ddbf1e73e4ff7b43209dae66f3f9e4e71d171d117fe2718c2cff406500fc9506dc3331d478af2668384eafb
6
+ metadata.gz: 28d093af4fc4bfbe762f7aeefff77201277f08eb25e07897d498b6f71d03ff40fa8d6bbcae0ea32f6fccc6c3c6bc925a86e14c1bf8b87026dd7705086022374d
7
+ data.tar.gz: eee9c390eabaccd2c95f4991fa761a0c90334e6fa5ad08416f82e9740e232a1637f614447afe534cb9bfc8555724ca57f26d86e8d79688cc1a07570e0e617ab2
@@ -481,15 +481,27 @@ module ActiveShipping
481
481
  end
482
482
  end
483
483
 
484
- # I don't know all of the options that UPS supports for labels
485
- # so I'm going with something very simple for now.
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('GIF')
496
+ xml.Code(label_format)
489
497
  end
490
- xml.HTTPUserAgent('Mozilla/4.5') # hmmm
491
- xml.LabelImageFormat('GIF') do
492
- xml.Code('GIF')
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
@@ -1,3 +1,3 @@
1
1
  module ActiveShipping
2
- VERSION = "1.6.2"
2
+ VERSION = "1.6.3"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_shipping
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James MacAulay