lhc 3.7.3 → 3.8.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 +4 -4
 - data/README.md +6 -0
 - data/lib/lhc/response.rb +4 -0
 - data/lib/lhc/version.rb +1 -1
 - data/spec/response/data_accessor_spec.rb +23 -0
 - metadata +4 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b11d4708f7d94c14f063078c8c7d2d19ef0b17b3
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 6af6b618ffbf68766bcbe1fa0aa1a90320794d1f
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 9d592f45c4492bf54a9a91be316bee2023612cb21680e996812db68d9a47b3cf11c37933c4a17ef40f7c0cee919947d6f0a30fc1a27877aa6fd0c99a7e382a2f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 00b53d02f8a57a918873f110b733d7084989e2c92057d0ca66ca0a693163cbe8d8351173f3b84c703f0bd931006dc2046d0c3dc7b56cc83cbbc4bf5025e1898c
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -57,6 +57,12 @@ The response data can be access with dot-notation and square-bracket notation. Y 
     | 
|
| 
       57 
57 
     | 
    
         
             
              response.data[:name] # 'local.ch'
         
     | 
| 
       58 
58 
     | 
    
         
             
            ```
         
     | 
| 
       59 
59 
     | 
    
         | 
| 
      
 60 
     | 
    
         
            +
            You can also access response data directly through the response object (with square bracket notation only):
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 63 
     | 
    
         
            +
              LHC.json.get(url: 'http://datastore/entry/1')[:name]
         
     | 
| 
      
 64 
     | 
    
         
            +
            ```
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
       60 
66 
     | 
    
         
             
            ## Parallel requests
         
     | 
| 
       61 
67 
     | 
    
         | 
| 
       62 
68 
     | 
    
         
             
            If you pass an array of requests to `LHC.request`, it will perform those requests in parallel.
         
     | 
    
        data/lib/lhc/response.rb
    CHANGED
    
    
    
        data/lib/lhc/version.rb
    CHANGED
    
    
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rails_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe LHC do
         
     | 
| 
      
 4 
     | 
    
         
            +
              context 'data accessor (hash with indifferent access)' do
         
     | 
| 
      
 5 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  stub_request(:get, "http://local.ch/")
         
     | 
| 
      
 7 
     | 
    
         
            +
                    .with(headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/json' })
         
     | 
| 
      
 8 
     | 
    
         
            +
                    .to_return(body: { 'MyProp' => 'MyValue' }.to_json)
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                it 'makes data accessible with square bracket accessor (string)' do
         
     | 
| 
      
 12 
     | 
    
         
            +
                  expect(
         
     | 
| 
      
 13 
     | 
    
         
            +
                    LHC.json.get('http://local.ch')['MyProp']
         
     | 
| 
      
 14 
     | 
    
         
            +
                  ).to eq 'MyValue'
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                it 'makes data accessible with square bracket accessor (symbol)' do
         
     | 
| 
      
 18 
     | 
    
         
            +
                  expect(
         
     | 
| 
      
 19 
     | 
    
         
            +
                    LHC.json.get('http://local.ch')[:MyProp]
         
     | 
| 
      
 20 
     | 
    
         
            +
                  ).to eq 'MyValue'
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: lhc
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.8.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - local.ch
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016-11- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-11-07 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: typhoeus
         
     | 
| 
         @@ -259,6 +259,7 @@ files: 
     | 
|
| 
       259 
259 
     | 
    
         
             
            - spec/request/url_patterns_spec.rb
         
     | 
| 
       260 
260 
     | 
    
         
             
            - spec/response/body_spec.rb
         
     | 
| 
       261 
261 
     | 
    
         
             
            - spec/response/code_spec.rb
         
     | 
| 
      
 262 
     | 
    
         
            +
            - spec/response/data_accessor_spec.rb
         
     | 
| 
       262 
263 
     | 
    
         
             
            - spec/response/data_spec.rb
         
     | 
| 
       263 
264 
     | 
    
         
             
            - spec/response/effective_url_spec.rb
         
     | 
| 
       264 
265 
     | 
    
         
             
            - spec/response/headers_spec.rb
         
     | 
| 
         @@ -371,6 +372,7 @@ test_files: 
     | 
|
| 
       371 
372 
     | 
    
         
             
            - spec/request/url_patterns_spec.rb
         
     | 
| 
       372 
373 
     | 
    
         
             
            - spec/response/body_spec.rb
         
     | 
| 
       373 
374 
     | 
    
         
             
            - spec/response/code_spec.rb
         
     | 
| 
      
 375 
     | 
    
         
            +
            - spec/response/data_accessor_spec.rb
         
     | 
| 
       374 
376 
     | 
    
         
             
            - spec/response/data_spec.rb
         
     | 
| 
       375 
377 
     | 
    
         
             
            - spec/response/effective_url_spec.rb
         
     | 
| 
       376 
378 
     | 
    
         
             
            - spec/response/headers_spec.rb
         
     |