Class: Inttegro::Request::PropertySelection
- Inherits:
-
T::Struct
- Object
- T::Struct
- Inttegro::Request::PropertySelection
- Extended by:
- T::Sig
- Defined in:
- lib/inttegro/request/property_selection.rb
Overview
Public properties to include in or exclude from one named response resource. Supply exactly
one of pick or omit.
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
-
#omit ⇒ Array<String>?
readonly
Exclude these property paths and all of their descendants.
-
#pick ⇒ Array<String>?
readonly
Include only these property paths and the ancestors needed to contain them.
Class Method Summary collapse
Instance Attribute Details
#omit ⇒ Array<String>? (readonly)
Exclude these property paths and all of their descendants.
Optional in the API payload; omitted values default to nil. Wire name: omit.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/inttegro/request/property_selection.rb', line 30 class PropertySelection < T::Struct const :pick, T.nilable(T::Array[String]), default: nil const :omit, T.nilable(T::Array[String]), default: nil extend T::Sig sig { params(paths: String).returns(T.attached_class) } def self.pick(*paths) validate_paths!("pick", paths) new(pick: paths) end sig { params(paths: String).returns(T.attached_class) } def self.omit(*paths) validate_paths!("omit", paths) new(omit: paths) end sig { params(mode: String, paths: T::Array[String]).void } private_class_method def self.validate_paths!(mode, paths) if paths.empty? || paths.any? { |path| path.strip.empty? } raise ArgumentError, "#{mode} must contain non-blank property paths" end end end |
#pick ⇒ Array<String>? (readonly)
Include only these property paths and the ancestors needed to contain them.
Optional in the API payload; omitted values default to nil. Wire name: pick.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/inttegro/request/property_selection.rb', line 30 class PropertySelection < T::Struct const :pick, T.nilable(T::Array[String]), default: nil const :omit, T.nilable(T::Array[String]), default: nil extend T::Sig sig { params(paths: String).returns(T.attached_class) } def self.pick(*paths) validate_paths!("pick", paths) new(pick: paths) end sig { params(paths: String).returns(T.attached_class) } def self.omit(*paths) validate_paths!("omit", paths) new(omit: paths) end sig { params(mode: String, paths: T::Array[String]).void } private_class_method def self.validate_paths!(mode, paths) if paths.empty? || paths.any? { |path| path.strip.empty? } raise ArgumentError, "#{mode} must contain non-blank property paths" end end end |
Class Method Details
.omit(*paths) ⇒ Object
43 44 45 46 |
# File 'lib/inttegro/request/property_selection.rb', line 43 def self.omit(*paths) validate_paths!("omit", paths) new(omit: paths) end |
.pick(*paths) ⇒ Object
37 38 39 40 |
# File 'lib/inttegro/request/property_selection.rb', line 37 def self.pick(*paths) validate_paths!("pick", paths) new(pick: paths) end |