flexirest 1.10.6 → 1.10.7

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
  SHA256:
3
- metadata.gz: eb22808a993f64bfac3dd7e8927b0f9a0847800666962b0182a1e9161cf776fe
4
- data.tar.gz: ad93e71fdfbb91fc68fc3b7939b7b023399672560e14e976eadb7e1db38bf995
3
+ metadata.gz: 5e785cb379a1ed7536d5486bf5fc10c15a0afebbcc5fc3a88906d6b52aa19ed4
4
+ data.tar.gz: 7960a64126527e0d553551de83a9c4129880880b6f9d783eac6a7551695e5b87
5
5
  SHA512:
6
- metadata.gz: 9d82ab1f62bdd4b55a08d0c49584fc251842773ca5a8d986dd980116498a021ff6287092ea83eee429ad1f04dab719cd8b40116b21e432c4ca32d0ffd056549e
7
- data.tar.gz: 925fbd8da65f0dda69db4629d7fec401944d2846669b272045342a2384671bb45b55aa98905c17328631862b6953ac7ad5675c76980b7896c2a5916c968c365c
6
+ metadata.gz: 69729e7916e4b08d10e2d8469c73e40a403302ff1d61fa1d922634e7be13727cf3785d8ed04481f4f1c28d5da0271499fad45e3b0d38bc1e926592d01cdb58ef
7
+ data.tar.gz: 2f2a0ecf6a6c54e25dea39d9340f049211d273c7e1c8a30f65daa091d35a281eb50678d4f26f849f7b65428fce06faf83737b7a67af810074aec522c92576698
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Build
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.5', '2.6', '2.7', '3.0']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run tests
35
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.7
4
+
5
+ Bugfix:
6
+
7
+ - Flexirest didn't find the elements if the specified root wasn't found, e.g. in error conditions (thanks to Jolyon Pawlyn/@jpawlyn for the PR)
8
+
3
9
  ## 1.10.6
4
10
 
5
11
  Bugfix:
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Flexirest
2
2
 
3
3
  > Access your REST APIs in a flexible way.
4
- >
4
+ >
5
5
  > Write your API classes in an ActiveRecord-style; like ActiveResource but Flexirest works where the resource naming doesn't follow Rails conventions, it has built-in caching and is much more flexible.
6
6
 
7
- [![Build Status](https://travis-ci.org/flexirest/flexirest.svg?branch=master)](https://travis-ci.org/flexirest/flexirest)
7
+ [![Build](https://github.com/flexirest/flexirest/actions/workflows/build_test.yml/badge.svg)](https://github.com/flexirest/flexirest/actions/workflows/build.yml)
8
8
  [![Coverage Status](https://coveralls.io/repos/github/flexirest/flexirest/badge.svg?branch=master)](https://coveralls.io/github/flexirest/flexirest?branch=master)
9
9
  [![Code Climate](https://codeclimate.com/github/flexirest/flexirest.png)](https://codeclimate.com/github/flexirest/flexirest)
10
10
  [![Gem Version](https://badge.fury.io/rb/flexirest.png)](http://badge.fury.io/rb/flexirest)
@@ -862,14 +862,14 @@ module Flexirest
862
862
 
863
863
  if ignore_root
864
864
  [ignore_root].flatten.each do |key|
865
- body = body[key.to_s]
865
+ body = body[key.to_s] if body.has_key?(key.to_s)
866
866
  end
867
867
  end
868
868
  elsif is_xml_response?
869
869
  body = @response.body.blank? ? {} : Crack::XML.parse(@response.body)
870
870
  if ignore_root
871
871
  [ignore_root].flatten.each do |key|
872
- body = body[key.to_s]
872
+ body = body[key.to_s] if body.has_key?(key.to_s)
873
873
  end
874
874
  elsif options[:ignore_xml_root]
875
875
  Flexirest::Logger.warn("Using `ignore_xml_root` is deprecated, please switch to `ignore_root`")
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.10.6"
2
+ VERSION = "1.10.7"
3
3
  end
@@ -236,6 +236,8 @@ describe Flexirest::BaseWithoutValidation do
236
236
 
237
237
  Flexirest::Base.base_url = "https://www.example.com/api/v2"
238
238
  expect(OutsideBaseExample.base_url).to eq("https://www.example.com/api/v2")
239
+ ensure
240
+ Flexirest::Base.base_url = 'http://www.example.com'
239
241
  end
240
242
 
241
243
  it "should include the Mapping module" do
@@ -206,6 +206,16 @@ describe Flexirest::Request do
206
206
  }
207
207
  end
208
208
 
209
+ class IgnoredRootWithUnexpectedResponseExampleClient < ExampleClient
210
+ get :root, "/root", ignore_root: "feed", fake: %Q{
211
+ {
212
+ "error": {
213
+ "message": "Example Error"
214
+ }
215
+ }
216
+ }
217
+ end
218
+
209
219
  class IgnoredMultiLevelRootExampleClient < ExampleClient
210
220
  get :multi_level_root, "/multi-level-root", ignore_root: [:response, "data", "object"], fake: %Q{
211
221
  {
@@ -1524,6 +1534,10 @@ describe Flexirest::Request do
1524
1534
  expect(IgnoredRootExampleClient.root.title).to eq("Example Feed")
1525
1535
  end
1526
1536
 
1537
+ it "should ignore an ignore_root parameter if the specified element is not in the response" do
1538
+ expect(IgnoredRootWithUnexpectedResponseExampleClient.root.error.message).to eq("Example Error")
1539
+ end
1540
+
1527
1541
  it "should ignore a specified multi-level root element" do
1528
1542
  expect(IgnoredMultiLevelRootExampleClient.multi_level_root.title).to eq("Example Multi Level Feed")
1529
1543
  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.10.6
4
+ version: 1.10.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-14 00:00:00.000000000 Z
11
+ date: 2021-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -261,10 +261,10 @@ executables: []
261
261
  extensions: []
262
262
  extra_rdoc_files: []
263
263
  files:
264
+ - ".github/workflows/build.yml"
264
265
  - ".gitignore"
265
266
  - ".rspec"
266
267
  - ".simplecov"
267
- - ".travis.yml"
268
268
  - CHANGELOG.md
269
269
  - Gemfile
270
270
  - LICENSE.txt
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.7.0
4
- - 2.6.0
5
- - 2.5.0