lenddo 2.0.0 → 2.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/lib/lenddo/authentication.rb +20 -9
- data/lib/lenddo/configuration.rb +1 -1
- data/lib/lenddo/errors/configuration.rb +1 -1
- data/lib/lenddo/errors/exceptions.rb +8 -0
- data/lib/lenddo/response.rb +15 -2
- data/lib/lenddo/version.rb +2 -2
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6aa3fed76f4f20198170dca13691b8ba450f2855
         | 
| 4 | 
            +
              data.tar.gz: 763602a7c3599d9cfc693a95488c3cbecfda1904
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4b64d8df5540f921156bdfa875020dba304b35627a335ab80122452ca085401fb37f1033c3a871e447c6a46aff774b36fe24c87b2fb1fd28abf4ff13e3bc414e
         | 
| 7 | 
            +
              data.tar.gz: 13a5d2cc4c962120537814487387dd5de514092bd7ba0aee843385fb59d9ec1f8cdd3a39a1658e27df8e8919710824d26f2c30f3d6d8ca95e3f0749e0bebcd4d
         | 
| @@ -2,6 +2,7 @@ require 'base64' | |
| 2 2 | 
             
            require 'curb'
         | 
| 3 3 | 
             
            require 'json'
         | 
| 4 4 | 
             
            require 'openssl'
         | 
| 5 | 
            +
            require 'lenddo/errors/exceptions'
         | 
| 5 6 |  | 
| 6 7 | 
             
            module Lenddo
         | 
| 7 8 | 
             
              module Authentication
         | 
| @@ -18,16 +19,26 @@ module Lenddo | |
| 18 19 | 
             
                  end
         | 
| 19 20 |  | 
| 20 21 | 
             
                  uri = URI.parse(host + path)
         | 
| 21 | 
            -
                   | 
| 22 | 
            -
                     | 
| 23 | 
            -
             | 
| 24 | 
            -
                       | 
| 25 | 
            -
             | 
| 22 | 
            +
                  begin
         | 
| 23 | 
            +
                    response = Curl.send(method.to_s, uri.to_s, params) do |http|
         | 
| 24 | 
            +
                      headers = sign(method.upcase, path, body)
         | 
| 25 | 
            +
                      headers.each do |key, value|
         | 
| 26 | 
            +
                        http.headers[key] = value.chomp
         | 
| 27 | 
            +
                      end
         | 
| 26 28 |  | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 29 | 
            +
                      http.use_ssl = 3
         | 
| 30 | 
            +
                      http.ssl_verify_host = OpenSSL::SSL::VERIFY_PEER
         | 
| 31 | 
            +
                      http.cacert = File.absolute_path("./cacert.pem") if RbConfig::CONFIG['host_os'] == 'mingw32'
         | 
| 32 | 
            +
                    end
         | 
| 33 | 
            +
                  rescue Curl::Err::TimeoutError => e
         | 
| 34 | 
            +
                    raise Lenddo::Errors::TimeoutException.new(e.message)
         | 
| 35 | 
            +
                  rescue Curl::Err::HostResolutionError => e
         | 
| 36 | 
            +
                    raise Lenddo::Errors::HostResolutionError.new(e.message)
         | 
| 37 | 
            +
                  rescue => e
         | 
| 38 | 
            +
                    raise Lenddo::Errors::UnknownException.new(e.message)
         | 
| 30 39 | 
             
                  end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                  response
         | 
| 31 42 | 
             
                end
         | 
| 32 43 |  | 
| 33 44 | 
             
                private
         | 
| @@ -53,4 +64,4 @@ module Lenddo | |
| 53 64 | 
             
                  OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), key, value)
         | 
| 54 65 | 
             
                end
         | 
| 55 66 | 
             
              end
         | 
| 56 | 
            -
            end
         | 
| 67 | 
            +
            end
         | 
    
        data/lib/lenddo/configuration.rb
    CHANGED
    
    
    
        data/lib/lenddo/response.rb
    CHANGED
    
    | @@ -1,7 +1,16 @@ | |
| 1 | 
            +
            require 'lenddo/errors/exceptions'
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module Lenddo
         | 
| 2 4 | 
             
              class Response
         | 
| 3 5 | 
             
                def initialize(http_response)
         | 
| 4 6 | 
             
                  @http_response = http_response
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  http_code = http_response.response_code
         | 
| 9 | 
            +
                  if http_code == 500
         | 
| 10 | 
            +
                    raise Lenddo::Errors::InternalErrorException
         | 
| 11 | 
            +
                  elsif http_code > 500
         | 
| 12 | 
            +
                    raise Lenddo::Errors::UnknownException.new(http_response.status)
         | 
| 13 | 
            +
                  end
         | 
| 5 14 | 
             
                end
         | 
| 6 15 |  | 
| 7 16 | 
             
                def status
         | 
| @@ -13,7 +22,11 @@ module Lenddo | |
| 13 22 | 
             
                end
         | 
| 14 23 |  | 
| 15 24 | 
             
                def body
         | 
| 16 | 
            -
                   | 
| 25 | 
            +
                  begin
         | 
| 26 | 
            +
                    JSON.parse(@http_response.body)
         | 
| 27 | 
            +
                  rescue => e
         | 
| 28 | 
            +
                    raise Lenddo::Errors::UnknownException.new(e.message)
         | 
| 29 | 
            +
                  end
         | 
| 17 30 | 
             
                end
         | 
| 18 31 | 
             
              end
         | 
| 19 | 
            -
            end
         | 
| 32 | 
            +
            end
         | 
    
        data/lib/lenddo/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: lenddo
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2. | 
| 4 | 
            +
              version: 2.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - arjay salvadora
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018- | 
| 11 | 
            +
            date: 2018-04-13 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -102,6 +102,7 @@ files: | |
| 102 102 | 
             
            - lib/lenddo/authentication.rb
         | 
| 103 103 | 
             
            - lib/lenddo/configuration.rb
         | 
| 104 104 | 
             
            - lib/lenddo/errors/configuration.rb
         | 
| 105 | 
            +
            - lib/lenddo/errors/exceptions.rb
         | 
| 105 106 | 
             
            - lib/lenddo/network_service/self.rb
         | 
| 106 107 | 
             
            - lib/lenddo/response.rb
         | 
| 107 108 | 
             
            - lib/lenddo/score_service/self.rb
         |