Class: Inttegro::Application::OperatingPolicy

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

Overview

Immutable operating policy snapshot applied to the application.

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

#capabilities ⇒ Inttegro::Shared::OperatingPolicyCapabilities (readonly)

Value of the capabilities field in the Inttegro API payload.

Required in the API payload. Wire name: capabilities.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/inttegro/app/operating_policy.rb', line 32

class OperatingPolicy < T::Struct
  const :capabilities, Inttegro::Shared::OperatingPolicyCapabilities
  const :source, T.any(Inttegro::Shared::InlineOperatingPolicySource, Inttegro::Shared::TemplateOperatingPolicySource)

  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 (source_value = data["source"]).is_a?(Hash)
      data["source"] = case source_value["type"]
      when "inline"
        Inttegro::Shared::InlineOperatingPolicySource.from_hash(source_value)
      when "template"
        Inttegro::Shared::TemplateOperatingPolicySource.from_hash(source_value)
      else
        source_value
      end
    end
    super(data, strict)
  end
end

#source ⇒ Inttegro::Shared::InlineOperatingPolicySource, Inttegro::Shared::TemplateOperatingPolicySource (readonly)

Value of the source field in the Inttegro API payload.

Required in the API payload. Wire name: source.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/inttegro/app/operating_policy.rb', line 32

class OperatingPolicy < T::Struct
  const :capabilities, Inttegro::Shared::OperatingPolicyCapabilities
  const :source, T.any(Inttegro::Shared::InlineOperatingPolicySource, Inttegro::Shared::TemplateOperatingPolicySource)

  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 (source_value = data["source"]).is_a?(Hash)
      data["source"] = case source_value["type"]
      when "inline"
        Inttegro::Shared::InlineOperatingPolicySource.from_hash(source_value)
      when "template"
        Inttegro::Shared::TemplateOperatingPolicySource.from_hash(source_value)
      else
        source_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
# File 'lib/inttegro/app/operating_policy.rb', line 39

def self.from_hash(hash, strict = false)
  data = hash.dup
  if (source_value = data["source"]).is_a?(Hash)
    data["source"] = case source_value["type"]
    when "inline"
      Inttegro::Shared::InlineOperatingPolicySource.from_hash(source_value)
    when "template"
      Inttegro::Shared::TemplateOperatingPolicySource.from_hash(source_value)
    else
      source_value
    end
  end
  super(data, strict)
end