Class: Merge::Accounting::IndividualCommonModelScopeDeserializerRequest
- Inherits:
-
Object
- Object
- Merge::Accounting::IndividualCommonModelScopeDeserializerRequest
- Defined in:
- lib/merge_ruby_client/accounting/types/individual_common_model_scope_deserializer_request.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::Accounting::FieldPermissionDeserializerRequest readonly
- #model_name ⇒ String readonly
- #model_permissions ⇒ Hash{String => Merge::Accounting::ModelPermissionDeserializerRequest} readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Accounting::IndividualCommonModelScopeDeserializerRequest
Deserialize a JSON object to an instance of IndividualCommonModelScopeDeserializerRequest.
-
.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::Accounting::IndividualCommonModelScopeDeserializerRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of IndividualCommonModelScopeDeserializerRequest to a JSON object.
Constructor Details
#initialize(model_name:, model_permissions: OMIT, field_permissions: OMIT, additional_properties: nil) ⇒ Merge::Accounting::IndividualCommonModelScopeDeserializerRequest
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/merge_ruby_client/accounting/types/individual_common_model_scope_deserializer_request.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/accounting/types/individual_common_model_scope_deserializer_request.rb', line 17 def additional_properties @additional_properties end |
#field_permissions ⇒ Merge::Accounting::FieldPermissionDeserializerRequest (readonly)
15 16 17 |
# File 'lib/merge_ruby_client/accounting/types/individual_common_model_scope_deserializer_request.rb', line 15 def @field_permissions end |
#model_name ⇒ String (readonly)
11 12 13 |
# File 'lib/merge_ruby_client/accounting/types/individual_common_model_scope_deserializer_request.rb', line 11 def model_name @model_name end |
#model_permissions ⇒ Hash{String => Merge::Accounting::ModelPermissionDeserializerRequest} (readonly)
13 14 15 |
# File 'lib/merge_ruby_client/accounting/types/individual_common_model_scope_deserializer_request.rb', line 13 def @model_permissions end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Accounting::IndividualCommonModelScopeDeserializerRequest
Deserialize a JSON object to an instance of
IndividualCommonModelScopeDeserializerRequest
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/accounting/types/individual_common_model_scope_deserializer_request.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::Accounting::ModelPermissionDeserializerRequest.from_json(json_object: value) end if parsed_json["field_permissions"].nil? = nil else = parsed_json["field_permissions"].to_json = Merge::Accounting::FieldPermissionDeserializerRequest.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.
84 85 86 87 88 |
# File 'lib/merge_ruby_client/accounting/types/individual_common_model_scope_deserializer_request.rb', line 84 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::Accounting::FieldPermissionDeserializerRequest.validate_raw(obj: obj.) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of IndividualCommonModelScopeDeserializerRequest to a JSON
object
74 75 76 |
# File 'lib/merge_ruby_client/accounting/types/individual_common_model_scope_deserializer_request.rb', line 74 def to_json(*_args) @_field_set&.to_json end |