flexirest 1.4.2 → 1.4.3

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: 1349ef4e54b96017ed3331777f11f097eb99cbe2
4
- data.tar.gz: ba0508dcb49233db86db40ef9e402783a1f179b0
3
+ metadata.gz: b2c9da07ab597af994e15c2c059080bf83a4e717
4
+ data.tar.gz: 898df4a8b90a849e08cdb1a0a3d15fb0e592fca8
5
5
  SHA512:
6
- metadata.gz: 46f96c0a219835043e7700c3bfcc609ae5baa228604654eb45154637f094dde3bb0c0d57003de77e3392d8476f27bef13f5610e6168eb8e48636bdaf18fc6da3
7
- data.tar.gz: dc72d7334cee925179db652ffcce8b5d16d51a7b3c8feaaa4623649fc065bf38d0b4bf86ddbededb8d9e7a616847a31d7f0c37285456ca4ce734b178dae64506
6
+ metadata.gz: b967378d32976b65d992c7e8bc760f1050c36b73894aedb81603f0df0034a8ba237e7e524ec5a7bec5b6861d27eee2b556b64f46ff7ee05e199de75d188571af
7
+ data.tar.gz: f9e430e9e7a935f5a6335a8f015cb2054701e2a9f0d30c6b4e2c6be32fd1a07e4be26e1c63c15c405045fe3c12e9482cbc772c6525bf61aa0c66558b42bb50da
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.4.3
4
+
5
+ Feature:
6
+
7
+ - Added more client exceptions to allow fine grained exception trapping
8
+
3
9
  ## 1.4.2
4
10
 
5
11
  Bugfix:
data/README.md CHANGED
@@ -536,7 +536,10 @@ After callbacks work in exactly the same way:
536
536
 
537
537
  ```ruby
538
538
  class Person < Flexirest::Base
539
+ get :all, "/people"
540
+
539
541
  after_request :fix_empty_content
542
+ after_request :cache_all_people
540
543
 
541
544
  private
542
545
 
@@ -545,10 +548,16 @@ class Person < Flexirest::Base
545
548
  response.body = '{"empty": true}'
546
549
  end
547
550
  end
551
+
552
+ def cache_all_people(name, response)
553
+ if name == :all
554
+ response.response_headers["Expires"] = 1.hour.from_now.iso8601
555
+ end
556
+ end
548
557
  end
549
558
  ```
550
559
 
551
- **Note:** since v1.3.21 this isn't necessary, empty responses for 204 are accepted normally (the method returns `true`), but this is hear to show an example of an `after_request` callback.
560
+ **Note:** since v1.3.21 the empty response trick above isn't necessary, empty responses for 204 are accepted normally (the method returns `true`), but this is here to show an example of an `after_request` callback adjusting the body. The `cache_all_people` example shows how to cache a response even if the server doesn't send the correct headers.
552
561
 
553
562
  ### Lazy Loading
554
563
 
@@ -488,6 +488,14 @@ module Flexirest
488
488
  raise HTTPForbiddenClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
489
489
  elsif status == 404
490
490
  raise HTTPNotFoundClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
491
+ elsif status == 405
492
+ raise HTTPMethodNotAllowedClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
493
+ elsif status == 406
494
+ raise HTTPNotAcceptableClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
495
+ elsif status == 408
496
+ raise HTTPTimeoutClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
497
+ elsif status == 409
498
+ raise HTTPConflictClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
491
499
  elsif (400..499).include? status
492
500
  raise HTTPClientException.new(status:status, result:error_response, raw_response: @response.body, url:@url, method: http_method)
493
501
  elsif (500..599).include? status
@@ -712,6 +720,10 @@ module Flexirest
712
720
  class HTTPUnauthorisedClientException < HTTPClientException ; end
713
721
  class HTTPBadRequestClientException < HTTPClientException ; end
714
722
  class HTTPForbiddenClientException < HTTPClientException ; end
723
+ class HTTPMethodNotAllowedClientException < HTTPClientException ; end
724
+ class HTTPNotAcceptableClientException < HTTPClientException ; end
725
+ class HTTPTimeoutClientException < HTTPClientException ; end
726
+ class HTTPConflictClientException < HTTPClientException ; end
715
727
  class HTTPNotFoundClientException < HTTPClientException ; end
716
728
  class HTTPServerException < HTTPException ; end
717
729
 
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.4.2"
2
+ VERSION = "1.4.3"
3
3
  end
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.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-18 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -300,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
300
300
  version: '0'
301
301
  requirements: []
302
302
  rubyforge_project:
303
- rubygems_version: 2.5.2
303
+ rubygems_version: 2.6.13
304
304
  signing_key:
305
305
  specification_version: 4
306
306
  summary: This gem is for accessing REST services in a flexible way. ActiveResource