Class: Merge::Ats::IndividualCommonModelScopeDeserializer
- Inherits:
-
Object
- Object
- Merge::Ats::IndividualCommonModelScopeDeserializer
- Defined in:
- lib/merge_ruby_client/ats/types/individual_common_model_scope_deserializer.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #field_permissions ⇒ Merge::Ats::FieldPermissionDeserializer readonly
- #model_name ⇒ String readonly
- #model_permissions ⇒ Hash{String => Merge::Ats::ModelPermissionDeserializer} readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Ats::IndividualCommonModelScopeDeserializer
Deserialize a JSON object to an instance of IndividualCommonModelScopeDeserializer.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(model_name:, model_permissions: OMIT, field_permissions: OMIT, additional_properties: nil) ⇒ Merge::Ats::IndividualCommonModelScopeDeserializer constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of IndividualCommonModelScopeDeserializer to a JSON object.
Constructor Details
#initialize(model_name:, model_permissions: OMIT, field_permissions: OMIT, additional_properties: nil) ⇒ Merge::Ats::IndividualCommonModelScopeDeserializer
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/merge_ruby_client/ats/types/individual_common_model_scope_deserializer.rb', line 29 def initialize(model_name:, model_permissions: OMIT, field_permissions: OMIT, additional_properties: nil) @model_name = model_name @model_permissions = if != OMIT @field_permissions = if != OMIT @additional_properties = additional_properties @_field_set = { "model_name": model_name, "model_permissions": , "field_permissions": }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/merge_ruby_client/ats/types/individual_common_model_scope_deserializer.rb', line 17 def additional_properties @additional_properties end |
#field_permissions ⇒ Merge::Ats::FieldPermissionDeserializer (readonly)
15 16 17 |
# File 'lib/merge_ruby_client/ats/types/individual_common_model_scope_deserializer.rb', line 15 def @field_permissions end |
#model_name ⇒ String (readonly)
11 12 13 |
# File 'lib/merge_ruby_client/ats/types/individual_common_model_scope_deserializer.rb', line 11 def model_name @model_name end |
#model_permissions ⇒ Hash{String => Merge::Ats::ModelPermissionDeserializer} (readonly)
13 14 15 |
# File 'lib/merge_ruby_client/ats/types/individual_common_model_scope_deserializer.rb', line 13 def @model_permissions end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Ats::IndividualCommonModelScopeDeserializer
Deserialize a JSON object to an instance of
IndividualCommonModelScopeDeserializer
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/merge_ruby_client/ats/types/individual_common_model_scope_deserializer.rb', line 48 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) model_name = parsed_json["model_name"] = parsed_json["model_permissions"]&.transform_values do |value| value = value.to_json Merge::Ats::ModelPermissionDeserializer.from_json(json_object: value) end if parsed_json["field_permissions"].nil? = nil else = parsed_json["field_permissions"].to_json = Merge::Ats::FieldPermissionDeserializer.from_json(json_object: ) end new( model_name: model_name, model_permissions: , field_permissions: , additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
83 84 85 86 87 |
# File 'lib/merge_ruby_client/ats/types/individual_common_model_scope_deserializer.rb', line 83 def self.validate_raw(obj:) obj.model_name.is_a?(String) != false || raise("Passed value for field obj.model_name is not the expected type, validation failed.") obj.&.is_a?(Hash) != false || raise("Passed value for field obj.model_permissions is not the expected type, validation failed.") obj..nil? || Merge::Ats::FieldPermissionDeserializer.validate_raw(obj: obj.) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of IndividualCommonModelScopeDeserializer to a JSON object
73 74 75 |
# File 'lib/merge_ruby_client/ats/types/individual_common_model_scope_deserializer.rb', line 73 def to_json(*_args) @_field_set&.to_json end |