Sha256: d6f0191d727da1a8ce0312f94408f08477b944990c1f1d0a1353e00815e96259

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require 'json'

module BayonetClient

  class BayonetResponse
    attr_accessor :feedback_api_trans_code, :rules_triggered,
                  :risk_level, :payload, :reason_code,
                  :reason_message, :request_body

    def initialize(parsed_response)

      if parsed_response.key?('feedback_api_trans_code')
        self.feedback_api_trans_code = parsed_response['feedback_api_trans_code']
      end
      if parsed_response.key?('rules_triggered')
        self.rules_triggered = parsed_response['rules_triggered']
      end
      if parsed_response.key?('risk_level')
        self.risk_level = parsed_response['risk_level']
      end
      if parsed_response.key?('payload')
        self.payload = parsed_response['payload']
      end
      if parsed_response.key?('reason_code')
        self.reason_code = parsed_response['reason_code']
      end
      if parsed_response.key?('reason_message')
        self.reason_message = parsed_response['reason_message']
      end
      if parsed_response.key?('request_body')
        self.request_body = parsed_response['request_body']
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bayonet_client-1.0.0 lib/bayonet_client/response.rb
bayonet_client-0.1.0 lib/bayonet_client/response.rb