Sha256: 2259a94fd538f2d2a73b5bbce84821c966da2f1b110cac9ad6d3c6397789c9fd

Contents?: true

Size: 527 Bytes

Versions: 2

Compression:

Stored size: 527 Bytes

Contents

# frozen_string_literal: true

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

2 entries across 2 versions & 1 rubygems

Version Path
sumsub-ruby-sdk-0.2.1 lib/sumsub/parser.rb
sumsub-ruby-sdk-0.2.0 lib/sumsub/parser.rb