after_ship 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +9 -21
- data/.rubocop-my.yml +4 -1
- data/.travis.yml +2 -1
- data/LICENSE.txt +17 -18
- data/README.md +1 -3
- data/Rakefile +0 -5
- data/after_ship.gemspec +13 -11
- data/bin/console +10 -0
- data/bin/setup +7 -0
- data/lib/after_ship.rb +2 -2
- data/lib/after_ship/core/date_utils.rb +2 -6
- data/lib/after_ship/core/error.rb +1 -0
- data/lib/after_ship/core/error_handler.rb +4 -4
- data/lib/after_ship/core/request.rb +18 -18
- data/lib/after_ship/core/version.rb +1 -1
- metadata +23 -49
- data/spec/integration/after_ship_spec.rb +0 -40
- data/spec/request_stubs.rb +0 -66
- data/spec/requests/couriers.json +0 -50
- data/spec/requests/tracking/created.json +0 -53
- data/spec/requests/tracking/delivered.json +0 -277
- data/spec/requests/trackings.json +0 -654
- data/spec/spec_helper.rb +0 -13
- data/spec/units/after_ship_spec.rb +0 -104
- data/spec/units/checkpoint_spec.rb +0 -135
- data/spec/units/courier_spec.rb +0 -41
- data/spec/units/date_utils_spec.rb +0 -67
- data/spec/units/error_handler_spec.rb +0 -168
- data/spec/units/request_spec.rb +0 -190
- data/spec/units/tracking_spec.rb +0 -276
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa67702f2a21706e2f70e90542a647a8cf7a054d
|
4
|
+
data.tar.gz: 4fd6cecc5ad8b10bd1feb4f05ffb88194a5a1f9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e44afcc71e645f9884f0b47aee50519c624134949f97b59888b842d6a52594092bcdd41e7a1484f5f44de8984c4e14b1b7c9c14ce3fed56debcb5452c1e03593
|
7
|
+
data.tar.gz: b8766e26c808f18d79cc358cf6cf21d357a1c99dd1bee6af02464592934740c66dc3201d1ca2dcd7af98f73be39294b85c677aec34afbcb7c74a985fa55caa25
|
data/.gitignore
CHANGED
@@ -1,22 +1,10 @@
|
|
1
1
|
*.gem
|
2
|
-
|
3
|
-
|
4
|
-
.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.bundle
|
19
|
-
*.so
|
20
|
-
*.o
|
21
|
-
*.a
|
22
|
-
mkmf.log
|
2
|
+
/.bundle/
|
3
|
+
/.yardoc
|
4
|
+
/Gemfile.lock
|
5
|
+
/_yardoc/
|
6
|
+
/coverage/
|
7
|
+
/doc/
|
8
|
+
/pkg/
|
9
|
+
/spec/reports/
|
10
|
+
/tmp/
|
data/.rubocop-my.yml
CHANGED
data/.travis.yml
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,22 +1,21 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
|
3
|
+
Copyright (c) 2014-2015 Oldrich Vetesnik
|
4
4
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
the following conditions:
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
12
11
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
15
14
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
OF
|
22
|
-
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
# AfterShip
|
2
|
-
|
3
|
-
[![Build Status](https://travis-ci.org/ollie/after_ship.svg?branch=master)](https://travis-ci.org/ollie/after_ship)
|
1
|
+
# AfterShip [![Build Status](https://img.shields.io/travis/ollie/after_ship/master.svg)](https://travis-ci.org/ollie/after_ship) [![Code Climate](https://img.shields.io/codeclimate/github/ollie/after_ship.svg)](https://codeclimate.com/github/ollie/after_ship) [![Gem Version](https://img.shields.io/gem/v/after_ship.svg)](https://rubygems.org/gems/after_ship)
|
4
2
|
|
5
3
|
A smallish library to talking to AfterShip via v4 API. It currently supports
|
6
4
|
those methods:
|
data/Rakefile
CHANGED
data/after_ship.gemspec
CHANGED
@@ -8,32 +8,34 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = AfterShip::VERSION
|
9
9
|
spec.authors = ['Oldrich Vetesnik']
|
10
10
|
spec.email = ['oldrich.vetesnik@gmail.com']
|
11
|
+
|
11
12
|
spec.summary = 'A smallish library to talking to AfterShip via v4 API.'
|
12
13
|
spec.homepage = 'https://github.com/ollie/after_ship'
|
13
14
|
spec.license = 'MIT'
|
14
15
|
|
15
|
-
|
16
|
-
spec.
|
17
|
-
spec.
|
16
|
+
# rubocop:disable Metrics/LineLength
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
20
|
spec.require_paths = ['lib']
|
19
21
|
|
20
22
|
# System
|
21
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
22
24
|
|
23
25
|
# Test
|
24
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
25
|
-
spec.add_development_dependency 'webmock', '~> 1.
|
26
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.2'
|
27
|
+
spec.add_development_dependency 'webmock', '~> 1.21'
|
28
|
+
spec.add_development_dependency 'simplecov', '~> 0.10'
|
27
29
|
|
28
30
|
# Code style, debugging, docs
|
29
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
31
|
+
spec.add_development_dependency 'rubocop', '~> 0.31'
|
30
32
|
spec.add_development_dependency 'pry', '~> 0.10'
|
31
33
|
spec.add_development_dependency 'yard', '~> 0.8'
|
32
|
-
spec.add_development_dependency 'rake', '~> 10.
|
34
|
+
spec.add_development_dependency 'rake', '~> 10.4'
|
33
35
|
|
34
36
|
# Networking
|
35
37
|
# Fast networking
|
36
|
-
spec.add_runtime_dependency 'typhoeus', '~> 0.
|
38
|
+
spec.add_runtime_dependency 'typhoeus', '~> 0.7'
|
37
39
|
# A common interface to multiple JSON libraries
|
38
|
-
spec.add_runtime_dependency 'multi_json', '~> 1.
|
40
|
+
spec.add_runtime_dependency 'multi_json', '~> 1.11'
|
39
41
|
end
|
data/bin/console
ADDED
data/bin/setup
ADDED
data/lib/after_ship.rb
CHANGED
@@ -75,8 +75,8 @@ class AfterShip
|
|
75
75
|
#
|
76
76
|
# client = AfterShip.new(api_key: 'your-aftership-api-key')
|
77
77
|
#
|
78
|
-
# @param
|
79
|
-
# @option options api_key [String]
|
78
|
+
# @param options [Hash]
|
79
|
+
# @option options :api_key [String]
|
80
80
|
def initialize(options)
|
81
81
|
@api_key = options.fetch(:api_key)
|
82
82
|
end
|
@@ -58,13 +58,9 @@ class AfterShip
|
|
58
58
|
#
|
59
59
|
def parse(value)
|
60
60
|
case value
|
61
|
-
when ''
|
61
|
+
when '', nil
|
62
62
|
nil
|
63
|
-
when
|
64
|
-
nil
|
65
|
-
when DATE_PLAIN_REGEX
|
66
|
-
Date.parse(value)
|
67
|
-
when DATE_REGEX
|
63
|
+
when DATE_PLAIN_REGEX, DATE_REGEX
|
68
64
|
Date.parse(value)
|
69
65
|
when DATETIME_REGEX, DATETIME_WITH_ZONE_REGEX
|
70
66
|
DateTime.parse(value)
|
@@ -46,10 +46,10 @@ class AfterShip
|
|
46
46
|
# Check the meta code of the response. If it isn't 200 or 201, raise an
|
47
47
|
# error.
|
48
48
|
#
|
49
|
-
# @param meta
|
50
|
-
# @option meta code [Fixnum]
|
51
|
-
# @option meta message [String, nil]
|
52
|
-
# @option meta type [String, nil]
|
49
|
+
# @param meta [Hash]
|
50
|
+
# @option meta :code [Fixnum]
|
51
|
+
# @option meta :message [String, nil]
|
52
|
+
# @option meta :type [String, nil]
|
53
53
|
def check(meta)
|
54
54
|
code = meta.fetch(:code)
|
55
55
|
|
@@ -8,10 +8,10 @@ class AfterShip
|
|
8
8
|
# request = Request.new(url: '...', api_key: '...', method: :get)
|
9
9
|
# response = request.response
|
10
10
|
#
|
11
|
-
# @param options
|
12
|
-
# @option options api_key [String] Your API key.
|
13
|
-
# @option options url [String] The full endpoint URL.
|
14
|
-
# @option options body [Hash, nil] Body for the request as a hash.
|
11
|
+
# @param options [Hash]
|
12
|
+
# @option options :api_key [String] Your API key.
|
13
|
+
# @option options :url [String] The full endpoint URL.
|
14
|
+
# @option options :body [Hash, nil] Body for the request as a hash.
|
15
15
|
#
|
16
16
|
# @return [Hash]
|
17
17
|
def self.get(options, &block)
|
@@ -24,10 +24,10 @@ class AfterShip
|
|
24
24
|
# request = Request.new(url: '...', api_key: '...', method: :post)
|
25
25
|
# response = request.response
|
26
26
|
#
|
27
|
-
# @param options
|
28
|
-
# @option options api_key [String] Your API key.
|
29
|
-
# @option options url [String] The full endpoint URL.
|
30
|
-
# @option options body [Hash, nil] Body for the request as a hash.
|
27
|
+
# @param options [Hash]
|
28
|
+
# @option options :api_key [String] Your API key.
|
29
|
+
# @option options :url [String] The full endpoint URL.
|
30
|
+
# @option options :body [Hash, nil] Body for the request as a hash.
|
31
31
|
#
|
32
32
|
# @return [Hash]
|
33
33
|
def self.post(options, &block)
|
@@ -40,10 +40,10 @@ class AfterShip
|
|
40
40
|
# request = Request.new(url: '...', api_key: '...', method: :put)
|
41
41
|
# response = request.response
|
42
42
|
#
|
43
|
-
# @param options
|
44
|
-
# @option options api_key [String] Your API key.
|
45
|
-
# @option options url [String] The full endpoint URL.
|
46
|
-
# @option options body [Hash, nil] Body for the request as a hash.
|
43
|
+
# @param options [Hash]
|
44
|
+
# @option options :api_key [String] Your API key.
|
45
|
+
# @option options :url [String] The full endpoint URL.
|
46
|
+
# @option options :body [Hash, nil] Body for the request as a hash.
|
47
47
|
#
|
48
48
|
# @return [Hash]
|
49
49
|
def self.put(options, &block)
|
@@ -53,12 +53,12 @@ class AfterShip
|
|
53
53
|
|
54
54
|
# Prepare the request to be run later.
|
55
55
|
#
|
56
|
-
# @param options
|
57
|
-
# @option options api_key [String] Your API key.
|
58
|
-
# @option options url [String] The full endpoint URL.
|
59
|
-
# @option options method [Symbol] The HTTP method.
|
60
|
-
# @option options body [Hash, nil] Body for the request as a hash.
|
61
|
-
# @param block
|
56
|
+
# @param options [Hash]
|
57
|
+
# @option options :api_key [String] Your API key.
|
58
|
+
# @option options :url [String] The full endpoint URL.
|
59
|
+
# @option options :method [Symbol] The HTTP method.
|
60
|
+
# @option options :body [Hash, nil] Body for the request as a hash.
|
61
|
+
# @param block [Proc] Response modifier callback.
|
62
62
|
def initialize(options = {}, &block)
|
63
63
|
@api_key = options.fetch(:api_key)
|
64
64
|
@url = options.fetch(:url)
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oldrich Vetesnik
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,70 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.7'
|
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.7'
|
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.2'
|
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.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: webmock
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.21'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.21'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.10'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.10'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.31'
|
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.31'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,42 +114,42 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '10.
|
117
|
+
version: '10.4'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '10.
|
124
|
+
version: '10.4'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: typhoeus
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0.
|
131
|
+
version: '0.7'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0.
|
138
|
+
version: '0.7'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: multi_json
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '1.
|
145
|
+
version: '1.11'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '1.
|
152
|
+
version: '1.11'
|
153
153
|
description:
|
154
154
|
email:
|
155
155
|
- oldrich.vetesnik@gmail.com
|
@@ -168,6 +168,8 @@ files:
|
|
168
168
|
- README.md
|
169
169
|
- Rakefile
|
170
170
|
- after_ship.gemspec
|
171
|
+
- bin/console
|
172
|
+
- bin/setup
|
171
173
|
- lib/after_ship.rb
|
172
174
|
- lib/after_ship/checkpoint.rb
|
173
175
|
- lib/after_ship/core/attributes.rb
|
@@ -178,20 +180,6 @@ files:
|
|
178
180
|
- lib/after_ship/core/version.rb
|
179
181
|
- lib/after_ship/courier.rb
|
180
182
|
- lib/after_ship/tracking.rb
|
181
|
-
- spec/integration/after_ship_spec.rb
|
182
|
-
- spec/request_stubs.rb
|
183
|
-
- spec/requests/couriers.json
|
184
|
-
- spec/requests/tracking/created.json
|
185
|
-
- spec/requests/tracking/delivered.json
|
186
|
-
- spec/requests/trackings.json
|
187
|
-
- spec/spec_helper.rb
|
188
|
-
- spec/units/after_ship_spec.rb
|
189
|
-
- spec/units/checkpoint_spec.rb
|
190
|
-
- spec/units/courier_spec.rb
|
191
|
-
- spec/units/date_utils_spec.rb
|
192
|
-
- spec/units/error_handler_spec.rb
|
193
|
-
- spec/units/request_spec.rb
|
194
|
-
- spec/units/tracking_spec.rb
|
195
183
|
homepage: https://github.com/ollie/after_ship
|
196
184
|
licenses:
|
197
185
|
- MIT
|
@@ -212,23 +200,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
200
|
version: '0'
|
213
201
|
requirements: []
|
214
202
|
rubyforge_project:
|
215
|
-
rubygems_version: 2.4.
|
203
|
+
rubygems_version: 2.4.6
|
216
204
|
signing_key:
|
217
205
|
specification_version: 4
|
218
206
|
summary: A smallish library to talking to AfterShip via v4 API.
|
219
|
-
test_files:
|
220
|
-
- spec/integration/after_ship_spec.rb
|
221
|
-
- spec/request_stubs.rb
|
222
|
-
- spec/requests/couriers.json
|
223
|
-
- spec/requests/tracking/created.json
|
224
|
-
- spec/requests/tracking/delivered.json
|
225
|
-
- spec/requests/trackings.json
|
226
|
-
- spec/spec_helper.rb
|
227
|
-
- spec/units/after_ship_spec.rb
|
228
|
-
- spec/units/checkpoint_spec.rb
|
229
|
-
- spec/units/courier_spec.rb
|
230
|
-
- spec/units/date_utils_spec.rb
|
231
|
-
- spec/units/error_handler_spec.rb
|
232
|
-
- spec/units/request_spec.rb
|
233
|
-
- spec/units/tracking_spec.rb
|
207
|
+
test_files: []
|
234
208
|
has_rdoc:
|