vertebrae 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/response/raise_error.rb +1 -7
- data/lib/response_error.rb +16 -0
- data/lib/vertebrae.rb +1 -0
- data/vertebrae.gemspec +4 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29a8a7b3943cd21e053f71eb48c8b04b0f507ce4
|
4
|
+
data.tar.gz: 8b9890ee42e92e9f2f0c51e40d3080cfce88843d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f1c1b3b9e93243ce4fde3b0edcc198481a39cc4284ba4f6f77e864c2164545d9e2bc092c0069f7c18dbfb3f888b2102ad259ac55b00ce099ae6bf4c50e51fcd
|
7
|
+
data.tar.gz: d804af6da72ab6cf9d553a667f4663a7240647fbebf117c2db4419fad14529a1cd8e3a51d9bdf6a9be9e3cc5558269c768bceef70ada34df4b981c3cca7a2fce
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/response/raise_error.rb
CHANGED
@@ -5,15 +5,9 @@ module Vertebrae
|
|
5
5
|
def on_complete(response)
|
6
6
|
status_code = response[:status].to_i
|
7
7
|
if (400...600).include? status_code
|
8
|
-
raise
|
8
|
+
raise ResponseError.new(status_code, response)
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
12
|
-
def error_message(response)
|
13
|
-
"#{response[:method].to_s.upcase} #{response[:url].to_s}: #{response[:status]} \n\n #{response[:body] if response[:body]}"
|
14
|
-
end
|
15
11
|
end
|
16
|
-
|
17
|
-
class NotFound < StandardError ; end
|
18
12
|
end # Response::RaiseError
|
19
13
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Vertebrae
|
2
|
+
class ResponseError < StandardError
|
3
|
+
attr_reader :status_code
|
4
|
+
|
5
|
+
def initialize(status_code, response)
|
6
|
+
@status_code = status_code
|
7
|
+
super(error_message(response))
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def error_message(response)
|
13
|
+
"#{response[:method].to_s.upcase} #{response[:url].to_s}: #{response[:status]} \n\n #{response[:body] if response[:body]}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/vertebrae.rb
CHANGED
data/vertebrae.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: vertebrae 0.
|
5
|
+
# stub: vertebrae 0.4.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "vertebrae"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.4.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Nathan Woodhull"]
|
14
|
-
s.date = "2016-
|
14
|
+
s.date = "2016-09-01"
|
15
15
|
s.description = "A set of low level infrastructure and reusable code for building API clients"
|
16
16
|
s.email = "nathan@controlshiftlabs.com"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -42,6 +42,7 @@ Gem::Specification.new do |s|
|
|
42
42
|
"lib/request.rb",
|
43
43
|
"lib/request/basic_auth.rb",
|
44
44
|
"lib/response/raise_error.rb",
|
45
|
+
"lib/response_error.rb",
|
45
46
|
"lib/vertebrae.rb",
|
46
47
|
"spec/api_spec.rb",
|
47
48
|
"spec/configuration_spec.rb",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vertebrae
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Woodhull
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- lib/request.rb
|
169
169
|
- lib/request/basic_auth.rb
|
170
170
|
- lib/response/raise_error.rb
|
171
|
+
- lib/response_error.rb
|
171
172
|
- lib/vertebrae.rb
|
172
173
|
- spec/api_spec.rb
|
173
174
|
- spec/configuration_spec.rb
|