fex 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,3 +21,9 @@
21
21
  :major: 12
22
22
  :intermediate: 1
23
23
  :minor: 0
24
+ :track:
25
+ :version:
26
+ :service_id: trck
27
+ :major: 6
28
+ :intermediate: 0
29
+ :minor: 0
@@ -1,4 +1,5 @@
1
1
  require "base64"
2
+ require "bigdecimal"
2
3
 
3
4
  module Fex
4
5
  class ShipResponse < Response
@@ -7,5 +8,28 @@ module Fex
7
8
  @image ||= Base64.decode64(xpath("//Label/Parts/Image").inner_text)
8
9
  end
9
10
 
11
+ def label_barcode
12
+ @label_barcode ||= css("Barcodes StringBarcodes Value").inner_text
13
+ end
14
+
15
+ def total_net_charge
16
+ @total_net_charge ||= BigDecimal find_total_net_charge
17
+ end
18
+
19
+ def tracking_number
20
+ @tracking_number ||= css("TrackingNumber").inner_text
21
+ end
22
+
23
+ private
24
+
25
+ def find_total_net_charge
26
+ charge = css("TotalNetCharge Amount").first
27
+ if charge
28
+ charge.inner_text
29
+ else
30
+ '0.0'
31
+ end
32
+ end
33
+
10
34
  end
11
35
  end
@@ -1,3 +1,3 @@
1
1
  module Fex
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'base64'
3
2
 
4
3
  describe "Ship Service", :test_environment do
5
4
 
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Track Service", :test_environment do
4
+
5
+ example "Track" do
6
+
7
+ client = Fex.client(credentials: credentials, mode: mode, client: { logger: logger })
8
+
9
+ service = client.service(:track)
10
+
11
+ service.should have(4).operations
12
+
13
+ response = service.call(
14
+ :track,
15
+ package_identifier: {
16
+ value: "400030715008165",
17
+ type: "TRACKING_NUMBER_OR_DOORTAG"
18
+ },
19
+ include_detailed_scans: true
20
+ )
21
+ # We have no tracking number to test, so just verify that we get the right error.
22
+ response.severity.should eq "ERROR"
23
+ response.message.should start_with "No information for the following shipments has been received by our system yet."
24
+ end
25
+
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-08 00:00:00.000000000 Z
12
+ date: 2013-01-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
@@ -85,6 +85,7 @@ files:
85
85
  - spec/integration/address_validation_spec.rb
86
86
  - spec/integration/rate_spec.rb
87
87
  - spec/integration/ship_spec.rb
88
+ - spec/integration/track_spec.rb
88
89
  - spec/spec_helper.rb
89
90
  - spec/support/credentials.rb
90
91
  - spec/support/logger_helper.rb
@@ -129,6 +130,7 @@ test_files:
129
130
  - spec/integration/address_validation_spec.rb
130
131
  - spec/integration/rate_spec.rb
131
132
  - spec/integration/ship_spec.rb
133
+ - spec/integration/track_spec.rb
132
134
  - spec/spec_helper.rb
133
135
  - spec/support/credentials.rb
134
136
  - spec/support/logger_helper.rb