dhl-ecommerce 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12f6738dec21ae5d543e39f0d154700d20b220e2
4
- data.tar.gz: efecdd84e28810f04b78140d780a9f3c6a1ec66e
3
+ metadata.gz: 0c80ada9d43813b68d5933fcdae0a32cf8701238
4
+ data.tar.gz: e0b3836a3f237e216382cfbad3abe3a12146251f
5
5
  SHA512:
6
- metadata.gz: 2ea02bfac35a6ee87430125659b54ee36d4023527ccb07caa1e696dc580cbea670f4c833f1959475d14c42bee38891b6f15cd4e23bebdb21de3ff1b816fd052c
7
- data.tar.gz: 292afd200fb8af541427cad2f0f5e4799b71af5a3cc4b59ea3ec220e8bdd96e7d49986f62cbee35db6ea72b4635414cce4c1d2da56494a427d3aa08ce15d91f9
6
+ metadata.gz: 0fe6a0fa778d63f15cd814d3963490195b6c2e9c2cfba6fb4166e373193a1d3daa184e637fa9f1d6e4912fe0b503f48c7a86e5cdb237f13c298a7b5b583c19d8
7
+ data.tar.gz: c6393588707563f98c135a4c1a59bdf683cd330ef2e17bbaf9a5603b699b764e25cd5ff9d5b194b7cfccbdfc4a3fbe69e10762360c6516c82e3b6ad28e5f599c
@@ -2,7 +2,7 @@ module DHL
2
2
  module Ecommerce
3
3
  class Label < Base
4
4
  attr_accessor :customer_confirmation_number, :service_endorsement, :reference, :batch, :mail_type, :facility, :expected_ship_date, :weight, :consignee_address, :return_address, :service
5
- attr_reader :id, :location_id, :product_id, :events, :service_type, :file, :impb
5
+ attr_reader :id, :location_id, :product_id, :events, :service_type, :impb
6
6
 
7
7
  FACILITIES = {
8
8
  auburn: "USSEA1",
@@ -75,6 +75,10 @@ module DHL
75
75
  @product_id = product.id
76
76
  end
77
77
 
78
+ def file
79
+ @base64_decoded_file ||= StringIO.new(Base64.decode64(@file))
80
+ end
81
+
78
82
  def self.create(attributes)
79
83
  array = attributes.is_a? Array
80
84
  attributes = [attributes] unless array
@@ -142,7 +146,7 @@ module DHL
142
146
 
143
147
  xml.PackageRef do
144
148
  xml.PrintFlag customer_confirmation_number.present?
145
- # xml.LabelText ""
149
+ xml.LabelText customer_confirmation_number
146
150
  end
147
151
 
148
152
  xml.ConsigneeAddress do
@@ -232,9 +236,9 @@ module DHL
232
236
 
233
237
  case DHL::Ecommerce.label_format
234
238
  when :png, :image
235
- label.instance_variable_set :@file, StringIO.new(Base64.decode64(label_response[:label_image])) if label_response[:label_image]
239
+ label.instance_variable_set :@file, label_response[:label_image] if label_response[:label_image]
236
240
  when :zpl
237
- label.instance_variable_set :@file, StringIO.new(Base64.decode64(label_response[:label_zpl])) if label_response[:label_zpl]
241
+ label.instance_variable_set :@file, label_response[:label_zpl] if label_response[:label_zpl]
238
242
  end
239
243
 
240
244
  if label_response[:label_detail]
@@ -1,5 +1,5 @@
1
1
  module DHL
2
2
  module Ecommerce
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dhl-ecommerce
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francois Deschenes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-09 00:00:00.000000000 Z
11
+ date: 2016-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler