flexirest 1.3.10 → 1.3.12

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: 5e651c2b737f396357909fdc4aaab2d28997ee1f
4
- data.tar.gz: e38300b96dcace5b1da4f5d81c7d523f3304e6e7
3
+ metadata.gz: 6ccb5f8a0bd924da53a93a997101f645c495581b
4
+ data.tar.gz: b5de1887d8f72fd6748e564a1dc35442f8a1469b
5
5
  SHA512:
6
- metadata.gz: a358ba93a1e908eac336bed2c07697d77b7e1a780da1b1059d5c7c7de4caa9e50dd9a7f40f19ed1f835f927d3208029dd70cc87c75b73657c45f9d2e4620f8c0
7
- data.tar.gz: a616506f250aa49f5e517542b170a338d24ec10683c0db9e1be9081ac87ee8cf586c4355b291e7fa9b0af501fa9a3cada17c695a6095534d5b2d1e95ba7dff8a
6
+ metadata.gz: 78a7b8f44082d9368f8826bdfcf5441b354c6bcaddbd7b71cdd2a96439e68aaa0d3eba53a6fc15c64d0d02c02929c8f33241b2b7521a9fd5089e552fa3f3e440
7
+ data.tar.gz: bea87e9a033c49a21fac8a8b64aee4fc612a3b6aff5f8c94ab70aa2d2844fa4a9a1ce1b3655c69e151e4aeae2c504d4777b1cbbbad3c9ae9aafd092b3a8c6fa4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.12
4
+
5
+ Bugfix:
6
+
7
+ - The Travis build was breaking because Guard pulls in Listen, which only runs on Ruby 2.2 and above. So I removed Guard so the gem can be tested to work against older Ruby versions still.
8
+
9
+ ## 1.3.11
10
+
11
+ Feature:
12
+
13
+ - Made the `Flexirest::*Exception#message` much nicer to help debugging applications, e.g. `Sending PUT to '/enable' returned a 500 with the body of - {"error":"John doesn't exist", "code":1234}`.
14
+
3
15
  ## 1.3.10
4
16
 
5
17
  Feature:
data/flexirest.gemspec CHANGED
@@ -26,8 +26,6 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "rspec_junit_formatter"
27
27
  spec.add_development_dependency "simplecov"
28
28
  spec.add_development_dependency "simplecov-rcov"
29
- spec.add_development_dependency "guard-rspec"
30
- spec.add_development_dependency 'terminal-notifier-guard'
31
29
  spec.add_development_dependency 'coveralls'
32
30
  spec.add_development_dependency "api-auth", ">= 1.3.1"
33
31
  spec.add_development_dependency 'typhoeus'
@@ -407,17 +407,17 @@ module Flexirest
407
407
  error_response = @response.body
408
408
  end
409
409
  if status == 400
410
- raise HTTPBadRequestClientException.new(status:status, result:error_response, url:@url)
410
+ raise HTTPBadRequestClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
411
411
  elsif status == 401
412
- raise HTTPUnauthorisedClientException.new(status:status, result:error_response, url:@url)
412
+ raise HTTPUnauthorisedClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
413
413
  elsif status == 403
414
- raise HTTPForbiddenClientException.new(status:status, result:error_response, url:@url)
414
+ raise HTTPForbiddenClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
415
415
  elsif status == 404
416
- raise HTTPNotFoundClientException.new(status:status, result:error_response, url:@url)
416
+ raise HTTPNotFoundClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
417
417
  elsif (400..499).include? status
418
- raise HTTPClientException.new(status:status, result:error_response, url:@url)
418
+ raise HTTPClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
419
419
  elsif (500..599).include? status
420
- raise HTTPServerException.new(status:status, result:error_response, url:@url)
420
+ raise HTTPServerException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
421
421
  elsif status == 0
422
422
  raise TimeoutException.new("Timed out getting #{response.url}")
423
423
  end
@@ -603,6 +603,12 @@ module Flexirest
603
603
  @status = options[:status]
604
604
  @result = options[:result]
605
605
  @request_url = options[:url]
606
+ @raw_response = options[:raw_response]
607
+ @method = options[:method]
608
+ end
609
+
610
+ def message
611
+ "Sending #{@method.upcase} to '#{@request_url}' returned a #{@status} with the body of - #{@raw_response}"
606
612
  end
607
613
  end
608
614
  class HTTPClientException < HTTPException ; end
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.3.10"
2
+ VERSION = "1.3.12"
3
3
  end
@@ -494,6 +494,20 @@ describe Flexirest::Request do
494
494
  expect(e.result.first_name).to eq("John")
495
495
  end
496
496
 
497
+ it "should return a useful message for errors" do
498
+ expect_any_instance_of(Flexirest::Connection).
499
+ to receive(:post).
500
+ with("/create", "first_name=John&should_disappear=true", an_instance_of(Hash)).
501
+ and_return(::FaradayResponseMock.new(OpenStruct.new(body:"{\"first_name\":\"John\", \"id\":1234}", response_headers:{}, status:500)))
502
+ object = ExampleClient.new(first_name:"John", should_disappear:true)
503
+ begin
504
+ object.create
505
+ rescue Flexirest::HTTPServerException => e
506
+ e
507
+ end
508
+ expect(e.message).to eq(%q{Sending POST to '/create' returned a 500 with the body of - {"first_name":"John", "id":1234}})
509
+ end
510
+
497
511
  it "should raise a parse exception for invalid JSON returns" do
498
512
  error_content = "<h1>500 Server Error</h1>"
499
513
  expect_any_instance_of(Flexirest::Connection).
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexirest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.10
4
+ version: 1.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,34 +108,6 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: guard-rspec
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: terminal-notifier-guard
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
111
  - !ruby/object:Gem::Dependency
140
112
  name: coveralls
141
113
  requirement: !ruby/object:Gem::Requirement
@@ -248,7 +220,6 @@ files:
248
220
  - CHANGELOG.md
249
221
  - CONTRIBUTING.md
250
222
  - Gemfile
251
- - Guardfile
252
223
  - LICENSE.txt
253
224
  - Migrating-from-ActiveRestClient.md
254
225
  - README.md
data/Guardfile DELETED
@@ -1,9 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard :rspec, cmd: 'bundle exec rspec' do
5
- watch(%r{^spec/.*/*_spec\.rb$}) { "spec" }
6
- watch(%r{^lib/.*/(.+)\.rb$}) { "spec" }
7
- watch('spec/spec_helper.rb') { "spec" }
8
- end
9
-