after_ship 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/README.md +9 -3
- data/Rakefile +2 -0
- data/after_ship.gemspec +3 -3
- data/lib/after_ship.rb +6 -4
- data/lib/after_ship/core/attributes.rb +1 -1
- data/lib/after_ship/core/date_utils.rb +1 -1
- data/lib/after_ship/core/error_handler.rb +1 -1
- data/lib/after_ship/core/request.rb +1 -1
- data/lib/after_ship/core/version.rb +1 -1
- metadata +9 -11
- data/.rubocop-my.yml +0 -5
- data/.rubocop.yml +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abb9a01709d40bf788203fa337e52b7295fbbd66
|
4
|
+
data.tar.gz: bce86fa864aec1955c8eaa92e9535e93ec499210
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba57b69d91e5ab46201ca540b17d7549b9d24daf14470b133fc6d69a9f339fc116bf872cebd8da0b74467f3a45abeed9c4f1151c6ce968d342a87f7ed000a1a0
|
7
|
+
data.tar.gz: a4859c709bb258baab5afd2e312f65cf18b5c8168d684caea7aa11ebaf31f2fb939c1ffdd25f6de86b4e8ca0a8d8650f418c8f974f4b88ba3d54e4396250c3c4
|
data/.travis.yml
CHANGED
@@ -3,6 +3,7 @@ language: ruby
|
|
3
3
|
rvm:
|
4
4
|
- 2.2.2
|
5
5
|
- 2.1.6
|
6
|
+
- 2.0.0
|
6
7
|
- 1.9.3
|
7
8
|
- jruby-19mode
|
8
9
|
|
@@ -15,5 +16,6 @@ notifications:
|
|
15
16
|
on_success: change
|
16
17
|
on_failure: always
|
17
18
|
|
19
|
+
before_install: "gem install bundler -v 1.10.5"
|
18
20
|
install: "bundle --jobs 4"
|
19
21
|
script: "bundle exec rspec"
|
data/README.md
CHANGED
@@ -32,7 +32,7 @@ trackings.each do |tracking|
|
|
32
32
|
puts tracking.tracking_number
|
33
33
|
|
34
34
|
tracking.checkpoints.each do |checkpoint|
|
35
|
-
puts "#{
|
35
|
+
puts "#{checkpoint.city} #{checkpoint.checkpoint_time}"
|
36
36
|
end
|
37
37
|
end
|
38
38
|
```
|
@@ -55,7 +55,7 @@ tracking = client.tracking('tracking-number', 'ups')
|
|
55
55
|
puts tracking.tracking_number
|
56
56
|
|
57
57
|
tracking.checkpoints.each do |checkpoint|
|
58
|
-
puts "#{
|
58
|
+
puts "#{checkpoint.city} #{checkpoint.checkpoint_time}"
|
59
59
|
end
|
60
60
|
```
|
61
61
|
|
@@ -149,7 +149,7 @@ Returns a `AfterShip::Tracking` object or raises a `AfterShip::Error::NotFound`
|
|
149
149
|
couriers = client.couriers
|
150
150
|
|
151
151
|
couriers.each do |courier|
|
152
|
-
puts "#{
|
152
|
+
puts "#{courier.name} #{courier.other_name}"
|
153
153
|
end
|
154
154
|
```
|
155
155
|
|
@@ -220,6 +220,12 @@ Or install it yourself as:
|
|
220
220
|
|
221
221
|
$ gem install after_ship
|
222
222
|
|
223
|
+
## Development
|
224
|
+
|
225
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
226
|
+
|
227
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
228
|
+
|
223
229
|
## Contributing
|
224
230
|
|
225
231
|
0. E-mail me or create an issue.
|
data/Rakefile
CHANGED
data/after_ship.gemspec
CHANGED
@@ -20,15 +20,15 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
22
|
# System
|
23
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
24
24
|
|
25
25
|
# Test
|
26
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.3'
|
27
27
|
spec.add_development_dependency 'webmock', '~> 1.21'
|
28
28
|
spec.add_development_dependency 'simplecov', '~> 0.10'
|
29
29
|
|
30
30
|
# Code style, debugging, docs
|
31
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
31
|
+
spec.add_development_dependency 'rubocop', '~> 0.32'
|
32
32
|
spec.add_development_dependency 'pry', '~> 0.10'
|
33
33
|
spec.add_development_dependency 'yard', '~> 0.8'
|
34
34
|
spec.add_development_dependency 'rake', '~> 10.4'
|
data/lib/after_ship.rb
CHANGED
@@ -36,10 +36,10 @@ class AfterShip
|
|
36
36
|
DEFAULT_API_ADDRESS = 'https://api.aftership.com/v4'
|
37
37
|
|
38
38
|
# The trackings endpoint URL.
|
39
|
-
TRACKINGS_ENDPOINT = "#{
|
39
|
+
TRACKINGS_ENDPOINT = "#{DEFAULT_API_ADDRESS}/trackings"
|
40
40
|
|
41
41
|
# The activated couriers endpoint URL.
|
42
|
-
COURIERS_ENDPOINT = "#{
|
42
|
+
COURIERS_ENDPOINT = "#{DEFAULT_API_ADDRESS}/couriers"
|
43
43
|
|
44
44
|
# Common JSON loading/dumping options.
|
45
45
|
JSON_OPTIONS = {
|
@@ -170,7 +170,7 @@ class AfterShip
|
|
170
170
|
#
|
171
171
|
# @return [Hash]
|
172
172
|
def tracking(tracking_number, courier)
|
173
|
-
url = "#{
|
173
|
+
url = "#{TRACKINGS_ENDPOINT}/#{courier}/#{tracking_number}"
|
174
174
|
data = Request.get(url: url, api_key: api_key) do |response|
|
175
175
|
response.fetch(:data).fetch(:tracking)
|
176
176
|
end
|
@@ -193,6 +193,8 @@ class AfterShip
|
|
193
193
|
# @param options [Hash]
|
194
194
|
#
|
195
195
|
# @return [Hash]
|
196
|
+
#
|
197
|
+
# rubocop:disable Metrics/MethodLength
|
196
198
|
def create_tracking(tracking_number, courier, options = {})
|
197
199
|
body = {
|
198
200
|
tracking: {
|
@@ -225,7 +227,7 @@ class AfterShip
|
|
225
227
|
#
|
226
228
|
# @return [Hash]
|
227
229
|
def update_tracking(tracking_number, courier, options = {})
|
228
|
-
url = "#{
|
230
|
+
url = "#{TRACKINGS_ENDPOINT}/#{courier}/#{tracking_number}"
|
229
231
|
body = {
|
230
232
|
tracking: options
|
231
233
|
}
|
@@ -65,7 +65,7 @@ class AfterShip
|
|
65
65
|
when DATETIME_REGEX, DATETIME_WITH_ZONE_REGEX
|
66
66
|
DateTime.parse(value)
|
67
67
|
else
|
68
|
-
fail ArgumentError, "Invalid expected_delivery date #{
|
68
|
+
fail ArgumentError, "Invalid expected_delivery date #{value.inspect}"
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -39,7 +39,7 @@ class AfterShip
|
|
39
39
|
#
|
40
40
|
# @param response [Typhoeus::Response]
|
41
41
|
def precheck(response)
|
42
|
-
fail Error::Timeout, "#{
|
42
|
+
fail Error::Timeout, "#{response.effective_url} cannot be reached" if
|
43
43
|
response.timed_out?
|
44
44
|
end
|
45
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: after_ship
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oldrich Vetesnik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.10'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '3.
|
33
|
+
version: '3.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3.
|
40
|
+
version: '3.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: webmock
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.32'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.32'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,8 +159,6 @@ extra_rdoc_files: []
|
|
159
159
|
files:
|
160
160
|
- ".gitignore"
|
161
161
|
- ".rspec"
|
162
|
-
- ".rubocop-my.yml"
|
163
|
-
- ".rubocop.yml"
|
164
162
|
- ".travis.yml"
|
165
163
|
- ".yardopts"
|
166
164
|
- Gemfile
|
@@ -200,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
198
|
version: '0'
|
201
199
|
requirements: []
|
202
200
|
rubyforge_project:
|
203
|
-
rubygems_version: 2.4.
|
201
|
+
rubygems_version: 2.4.8
|
204
202
|
signing_key:
|
205
203
|
specification_version: 4
|
206
204
|
summary: A smallish library to talking to AfterShip via v4 API.
|
data/.rubocop-my.yml
DELETED
data/.rubocop.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
inherit_from: .rubocop-my.yml
|