gun_broker 1.0.0 → 1.1.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/bin/console +10 -0
- data/bin/setup +3 -0
- data/gun_broker.gemspec +1 -0
- data/lib/gun_broker.rb +22 -4
- data/lib/gun_broker/api.rb +10 -1
- data/lib/gun_broker/version.rb +1 -1
- metadata +20 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 7046dc9d7cbc2b209e3c1a15423531d13adac8cc
         | 
| 4 | 
            +
              data.tar.gz: ac669bb18a1bd17e4c34fecf85ecb0addf9c9e67
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9aeac94a7394482cca0fa09fc85e3d37d98cb59d288d38e37910ab38afb73fff63e4b6f5e9e1e41617989790f5d2db0b88d190fda85867a51106c5afe3eaeabe
         | 
| 7 | 
            +
              data.tar.gz: 866709353845783cc78faaeb6215841070794a86aa7e7aee82d08add0feba03ef08450b2f1925ef27f4072b04110ac394dc2c615458cfd561028752b5f2fa6cb
         | 
    
        data/bin/console
    ADDED
    
    
    
        data/bin/setup
    ADDED
    
    
    
        data/gun_broker.gemspec
    CHANGED
    
    | @@ -19,6 +19,7 @@ Gem::Specification.new do |spec| | |
| 19 19 | 
             
              spec.require_paths = ["lib"]
         | 
| 20 20 |  | 
| 21 21 | 
             
              spec.add_development_dependency "bundler", "~> 1.7"
         | 
| 22 | 
            +
              spec.add_development_dependency "pry", "~> 0.10.4"
         | 
| 22 23 | 
             
              spec.add_development_dependency "rake", "~> 10.0"
         | 
| 23 24 | 
             
              spec.add_development_dependency "rspec", "~> 3.1"
         | 
| 24 25 | 
             
              spec.add_development_dependency "simplecov", "~> 0.9"
         | 
    
        data/lib/gun_broker.rb
    CHANGED
    
    | @@ -27,8 +27,8 @@ module GunBroker | |
| 27 27 |  | 
| 28 28 | 
             
              # Sets the developer key obtained from GunBroker.com.
         | 
| 29 29 | 
             
              # @param dev_key [String]
         | 
| 30 | 
            -
              def self.dev_key=( | 
| 31 | 
            -
                @@dev_key =  | 
| 30 | 
            +
              def self.dev_key=(_dev_key)
         | 
| 31 | 
            +
                @@dev_key = _dev_key
         | 
| 32 32 | 
             
              end
         | 
| 33 33 |  | 
| 34 34 | 
             
              # Returns the set developer key, or raises GunBroker::Error if not set.
         | 
| @@ -39,10 +39,28 @@ module GunBroker | |
| 39 39 | 
             
                @@dev_key
         | 
| 40 40 | 
             
              end
         | 
| 41 41 |  | 
| 42 | 
            +
              # Set URL for remote proxy (including host, port, user, and password)
         | 
| 43 | 
            +
              # @return [String] Defaults to `nil`.
         | 
| 44 | 
            +
              def self.proxy_url=(_proxy_url)
         | 
| 45 | 
            +
                @@proxy_url = _proxy_url
         | 
| 46 | 
            +
              end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
              # Fully-qualified URL for remote proxy (including host, port, user, and password)
         | 
| 49 | 
            +
              # @return [String] Defaults to `nil`.
         | 
| 50 | 
            +
              def self.proxy_url
         | 
| 51 | 
            +
                defined?(@@proxy_url) ? @@proxy_url : nil
         | 
| 52 | 
            +
              end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
              # Convenience method for finding out if a proxy_url has been set
         | 
| 55 | 
            +
              # @return [Boolean] Defaults to `false`.
         | 
| 56 | 
            +
              def self.proxy_url?
         | 
| 57 | 
            +
                !! defined?(@@proxy_url) || false
         | 
| 58 | 
            +
              end
         | 
| 59 | 
            +
             | 
| 42 60 | 
             
              # Determines if this library will use the production API or the 'sandbox' API.
         | 
| 43 61 | 
             
              # @param sandbox [Boolean]
         | 
| 44 | 
            -
              def self.sandbox=( | 
| 45 | 
            -
                @@sandbox =  | 
| 62 | 
            +
              def self.sandbox=(_sandbox)
         | 
| 63 | 
            +
                @@sandbox = _sandbox
         | 
| 46 64 | 
             
              end
         | 
| 47 65 |  | 
| 48 66 | 
             
              # If `true`, this library will use the 'sandbox' GunBroker API.
         | 
    
        data/lib/gun_broker/api.rb
    CHANGED
    
    | @@ -127,7 +127,7 @@ module GunBroker | |
| 127 127 | 
             
                  # using std-lib Timeout module
         | 
| 128 128 | 
             
                  # The GunBroker API is so fickle that the 'read_timeout' option might never even get a chance
         | 
| 129 129 | 
             
                  Timeout.timeout(GunBroker.timeout) do
         | 
| 130 | 
            -
                     | 
| 130 | 
            +
                    net_http_class.start(uri.host, uri.port, net_http_options) do |http|
         | 
| 131 131 | 
             
                      http.ssl_version = :TLSv1
         | 
| 132 132 | 
             
                      http.ciphers = ['RC4-SHA']
         | 
| 133 133 | 
             
                      http.request(request)
         | 
| @@ -137,6 +137,15 @@ module GunBroker | |
| 137 137 | 
             
                  raise GunBroker::Error::TimeoutError.new("waited for #{GunBroker.timeout} seconds with no response (#{uri}) #{e.inspect}")
         | 
| 138 138 | 
             
                end
         | 
| 139 139 |  | 
| 140 | 
            +
                def net_http_class
         | 
| 141 | 
            +
                  if GunBroker.proxy_url?
         | 
| 142 | 
            +
                    proxy_uri = URI.parse(GunBroker.proxy_url)
         | 
| 143 | 
            +
                    Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)
         | 
| 144 | 
            +
                  else
         | 
| 145 | 
            +
                    Net::HTTP
         | 
| 146 | 
            +
                  end
         | 
| 147 | 
            +
                end
         | 
| 148 | 
            +
             | 
| 140 149 | 
             
                def net_http_options
         | 
| 141 150 | 
             
                  {
         | 
| 142 151 | 
             
                    use_ssl: uri.scheme == 'https',
         | 
    
        data/lib/gun_broker/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: gun_broker
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Dale Campbell
         | 
| @@ -24,6 +24,20 @@ dependencies: | |
| 24 24 | 
             
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 26 | 
             
                    version: '1.7'
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: pry
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - "~>"
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: 0.10.4
         | 
| 34 | 
            +
              type: :development
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - "~>"
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: 0.10.4
         | 
| 27 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 42 | 
             
              name: rake
         | 
| 29 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -97,7 +111,9 @@ dependencies: | |
| 97 111 | 
             
            description: ''
         | 
| 98 112 | 
             
            email:
         | 
| 99 113 | 
             
            - oshuma@gmail.com
         | 
| 100 | 
            -
            executables: | 
| 114 | 
            +
            executables:
         | 
| 115 | 
            +
            - console
         | 
| 116 | 
            +
            - setup
         | 
| 101 117 | 
             
            extensions: []
         | 
| 102 118 | 
             
            extra_rdoc_files: []
         | 
| 103 119 | 
             
            files:
         | 
| @@ -110,6 +126,8 @@ files: | |
| 110 126 | 
             
            - LICENSE.txt
         | 
| 111 127 | 
             
            - README.md
         | 
| 112 128 | 
             
            - Rakefile
         | 
| 129 | 
            +
            - bin/console
         | 
| 130 | 
            +
            - bin/setup
         | 
| 113 131 | 
             
            - gun_broker.gemspec
         | 
| 114 132 | 
             
            - lib/gun_broker.rb
         | 
| 115 133 | 
             
            - lib/gun_broker/api.rb
         |