Class: Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelope

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/inttegro/payout/settings_policy_unavailable_error_envelope.rb

Overview

Typed representation of the settings policy unavailable error envelope object in the Inttegro API.

This generated model is immutable. Construct it with .new, or decode a string-keyed API payload with .from_hash. #serialize produces a string-keyed hash using the original wire field names and serialized enum values.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#error ⇒ Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelopeErrorVariant1, ... (readonly)

Value of the error field in the Inttegro API payload.

Required in the API payload. Wire name: error.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/inttegro/payout/settings_policy_unavailable_error_envelope.rb', line 28

class SettingsPolicyUnavailableErrorEnvelope < T::Struct
  const :error, T.any(Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelopeErrorVariant1, Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelopeErrorVariant2, Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelopeErrorVariant3, Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelopeErrorVariant4)

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (error_value = data["error"]).is_a?(Hash)
      data["error"] = case error_value["code"]
      when "idempotency_storage_unavailable"
        Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelopeErrorVariant1.from_hash(error_value)
      when "idempotency_key_generation_failed"
        Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelopeErrorVariant2.from_hash(error_value)
      when "payout_policy_unavailable"
        Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelopeErrorVariant3.from_hash(error_value)
      when "endpoint_unavailable"
        Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelopeErrorVariant4.from_hash(error_value)
      else
        error_value
      end
    end
    super(data, strict)
  end
end

Class Method Details

.from_hash(hash, strict = false) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/inttegro/payout/settings_policy_unavailable_error_envelope.rb', line 34

def self.from_hash(hash, strict = false)
  data = hash.dup
  if (error_value = data["error"]).is_a?(Hash)
    data["error"] = case error_value["code"]
    when "idempotency_storage_unavailable"
      Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelopeErrorVariant1.from_hash(error_value)
    when "idempotency_key_generation_failed"
      Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelopeErrorVariant2.from_hash(error_value)
    when "payout_policy_unavailable"
      Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelopeErrorVariant3.from_hash(error_value)
    when "endpoint_unavailable"
      Inttegro::Payout::SettingsPolicyUnavailableErrorEnvelopeErrorVariant4.from_hash(error_value)
    else
      error_value
    end
  end
  super(data, strict)
end