Class: Inttegro::Application::CapabilitiesResponseCapabilities

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

Overview

Typed representation of the capabilities response capabilities 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

#payments ⇒ Inttegro::Application::EnabledCapability, Inttegro::Application::RestrictedCapability (readonly)

Value of the payments field in the Inttegro API payload.

Required in the API payload. Wire name: payments.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/inttegro/app/capabilities_response_capabilities.rb', line 32

class CapabilitiesResponseCapabilities < T::Struct
  const :payments, T.any(Inttegro::Application::EnabledCapability, Inttegro::Application::RestrictedCapability)
  const :payouts, T.any(Inttegro::Application::EnabledCapability, Inttegro::Application::RestrictedCapability, Inttegro::Application::PendingReviewCapability)

  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 (payments_value = data["payments"]).is_a?(Hash)
      data["payments"] = case payments_value["status"]
      when "enabled"
        Inttegro::Application::EnabledCapability.from_hash(payments_value)
      when "restricted"
        Inttegro::Application::RestrictedCapability.from_hash(payments_value)
      else
        payments_value
      end
    end
    if (payouts_value = data["payouts"]).is_a?(Hash)
      data["payouts"] = case payouts_value["status"]
      when "enabled"
        Inttegro::Application::EnabledCapability.from_hash(payouts_value)
      when "restricted"
        Inttegro::Application::RestrictedCapability.from_hash(payouts_value)
      when "pending_review"
        Inttegro::Application::PendingReviewCapability.from_hash(payouts_value)
      else
        payouts_value
      end
    end
    super(data, strict)
  end
end

#payouts ⇒ Inttegro::Application::EnabledCapability, ... (readonly)

Value of the payouts field in the Inttegro API payload.

Required in the API payload. Wire name: payouts.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/inttegro/app/capabilities_response_capabilities.rb', line 32

class CapabilitiesResponseCapabilities < T::Struct
  const :payments, T.any(Inttegro::Application::EnabledCapability, Inttegro::Application::RestrictedCapability)
  const :payouts, T.any(Inttegro::Application::EnabledCapability, Inttegro::Application::RestrictedCapability, Inttegro::Application::PendingReviewCapability)

  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 (payments_value = data["payments"]).is_a?(Hash)
      data["payments"] = case payments_value["status"]
      when "enabled"
        Inttegro::Application::EnabledCapability.from_hash(payments_value)
      when "restricted"
        Inttegro::Application::RestrictedCapability.from_hash(payments_value)
      else
        payments_value
      end
    end
    if (payouts_value = data["payouts"]).is_a?(Hash)
      data["payouts"] = case payouts_value["status"]
      when "enabled"
        Inttegro::Application::EnabledCapability.from_hash(payouts_value)
      when "restricted"
        Inttegro::Application::RestrictedCapability.from_hash(payouts_value)
      when "pending_review"
        Inttegro::Application::PendingReviewCapability.from_hash(payouts_value)
      else
        payouts_value
      end
    end
    super(data, strict)
  end
end

Class Method Details

.from_hash(hash, strict = false) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/inttegro/app/capabilities_response_capabilities.rb', line 39

def self.from_hash(hash, strict = false)
  data = hash.dup
  if (payments_value = data["payments"]).is_a?(Hash)
    data["payments"] = case payments_value["status"]
    when "enabled"
      Inttegro::Application::EnabledCapability.from_hash(payments_value)
    when "restricted"
      Inttegro::Application::RestrictedCapability.from_hash(payments_value)
    else
      payments_value
    end
  end
  if (payouts_value = data["payouts"]).is_a?(Hash)
    data["payouts"] = case payouts_value["status"]
    when "enabled"
      Inttegro::Application::EnabledCapability.from_hash(payouts_value)
    when "restricted"
      Inttegro::Application::RestrictedCapability.from_hash(payouts_value)
    when "pending_review"
      Inttegro::Application::PendingReviewCapability.from_hash(payouts_value)
    else
      payouts_value
    end
  end
  super(data, strict)
end