Sha256: 6295be268761a09d75aee707c8868ea8da249e015e23b16e2e72d32d1aa22c80

Contents?: true

Size: 496 Bytes

Versions: 3

Compression:

Stored size: 496 Bytes

Contents

module Sumsub
  class Parser
    def self.parse(json_payload)
      payload = JSON.parse(json_payload)

      # return unless is an error response
      return payload unless (payload['code'] && payload['description'])

      Sumsub::Struct::ErrorResponse.new(
        description: payload['description'],
        code: payload['code'],
        correlation_id: payload['correlationId'],
        error_code: payload['errorCode'],
        error_name: payload['errorName']
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sumsub-ruby-sdk-0.1.3 lib/sumsub/parser.rb
sumsub-ruby-sdk-0.1.2 lib/sumsub/parser.rb
sumsub-ruby-sdk-0.1.1 lib/sumsub/parser.rb