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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2612a655857c96bc533957c3da0cf03989d36e3
4
- data.tar.gz: 41fee10a3620d19bda2dbbda5b251aa0d3e0e9cb
3
+ metadata.gz: fa67702f2a21706e2f70e90542a647a8cf7a054d
4
+ data.tar.gz: 4fd6cecc5ad8b10bd1feb4f05ffb88194a5a1f9d
5
5
  SHA512:
6
- metadata.gz: 67eeb6d9f3805833a5b2a82c96a6c6ba4aeef97cbe9f156d2f036abed2de4f02b7abecbcf9e640af9966cc495a8be901539726673bda5612b388f6c1830fcfbf
7
- data.tar.gz: 3bf88f54b44171695ad65a5c516f4a7e6d56b0de4ce54a57425bbfaef788fb57d2f59d0b0b22def4bafa55343e36284b8c080db260739d50cb800f5db63acce2
6
+ metadata.gz: e44afcc71e645f9884f0b47aee50519c624134949f97b59888b842d6a52594092bcdd41e7a1484f5f44de8984c4e14b1b7c9c14ce3fed56debcb5452c1e03593
7
+ data.tar.gz: b8766e26c808f18d79cc358cf6cf21d357a1c99dd1bee6af02464592934740c66dc3201d1ca2dcd7af98f73be39294b85c677aec34afbcb7c74a985fa55caa25
data/.gitignore CHANGED
@@ -1,22 +1,10 @@
1
1
  *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
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
@@ -1,2 +1,5 @@
1
1
  Metrics/MethodLength:
2
- Max: 12
2
+ Max: 11
3
+
4
+ Style/Documentation:
5
+ Enabled: false
data/.travis.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.1.5
4
+ - 2.2.2
5
+ - 2.1.6
5
6
  - 1.9.3
6
7
  - jruby-19mode
7
8
 
data/LICENSE.txt CHANGED
@@ -1,22 +1,21 @@
1
- Copyright (c) 2014 Oldrich Vetesnik
1
+ The MIT License (MIT)
2
2
 
3
- MIT License
3
+ Copyright (c) 2014-2015 Oldrich Vetesnik
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
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
- included in all copies or substantial portions of the Software.
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
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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
@@ -11,8 +11,3 @@ desc 'Same as :combo but build a gem, too'
11
11
  task mega_combo: :combo do
12
12
  sh 'gem build after_ship.gemspec'
13
13
  end
14
-
15
- desc 'Start a console'
16
- task :console do
17
- sh 'bundle exec pry -I ./lib -r ./lib/after_ship.rb'
18
- end
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
- spec.files = `git ls-files -z`.split("\x0")
16
- spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(/^(test|spec|features)\//)
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.6'
23
+ spec.add_development_dependency 'bundler', '~> 1.7'
22
24
 
23
25
  # Test
24
- spec.add_development_dependency 'rspec', '~> 3.1'
25
- spec.add_development_dependency 'webmock', '~> 1.20'
26
- spec.add_development_dependency 'simplecov', '~> 0.9'
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.27'
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.3'
34
+ spec.add_development_dependency 'rake', '~> 10.4'
33
35
 
34
36
  # Networking
35
37
  # Fast networking
36
- spec.add_runtime_dependency 'typhoeus', '~> 0.6'
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.10'
40
+ spec.add_runtime_dependency 'multi_json', '~> 1.11'
39
41
  end
data/bin/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'after_ship'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ require 'pry'
10
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
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 options [Hash]
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 nil
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)
@@ -1,6 +1,7 @@
1
1
  class AfterShip
2
2
  # Error classes.
3
3
  # https://www.aftership.com/docs/api/4/errors
4
+ # rubocop:disable Style/SpaceAroundOperators
4
5
  class Error < StandardError
5
6
  class BadRequest < Error; end # 400
6
7
  class InvalidJsonData < BadRequest; end # 4001, 4002
@@ -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 [Hash]
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 [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.
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 [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.
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 [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.
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 [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.
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)
@@ -1,4 +1,4 @@
1
1
  class AfterShip
2
2
  # Version number, happy now?
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.6'
4
4
  end
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.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oldrich Vetesnik
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2014-11-25 00:00:00.000000000 Z
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.6'
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.6'
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.1'
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.1'
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.20'
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.20'
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.9'
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.9'
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.27'
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.27'
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.3'
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.3'
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.6'
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.6'
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.10'
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.10'
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.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: