bayonet_client 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/LICENSE.txt +1 -1
- data/lib/bayonet_client/exceptions.rb +4 -1
- data/lib/bayonet_client/response.rb +6 -1
- data/lib/bayonet_client/version.rb +1 -1
- data/lib/bayonet_client.rb +10 -2
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d9dc8054d56b32cbc00ebffb3b7755184dde57cd
         | 
| 4 | 
            +
              data.tar.gz: ef8f64fbae12dc12c17530e70f344f44569a369e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 1abdb5c3177ea521344bc8011a47edcb2f24470e1c1969ddacc89f0a71303568431b658f74ad823b346c4eeb0a2607929213272972519025623d293f7a226b9c
         | 
| 7 | 
            +
              data.tar.gz: d0d6b3a7f853e30bc905a8a5026bec26089ebec696b06fb0be21e25e391e6ed2dcc80f0776304d823d7712ed6821aa36703af3b4522ce7594b4192a9cdc009d2
         | 
    
        data/LICENSE.txt
    CHANGED
    
    
| @@ -4,7 +4,7 @@ module BayonetClient | |
| 4 4 |  | 
| 5 5 | 
             
              class BayonetError < Exception
         | 
| 6 6 | 
             
                attr_accessor :request_body, :request_headers, :http_response_code, :http_response_json,
         | 
| 7 | 
            -
                              :reason_code, :reason_message
         | 
| 7 | 
            +
                              :reason_code, :reason_message, :status
         | 
| 8 8 |  | 
| 9 9 | 
             
                def initialize(request_body, request_headers,
         | 
| 10 10 | 
             
                               http_response_code, http_response_json)
         | 
| @@ -22,6 +22,9 @@ module BayonetClient | |
| 22 22 | 
             
                  else
         | 
| 23 23 | 
             
                    self.reason_message = http_response_json
         | 
| 24 24 | 
             
                  end
         | 
| 25 | 
            +
                  if http_response_json.class == HTTParty::Response && http_response_json.key?('status')
         | 
| 26 | 
            +
                    self.status = http_response_json['status']
         | 
| 27 | 
            +
                  end
         | 
| 25 28 | 
             
                end
         | 
| 26 29 | 
             
              end
         | 
| 27 30 |  | 
| @@ -5,7 +5,8 @@ module BayonetClient | |
| 5 5 | 
             
              class BayonetResponse
         | 
| 6 6 | 
             
                attr_accessor :feedback_api_trans_code, :rules_triggered,
         | 
| 7 7 | 
             
                              :risk_level, :payload, :reason_code,
         | 
| 8 | 
            -
                              :reason_message, :request_body
         | 
| 8 | 
            +
                              :reason_message, :request_body, :bayonet_fingerprint,
         | 
| 9 | 
            +
                              :raw
         | 
| 9 10 |  | 
| 10 11 | 
             
                def initialize(parsed_response)
         | 
| 11 12 |  | 
| @@ -30,6 +31,10 @@ module BayonetClient | |
| 30 31 | 
             
                  if parsed_response.key?('request_body')
         | 
| 31 32 | 
             
                    self.request_body = parsed_response['request_body']
         | 
| 32 33 | 
             
                  end
         | 
| 34 | 
            +
                  if parsed_response.key?('bayonet_fingerprint')
         | 
| 35 | 
            +
                    self.bayonet_fingerprint = parsed_response['bayonet_fingerprint']
         | 
| 36 | 
            +
                  end
         | 
| 37 | 
            +
                  self.raw = parsed_response
         | 
| 33 38 | 
             
                end
         | 
| 34 39 | 
             
              end
         | 
| 35 40 | 
             
            end
         | 
    
        data/lib/bayonet_client.rb
    CHANGED
    
    | @@ -40,6 +40,11 @@ module BayonetClient | |
| 40 40 | 
             
                  request('/feedback-historical', serialized)
         | 
| 41 41 | 
             
                end
         | 
| 42 42 |  | 
| 43 | 
            +
                def get_fingerprint_data(params)
         | 
| 44 | 
            +
                  serialized = json_from_params(params)
         | 
| 45 | 
            +
                  request('/get-fingerprint-data', serialized)
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
             | 
| 43 48 | 
             
                def validate_params(params)
         | 
| 44 49 | 
             
                  params.class == Hash
         | 
| 45 50 | 
             
                end
         | 
| @@ -55,7 +60,7 @@ module BayonetClient | |
| 55 60 | 
             
                end
         | 
| 56 61 |  | 
| 57 62 | 
             
                def request_json_string(route, request_json_args)
         | 
| 58 | 
            -
                  fq_hostname = fully_qualified_api_host_name
         | 
| 63 | 
            +
                  fq_hostname = fully_qualified_api_host_name(route)
         | 
| 59 64 | 
             
                  url = "#{fq_hostname}#{route}"
         | 
| 60 65 |  | 
| 61 66 | 
             
                  headers = {'User-Agent' => 'OfficialBayonetRubySDK',
         | 
| @@ -71,8 +76,11 @@ module BayonetClient | |
| 71 76 | 
             
                  end
         | 
| 72 77 | 
             
                end
         | 
| 73 78 |  | 
| 74 | 
            -
                def fully_qualified_api_host_name
         | 
| 79 | 
            +
                def fully_qualified_api_host_name(route)
         | 
| 75 80 | 
             
                  default_domain = 'api.bayonet.io'
         | 
| 81 | 
            +
                  if route == '/get-fingerprint-data'
         | 
| 82 | 
            +
                    default_domain = 'fingerprinting.bayonet.io'
         | 
| 83 | 
            +
                  end
         | 
| 76 84 | 
             
                  api_version_namespace = 'v' + @version
         | 
| 77 85 | 
             
                  "https://#{default_domain}/#{api_version_namespace}"
         | 
| 78 86 | 
             
                end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: bayonet_client
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Bayonet
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017- | 
| 11 | 
            +
            date: 2017-06-05 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: httparty
         | 
| @@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 92 92 | 
             
                  version: '0'
         | 
| 93 93 | 
             
            requirements: []
         | 
| 94 94 | 
             
            rubyforge_project: 
         | 
| 95 | 
            -
            rubygems_version: 2. | 
| 95 | 
            +
            rubygems_version: 2.6.12
         | 
| 96 96 | 
             
            signing_key: 
         | 
| 97 97 | 
             
            specification_version: 4
         | 
| 98 98 | 
             
            summary: Bayonet Ruby API Gem
         |