remind101 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/remind101/error.rb +7 -4
- data/lib/remind101/middleware/raise_error.rb +2 -0
- data/lib/remind101/version.rb +1 -1
- data/spec/remind101/error_spec.rb +15 -0
- data/spec/spec_helper.rb +6 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1faa05e29b28622fcfda12de219e9a633596a989
|
4
|
+
data.tar.gz: c69839a0a708c5d79e291126442c70ddefe32aca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 070b8ae9bf4b8228b874e2a7b428e991755a129d06f7bd05d92eb080c85b5af2012997d0c8b42889e8c843bd7bc59546c0ab1d99f306e650a7143979b83b0963
|
7
|
+
data.tar.gz: a949cbf125c0b7a8318c5d5405a070b1a0093f68a154f3e77c48a8b2fb7f2fe9c806254044cd88eb11ff14594b3c1235580cf5d8cd309af7ab5ca1ba22a5e29e
|
data/lib/remind101/error.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
module Remind101
|
2
2
|
module Error
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
3
|
+
ClientError = Class.new(Faraday::Error::ClientError)
|
4
|
+
ResourceNotFound = Class.new(ClientError)
|
5
|
+
ConnectionFailed = Class.new(ClientError)
|
7
6
|
|
8
7
|
module ErrorsBody
|
9
8
|
def error
|
@@ -11,6 +10,10 @@ module Remind101
|
|
11
10
|
end
|
12
11
|
end
|
13
12
|
|
13
|
+
class Unauthorized < ClientError
|
14
|
+
include ErrorsBody
|
15
|
+
end
|
16
|
+
|
14
17
|
class BadInput < ClientError
|
15
18
|
include ErrorsBody
|
16
19
|
end
|
@@ -7,6 +7,8 @@ module Remind101
|
|
7
7
|
case env[:status]
|
8
8
|
when 400
|
9
9
|
raise Remind101::Error::BadInput, response_values(env)
|
10
|
+
when 401
|
11
|
+
raise Remind101::Error::Unauthorized, response_values(env)
|
10
12
|
when 404
|
11
13
|
raise Remind101::Error::ResourceNotFound, response_values(env)
|
12
14
|
when 422
|
data/lib/remind101/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Remind101::Error do
|
4
|
+
specify { Remind101::Error::ClientError.should inherit_from Faraday::ClientError }
|
5
|
+
|
6
|
+
[
|
7
|
+
Remind101::Error::BadInput,
|
8
|
+
Remind101::Error::Unauthorized,
|
9
|
+
Remind101::Error::ResourceNotFound,
|
10
|
+
Remind101::Error::ValidationError,
|
11
|
+
Remind101::Error::ConnectionFailed
|
12
|
+
].each do |klass|
|
13
|
+
specify { klass.should inherit_from Remind101::Error::ClientError }
|
14
|
+
end
|
15
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -11,3 +11,9 @@ WebMock.disable_net_connect!
|
|
11
11
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
12
12
|
# in spec/support/ and its subdirectories.
|
13
13
|
Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f}
|
14
|
+
|
15
|
+
RSpec::Matchers.define :inherit_from do |expected|
|
16
|
+
match do |actual|
|
17
|
+
actual < expected
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remind101
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric J. Holmes
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- lib/remind101/version.rb
|
178
178
|
- remind101.gemspec
|
179
179
|
- spec/remind101/client_spec.rb
|
180
|
+
- spec/remind101/error_spec.rb
|
180
181
|
- spec/remind101_spec.rb
|
181
182
|
- spec/spec_helper.rb
|
182
183
|
homepage: https://github.com/remind101/remind101.rb
|
@@ -205,5 +206,6 @@ specification_version: 4
|
|
205
206
|
summary: Ruby client for the Remind101 API.
|
206
207
|
test_files:
|
207
208
|
- spec/remind101/client_spec.rb
|
209
|
+
- spec/remind101/error_spec.rb
|
208
210
|
- spec/remind101_spec.rb
|
209
211
|
- spec/spec_helper.rb
|