class Od::Payments::OdPaymentsError

Attributes

code[R]
error[R]
http_body[R]
http_headers[R]
http_status[R]
json_body[R]
message[R]
request_id[R]
response[RW]

Public Class Methods

new(message = nil, http_status: nil, http_body: nil, json_body: nil, http_headers: nil, code: nil) click to toggle source

Initializes a StripeError.

# File lib/od/payments/errors.rb, line 16
def initialize(message = nil, http_status: nil, http_body: nil,
               json_body: nil, http_headers: nil, code: nil)
  @message = message
  @http_status = http_status
  @http_body = http_body
  @http_headers = http_headers || {}
  @idempotent_replayed = @http_headers['idempotent-replayed'] == 'true'
  @json_body = json_body
  @code = code
  @request_id = @http_headers['request-id']
  @error = construct_error_object
end

Public Instance Methods

construct_error_object() click to toggle source
# File lib/od/payments/errors.rb, line 29
def construct_error_object
  return nil if @json_body.nil? || !@json_body.key?(:error)

  ErrorObject.construct_from(@json_body[:error])
end
idempotent_replayed?() click to toggle source
# File lib/od/payments/errors.rb, line 35
def idempotent_replayed?
  @idempotent_replayed
end
to_s() click to toggle source
# File lib/od/payments/errors.rb, line 39
def to_s
  status_string = @http_status.nil? ? '' : "(Status #{@http_status}) "
  id_string = @request_id.nil? ? '' : "(Request #{@request_id}) "
  "#{status_string}#{id_string}#{@message}"
end