polar_express 0.0.3.alpha → 0.0.4.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +13 -2
- data/lib/certs/cacert.pem +3895 -0
- data/lib/polar_express.rb +4 -1
- data/lib/polar_express/dhl.rb +92 -24
- data/lib/polar_express/gls.rb +87 -21
- data/lib/polar_express/hermes.rb +99 -0
- data/lib/polar_express/polar_express.rb +13 -0
- data/lib/polar_express/tracker.rb +1 -13
- data/lib/polar_express/version.rb +1 -1
- data/lib/use_ssl_certs.rb +13 -0
- data/spec/polar_express/dhl_spec.rb +25 -0
- data/spec/polar_express/gls_spec.rb +18 -0
- data/spec/polar_express/hermes_spec.rb +19 -0
- data/spec/polar_express/polar_express_spec.rb +0 -33
- data/spec/spec_helper.rb +1 -0
- metadata +14 -15
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe PolarExpress do
|
3
|
+
context 'DHL' do
|
4
|
+
before do
|
5
|
+
@tracker = PolarExpress.new('DHL', '777707971894')
|
6
|
+
end
|
7
|
+
it "recognizes it" do
|
8
|
+
@tracker.courier.should eq :DHL
|
9
|
+
end
|
10
|
+
it "tracks it" do
|
11
|
+
@tracker.track!.status.should eq :delivery_succeeded
|
12
|
+
end
|
13
|
+
it "records tracking statuses" do
|
14
|
+
statuses = @tracker.track!.statuses
|
15
|
+
statuses.length.should > 1
|
16
|
+
end
|
17
|
+
it "tracks date correctly" do
|
18
|
+
@tracker.track!.statuses.first[:date].should == DateTime.new(2013, 03, 15, 17, 45)
|
19
|
+
end
|
20
|
+
it "handles package refusals" do
|
21
|
+
statuses = @tracker.track!.statuses
|
22
|
+
statuses.find { |status| status[:status] == :return_shipment }.should_not be_nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe PolarExpress do
|
3
|
+
context 'GLS' do
|
4
|
+
before do
|
5
|
+
@tracker = PolarExpress.new('GLS', '291740105981')
|
6
|
+
end
|
7
|
+
it "recognizes it" do
|
8
|
+
@tracker.courier.should eq :GLS
|
9
|
+
end
|
10
|
+
it "tracks it" do
|
11
|
+
@tracker.track!.status.should eq :delivery_succeeded
|
12
|
+
end
|
13
|
+
it "records tracking statuses" do
|
14
|
+
statuses = @tracker.track!.statuses
|
15
|
+
statuses.length.should > 1
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe PolarExpress do
|
3
|
+
context 'Hermes' do
|
4
|
+
before do
|
5
|
+
@tracker = PolarExpress.new('Hermes', '15072117753379')
|
6
|
+
end
|
7
|
+
it "recognizes it" do
|
8
|
+
@tracker.courier.should eq :Hermes
|
9
|
+
end
|
10
|
+
it "tracks it" do
|
11
|
+
@tracker.track!.status.should eq :delivery_succeeded
|
12
|
+
end
|
13
|
+
it "records tracking statuses" do
|
14
|
+
statuses = @tracker.track!.statuses
|
15
|
+
statuses.length.should > 1
|
16
|
+
pp statuses
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -6,37 +6,4 @@ describe PolarExpress do
|
|
6
6
|
@tracker.should respond_to :shipping_number
|
7
7
|
end
|
8
8
|
end
|
9
|
-
context 'DHL' do
|
10
|
-
before do
|
11
|
-
@tracker = PolarExpress.new('DHL', '777707971894')
|
12
|
-
end
|
13
|
-
it "recognizes it" do
|
14
|
-
@tracker.courier.should eq :DHL
|
15
|
-
end
|
16
|
-
it "tracks it" do
|
17
|
-
@tracker.track!.status.should eq :delivered
|
18
|
-
end
|
19
|
-
it "records tracking statuses" do
|
20
|
-
statuses = @tracker.track!.statuses
|
21
|
-
statuses.length.should > 1
|
22
|
-
end
|
23
|
-
it "tracks date correctly" do
|
24
|
-
@tracker.track!.statuses.first[:date].should == DateTime.new(2013, 03, 15, 17, 45)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
context 'GLS' do
|
28
|
-
before do
|
29
|
-
@tracker = PolarExpress.new('GLS', '291740105981')
|
30
|
-
end
|
31
|
-
it "recognizes it" do
|
32
|
-
@tracker.courier.should eq :GLS
|
33
|
-
end
|
34
|
-
it "tracks it" do
|
35
|
-
@tracker.track!.status.should eq :delivered
|
36
|
-
end
|
37
|
-
it "records tracking statuses" do
|
38
|
-
statuses = @tracker.track!.statuses
|
39
|
-
statuses.length.should > 1
|
40
|
-
end
|
41
|
-
end
|
42
9
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polar_express
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease: 6
|
4
|
+
version: 0.0.4.alpha
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- José Tomás Albornoz
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-28 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: shoulda
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -88,41 +79,49 @@ files:
|
|
88
79
|
- LICENSE.txt
|
89
80
|
- README.md
|
90
81
|
- Rakefile
|
82
|
+
- lib/certs/cacert.pem
|
91
83
|
- lib/polar_express.rb
|
92
84
|
- lib/polar_express/dhl.rb
|
93
85
|
- lib/polar_express/gls.rb
|
86
|
+
- lib/polar_express/hermes.rb
|
94
87
|
- lib/polar_express/polar_express.rb
|
95
88
|
- lib/polar_express/shipping_info.rb
|
96
89
|
- lib/polar_express/tracker.rb
|
97
90
|
- lib/polar_express/version.rb
|
91
|
+
- lib/use_ssl_certs.rb
|
98
92
|
- polar_express.gemspec
|
93
|
+
- spec/polar_express/dhl_spec.rb
|
94
|
+
- spec/polar_express/gls_spec.rb
|
95
|
+
- spec/polar_express/hermes_spec.rb
|
99
96
|
- spec/polar_express/polar_express_spec.rb
|
100
97
|
- spec/spec_helper.rb
|
101
98
|
homepage: https://github.com/eljojo/polar_express
|
102
99
|
licenses:
|
103
100
|
- mit
|
101
|
+
metadata: {}
|
104
102
|
post_install_message:
|
105
103
|
rdoc_options: []
|
106
104
|
require_paths:
|
107
105
|
- lib
|
108
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
-
none: false
|
110
107
|
requirements:
|
111
108
|
- - '>='
|
112
109
|
- !ruby/object:Gem::Version
|
113
110
|
version: '0'
|
114
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
112
|
requirements:
|
117
113
|
- - '>'
|
118
114
|
- !ruby/object:Gem::Version
|
119
115
|
version: 1.3.1
|
120
116
|
requirements: []
|
121
117
|
rubyforge_project:
|
122
|
-
rubygems_version:
|
118
|
+
rubygems_version: 2.0.0
|
123
119
|
signing_key:
|
124
|
-
specification_version:
|
120
|
+
specification_version: 4
|
125
121
|
summary: An easy an fun way of tracking packages. info = PolarExpress.new('DHL', '123456789').track!
|
126
122
|
test_files:
|
123
|
+
- spec/polar_express/dhl_spec.rb
|
124
|
+
- spec/polar_express/gls_spec.rb
|
125
|
+
- spec/polar_express/hermes_spec.rb
|
127
126
|
- spec/polar_express/polar_express_spec.rb
|
128
127
|
- spec/spec_helper.rb
|