cortex-client 0.3.1 → 0.4.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/cortex-client.gemspec +1 -0
 - data/lib/cortex/result.rb +14 -2
 - data/lib/cortex/version.rb +1 -1
 - metadata +16 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: eaa5268c1114a575ce22ccdc485df37cce36406f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8ce35ce48d8492321bd9b36d78e61bbd833874fc
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c7bc04d21adbaa56dea175e3e912089195262254596c0a900ecd94f5c3a2339ddbaf5c95e8f0895b5e4f3ac421c421320050af69050041a0bc9d7a8ba148ea34
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: f2a0af95a3a39e66b4c934538776a1a066ed55e58f3a8b5d8602bad3ac0d092e80d5d8ef8de9c81d9e24b0462f014f8c2b3b27dd7aaa6549af7a7331068b240a
         
     | 
    
        data/cortex-client.gemspec
    CHANGED
    
    
    
        data/lib/cortex/result.rb
    CHANGED
    
    | 
         @@ -1,9 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'hashie'
         
     | 
| 
       1 
2 
     | 
    
         
             
            module Cortex
         
     | 
| 
       2 
3 
     | 
    
         
             
              class Result
         
     | 
| 
       3 
4 
     | 
    
         
             
                attr_reader :raw_headers, :contents, :total_items, :page, :per_page, :errors, :range_start, :range_end, :range, :status
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
                def initialize(body, headers, status)
         
     | 
| 
       6 
     | 
    
         
            -
                  @contents = body
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @contents = parse(body)
         
     | 
| 
       7 
8 
     | 
    
         
             
                  @raw_headers = headers
         
     | 
| 
       8 
9 
     | 
    
         
             
                  @status = status
         
     | 
| 
       9 
10 
     | 
    
         
             
                  @total_items = headers['x-total-items'] unless headers['x-total-items'].nil?
         
     | 
| 
         @@ -31,6 +32,17 @@ module Cortex 
     | 
|
| 
       31 
32 
     | 
    
         
             
                  end
         
     | 
| 
       32 
33 
     | 
    
         
             
                end
         
     | 
| 
       33 
34 
     | 
    
         | 
| 
      
 35 
     | 
    
         
            +
                def parse(body)
         
     | 
| 
      
 36 
     | 
    
         
            +
                  case body
         
     | 
| 
      
 37 
     | 
    
         
            +
                    when Hash
         
     | 
| 
      
 38 
     | 
    
         
            +
                      ::Hashie::Mash.new(body)
         
     | 
| 
      
 39 
     | 
    
         
            +
                    when Array
         
     | 
| 
      
 40 
     | 
    
         
            +
                      body.map { |item| parse(item) }
         
     | 
| 
      
 41 
     | 
    
         
            +
                    else
         
     | 
| 
      
 42 
     | 
    
         
            +
                      body
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
       34 
46 
     | 
    
         
             
                def find_errors
         
     | 
| 
       35 
47 
     | 
    
         
             
                  if is_error?
         
     | 
| 
       36 
48 
     | 
    
         
             
                    if @contents.is_a?(Hash)
         
     | 
| 
         @@ -47,4 +59,4 @@ module Cortex 
     | 
|
| 
       47 
59 
     | 
    
         
             
                  end
         
     | 
| 
       48 
60 
     | 
    
         
             
                end
         
     | 
| 
       49 
61 
     | 
    
         
             
              end
         
     | 
| 
       50 
     | 
    
         
            -
            end
         
     | 
| 
      
 62 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/cortex/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: cortex-client
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Bennett Goble
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2015-02- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2015-02-05 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rake
         
     | 
| 
         @@ -109,6 +109,20 @@ dependencies: 
     | 
|
| 
       109 
109 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       110 
110 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       111 
111 
     | 
    
         
             
                    version: 0.0.4
         
     | 
| 
      
 112 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 113 
     | 
    
         
            +
              name: hashie
         
     | 
| 
      
 114 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 115 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 116 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 117 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 118 
     | 
    
         
            +
                    version: 3.4.0
         
     | 
| 
      
 119 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 120 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 121 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 122 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 123 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 124 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 125 
     | 
    
         
            +
                    version: 3.4.0
         
     | 
| 
       112 
126 
     | 
    
         
             
            description: 
         
     | 
| 
       113 
127 
     | 
    
         
             
            email: 
         
     | 
| 
       114 
128 
     | 
    
         
             
            executables: []
         
     |