tracking_number 1.0.0.pre1 → 1.0.0

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
  SHA256:
3
- metadata.gz: 7732c76f5896712c793106dbc515f67107764228741950d6eff1a73c0daeef9c
4
- data.tar.gz: 62d14ce8cc6a9899f01963b28f0234872eba8b0a9b0d5334adb1a4d3d1c23ad0
3
+ metadata.gz: f64062b0c0a30dfe8beada5f78c1c8840ac308bf1a59e112e34bc86325707de4
4
+ data.tar.gz: 50af16410804ea689cbd5c9813154bd1e0350f631035831dcb13c0da0d2cc126
5
5
  SHA512:
6
- metadata.gz: cdfcbdbff995f2a51f4f2e3896d7abfcc49277ec4b6642a319f89dc8d4470f62903ddbf8fa0118b9c49709494976f88b5133a286362c08ec5421468b8fdfc4fb
7
- data.tar.gz: e9410104da284a7a8dd71bb64ea1102f1aae30b504c8d4c92817110b856f40e2e327bd788f651e83f8e3c263ee00916470c7c2f14d8afa6451189a1e23c54ba5
6
+ metadata.gz: a94d44cce76ed15441f819ccbd7d3843319925c1f878edef421a7d244b737fa2902761b551dd1c18eb1779c53b24ea58a989999b3a9b3afbfe32d9ad694626fc
7
+ data.tar.gz: 4635a17023d10c37f15dfbd93d5ffa4ad5468b1b9503913f33fd3bca81583c61abe7bee6671daae4a5da70ea35b802e00c32801f6f26e2c22977e71c29de6d3e
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ [![Build Status](https://travis-ci.org/jkeen/tracking_number.svg?branch=master)](https://travis-ci.org/jkeen/tracking_number)
2
+ [![Gem Version](https://badge.fury.io/rb/tracking_number.svg)](https://badge.fury.io/rb/tracking_number)
3
+ [![Gem](https://img.shields.io/gem/dt/tracking_number.svg)]()
1
4
  ## Tracking Number (v1.x)
2
5
 
3
6
  This gem identifies valid tracking numbers and can tell you a little bit about the shipment just from the number—there's quite a bit of info tucked away into those numbers, it turns out.
data/lib/tasks/stats.rake CHANGED
@@ -30,9 +30,9 @@ def has_additional_key_info?(tracking_numbers, key)
30
30
  if key == :service_type
31
31
  tracking_numbers.any? { |t| t.service_type }
32
32
  elsif key == :shipping_container_type
33
- tracking_numbers.any? { |t| t.package_info }
33
+ tracking_numbers.any? { |t| t.package_type }
34
34
  elsif key == :destination_zip
35
- tracking_numbers.any? { |t| t.destination }
35
+ tracking_numbers.any? { |t| t.destination_zip }
36
36
  end
37
37
  end
38
38
 
@@ -162,7 +162,7 @@ module TrackingNumber
162
162
 
163
163
  def package_type
164
164
  if matching_additional["ContainerType"]
165
- @package_type ||= Info.new(matching_additional["Container Type"]).package_info.name
165
+ @package_type ||= Info.new(matching_additional["Container Type"]).name
166
166
  end
167
167
  end
168
168
 
@@ -1,3 +1,3 @@
1
1
  module TrackingNumber
2
- VERSION = "1.0.0.pre1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -10,20 +10,18 @@ def load_courier_data(name = :all)
10
10
  end
11
11
  end
12
12
 
13
- class TrackingNumberDataTest < Minitest::Test
13
+ class TrackingNumberMetaTest < Minitest::Test
14
14
  load_courier_data(:all).each do |courier_info|
15
15
  courier_name = courier_info[:name]
16
-
17
16
  courier_code = courier_info[:courier_code].to_sym
18
17
 
19
18
  courier_info[:tracking_numbers].each do |tracking_info|
20
19
  klass_name = tracking_info[:name].gsub(/[^0-9A-Za-z]/, '')
21
20
  klass = "TrackingNumber::#{klass_name}".constantize
22
- context "[#{tracking_info[:name]}]" do
23
-
24
- single_valid_number = tracking_info[:test_numbers][:valid].first
25
21
 
22
+ describe "[#{tracking_info[:name]}]" do
26
23
  tracking_info[:test_numbers][:valid].each do |valid_number|
24
+
27
25
  should "validate #{valid_number} with #{klass_name}" do
28
26
  t = klass.new(valid_number)
29
27
  assert_equal courier_code, t.carrier
@@ -83,19 +81,12 @@ class TrackingNumberDataTest < Minitest::Test
83
81
  t = klass.new(valid_number)
84
82
  assert t.package_type.is_a?(String) || t.package_type.nil?
85
83
  end
86
- #
87
- # should "not throw an error when calling #info on #{valid_number}" do
88
- # t = klass.new(valid_number)
89
- # info = t.info
90
- # assert info.is_a?(String)
91
- # end
92
84
 
93
85
  should "not throw an error when calling #decode on #{valid_number}" do
94
86
  t = klass.new(valid_number)
95
87
  decode = t.decode
96
88
  assert decode.is_a?(Hash)
97
89
  end
98
-
99
90
  end
100
91
 
101
92
  tracking_info[:test_numbers][:invalid].each do |invalid_number|
@@ -127,12 +118,6 @@ class TrackingNumberDataTest < Minitest::Test
127
118
  assert t.package_type.is_a?(String) || t.package_type.nil?
128
119
  end
129
120
 
130
- # should "not throw an error when calling #info on invalid number #{invalid_number}" do
131
- # t = klass.new(invalid_number)
132
- # info = t.info
133
- # assert info.is_a?(String)
134
- # end
135
-
136
121
  should "not throw an error when calling #decode on invalid number #{invalid_number}" do
137
122
  t = klass.new(invalid_number)
138
123
  decode = t.decode
@@ -102,7 +102,7 @@ class TrackingNumberTest < Minitest::Test
102
102
  end
103
103
 
104
104
  should "report correct shipper_id" do
105
- assert_nil tracking_number.shipper_id
105
+ assert_equal "071790000", tracking_number.shipper_id
106
106
  end
107
107
 
108
108
  should "report correct no destination" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracking_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Keen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-31 00:00:00.000000000 Z
11
+ date: 2018-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -149,7 +149,7 @@ files:
149
149
  - lib/tracking_number/version.rb
150
150
  - test/active_model_validator_test.rb
151
151
  - test/test_helper.rb
152
- - test/tracking_number_data_test.rb
152
+ - test/tracking_number_meta_test.rb
153
153
  - test/tracking_number_test.rb
154
154
  - tracking_number.gemspec
155
155
  homepage: http://github.com/jkeen/tracking_number