vertebrae 0.3.1 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90c9eedbb4d8ae58744d9d67672d222bf94ddf6e
4
- data.tar.gz: 7b2abfb3d5f74d06996946e774a459a79822bc65
3
+ metadata.gz: 29a8a7b3943cd21e053f71eb48c8b04b0f507ce4
4
+ data.tar.gz: 8b9890ee42e92e9f2f0c51e40d3080cfce88843d
5
5
  SHA512:
6
- metadata.gz: 601438c76194f11fb03e99c05a1fdb057575d24aa4bbabd3c5d2f689b249f4a90b509e799bcc1eb4da163f7947cf8fc42157087118fac092c002ef55e20531a6
7
- data.tar.gz: 773defaba25e928d01504222d0c59ffac47e070a0a67f349d87d26590de9f0a86874a1fc228b773f0a9d10ed48412201779c1aa7a48f8da57356abe21e45a017
6
+ metadata.gz: 5f1c1b3b9e93243ce4fde3b0edcc198481a39cc4284ba4f6f77e864c2164545d9e2bc092c0069f7c18dbfb3f888b2102ad259ac55b00ce099ae6bf4c50e51fcd
7
+ data.tar.gz: d804af6da72ab6cf9d553a667f4663a7240647fbebf117c2db4419fad14529a1cd8e3a51d9bdf6a9be9e3cc5558269c768bceef70ada34df4b981c3cca7a2fce
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.4.0
@@ -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 StandardError.new(error_message(response))
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
@@ -5,6 +5,7 @@ require 'authorization'
5
5
  require 'configuration'
6
6
  require 'connection'
7
7
  require 'request'
8
+ require 'response_error'
8
9
  require 'api'
9
10
  require 'base'
10
11
  require 'model'
@@ -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.3.1 ruby lib
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.3.1"
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-08-03"
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.3.1
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-08-03 00:00:00.000000000 Z
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