grifter 0.3.0 → 0.3.1
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/grifter.gemspec +2 -2
- data/lib/grifter.rb +2 -1
- data/lib/grifter/http_service.rb +5 -4
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 92ce55f73d37a2bd96b3794973480bb2bf46e43f
         | 
| 4 | 
            +
              data.tar.gz: e1a182a45e88bedfa500ce26f320893c5d6b9d45
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 0cafba4d159158bef39eb31306987b67d53b220356751c1615d331ca39a11a1712c12da3c7997bdfd3a0a1635fb4144de2fea62f42d92593210efa266f7e5cb6
         | 
| 7 | 
            +
              data.tar.gz: 9b246185773fe8071f3dafc45e7e845f3f4d2f2477cc5bc16ee6c0dbacf47fab7569675d53687415d8e7549966208d462d5e4206fc30f4c046ee913c1eaec77a
         | 
    
        data/grifter.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = "grifter"
         | 
| 8 | 
            -
              s.version = "0.3. | 
| 8 | 
            +
              s.version = "0.3.1"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Robert Schultheis"]
         | 
| 12 | 
            -
              s.date = " | 
| 12 | 
            +
              s.date = "2014-01-15"
         | 
| 13 13 | 
             
              s.description = "convention based approach to interfacing with an HTTP JSON API."
         | 
| 14 14 | 
             
              s.email = "rob@knewton.com"
         | 
| 15 15 | 
             
              s.executables = ["grift"]
         | 
    
        data/lib/grifter.rb
    CHANGED
    
    | @@ -14,6 +14,7 @@ class Grifter | |
| 14 14 | 
             
                authenticate: false,
         | 
| 15 15 | 
             
                load_from_config_file: true,
         | 
| 16 16 | 
             
                services: {},
         | 
| 17 | 
            +
                instrumentation: false,
         | 
| 17 18 | 
             
              }
         | 
| 18 19 | 
             
              def initialize options={}
         | 
| 19 20 | 
             
                options = DefaultConfigOptions.merge(options)
         | 
| @@ -46,7 +47,7 @@ class Grifter | |
| 46 47 | 
             
                  self.grifter_authenticate_do
         | 
| 47 48 | 
             
                end
         | 
| 48 49 |  | 
| 49 | 
            -
                start_instrumentation
         | 
| 50 | 
            +
                start_instrumentation if @config[:instrumentation] = true
         | 
| 50 51 | 
             
              end
         | 
| 51 52 |  | 
| 52 53 | 
             
              attr_reader :services
         | 
    
        data/lib/grifter/http_service.rb
    CHANGED
    
    | @@ -58,8 +58,8 @@ class Grifter | |
| 58 58 |  | 
| 59 59 | 
             
                #allow stubbing http if we are testing
         | 
| 60 60 | 
             
                attr_reader :http if defined?(RSpec)
         | 
| 61 | 
            -
             | 
| 62 | 
            -
                 | 
| 61 | 
            +
                attr_reader :name, :config, :conn
         | 
| 62 | 
            +
                attr_accessor :headers  #allows for doing some fancy stuff in threading
         | 
| 63 63 |  | 
| 64 64 | 
             
                #this is useful for testing apis, and other times
         | 
| 65 65 | 
             
                #you want to interrogate the http details of a response
         | 
| @@ -121,8 +121,6 @@ class Grifter | |
| 121 121 | 
             
                  #@last_request = req
         | 
| 122 122 | 
             
                  @last_response = response
         | 
| 123 123 |  | 
| 124 | 
            -
                  raise RequestException.new(nil, response) unless response.status >= 200 and response.status < 300
         | 
| 125 | 
            -
             | 
| 126 124 | 
             
                  response_obj = objectify response.body
         | 
| 127 125 | 
             
                  if response.headers['content-type'] =~ /json/
         | 
| 128 126 | 
             
                    logger.debug [
         | 
| @@ -133,6 +131,9 @@ class Grifter | |
| 133 131 | 
             
                      ''
         | 
| 134 132 | 
             
                    ].flatten.compact.join("\n")
         | 
| 135 133 | 
             
                  end
         | 
| 134 | 
            +
             | 
| 135 | 
            +
                  raise RequestException.new(nil, response) unless response.status >= 200 and response.status < 300
         | 
| 136 | 
            +
             | 
| 136 137 | 
             
                  return response_obj
         | 
| 137 138 | 
             
                end
         | 
| 138 139 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: grifter
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.3. | 
| 4 | 
            +
              version: 0.3.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Robert Schultheis
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2014-01-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: faraday
         |