flexirest 1.8.9 → 1.9.10
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 +4 -4
 - data/CHANGELOG.md +6 -0
 - data/lib/flexirest/json_api_proxy.rb +1 -1
 - data/lib/flexirest/version.rb +1 -1
 - data/spec/lib/json_api_spec.rb +23 -0
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f402c30e90e85f106749a754d7783d2519da5b86cc0caf730799cac8a5f65c72
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 29c6172196d8d09abbf37e2b40b0665d6b7d6498aa923b99c99e95683cf8c9c2
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 502bdb7fb81e058703485d37c32f01f584ebdbc5a4d9eb37badf492847a9e9070f1705c06aee048397b61c16335b175b0447ccf8b6bf663080d83d84d6b64e8b
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4a2317aac7ea5adfafe440efb5401a6da26cb1a7a8f58d4d236a5978e8c239cd540d5a45a7c9bebc39d15065d07b75ab6410b3c42a53a8e5af986a984431afa4
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
| 
         @@ -198,7 +198,7 @@ module Flexirest 
     | 
|
| 
       198 
198 
     | 
    
         | 
| 
       199 
199 
     | 
    
         
             
                    # Retrieve the resource(s) object or array from the data object
         
     | 
| 
       200 
200 
     | 
    
         
             
                    records = body['data']
         
     | 
| 
       201 
     | 
    
         
            -
                    return  
     | 
| 
      
 201 
     | 
    
         
            +
                    return body['errors'] unless records.present?
         
     | 
| 
       202 
202 
     | 
    
         | 
| 
       203 
203 
     | 
    
         
             
                    # Convert the resource object to an array,
         
     | 
| 
       204 
204 
     | 
    
         
             
                    # because it is easier to work with an array than a single object
         
     | 
    
        data/lib/flexirest/version.rb
    CHANGED
    
    
    
        data/spec/lib/json_api_spec.rb
    CHANGED
    
    | 
         @@ -239,6 +239,8 @@ module JsonAPIExample 
     | 
|
| 
       239 
239 
     | 
    
         
             
                  }
         
     | 
| 
       240 
240 
     | 
    
         
             
                }
         
     | 
| 
       241 
241 
     | 
    
         | 
| 
      
 242 
     | 
    
         
            +
                get(:real_find, '/articles/:id')
         
     | 
| 
      
 243 
     | 
    
         
            +
             
     | 
| 
       242 
244 
     | 
    
         
             
                get(
         
     | 
| 
       243 
245 
     | 
    
         
             
                  :find_lazy,
         
     | 
| 
       244 
246 
     | 
    
         
             
                  '/articles/:id',
         
     | 
| 
         @@ -308,6 +310,27 @@ describe 'JSON API' do 
     | 
|
| 
       308 
310 
     | 
    
         
             
                it 'should return a Flexirest::ResultIterator if the response contains more than one data instance' do
         
     | 
| 
       309 
311 
     | 
    
         
             
                  expect(subject.find_all).to be_an_instance_of(Flexirest::ResultIterator)
         
     | 
| 
       310 
312 
     | 
    
         
             
                end
         
     | 
| 
      
 313 
     | 
    
         
            +
             
     | 
| 
      
 314 
     | 
    
         
            +
                it 'should raise an error when response has "errors" key and no "data"' do
         
     | 
| 
      
 315 
     | 
    
         
            +
                  body = {
         
     | 
| 
      
 316 
     | 
    
         
            +
                    errors: [
         
     | 
| 
      
 317 
     | 
    
         
            +
                      {
         
     | 
| 
      
 318 
     | 
    
         
            +
                        title: "Record not found",
         
     | 
| 
      
 319 
     | 
    
         
            +
                        detail: "The record identified by 123456 could not be found",
         
     | 
| 
      
 320 
     | 
    
         
            +
                        code: "not_found",
         
     | 
| 
      
 321 
     | 
    
         
            +
                        status: "404",
         
     | 
| 
      
 322 
     | 
    
         
            +
                      }
         
     | 
| 
      
 323 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 324 
     | 
    
         
            +
                  }
         
     | 
| 
      
 325 
     | 
    
         
            +
                  headers = { "Content-Type" => "application/vnd.api+json" }
         
     | 
| 
      
 326 
     | 
    
         
            +
                  expect_any_instance_of(Flexirest::Connection).
         
     | 
| 
      
 327 
     | 
    
         
            +
                    to receive(:get).with("/articles/123", an_instance_of(Hash)).
         
     | 
| 
      
 328 
     | 
    
         
            +
                    and_return(::FaradayResponseMock.new(OpenStruct.new(body: body.to_json, response_headers: headers, status: 404)))
         
     | 
| 
      
 329 
     | 
    
         
            +
             
     | 
| 
      
 330 
     | 
    
         
            +
                  expect(-> { JsonAPIExample::Article.real_find(123) }).to raise_error(Flexirest::HTTPNotFoundClientException) do |exception|
         
     | 
| 
      
 331 
     | 
    
         
            +
                    expect(exception.result.first.title).to eq("Record not found")
         
     | 
| 
      
 332 
     | 
    
         
            +
                  end
         
     | 
| 
      
 333 
     | 
    
         
            +
                end
         
     | 
| 
       311 
334 
     | 
    
         
             
              end
         
     | 
| 
       312 
335 
     | 
    
         | 
| 
       313 
336 
     | 
    
         
             
              context 'attributes' do
         
     | 
    
        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 
     | 
    
         
            +
              version: 1.9.10
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Andy Jeffries
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2020-02- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-02-12 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |