Class: Merge::Accounting::FieldMappingApiInstance
- Inherits:
-
Object
- Object
- Merge::Accounting::FieldMappingApiInstance
- Defined in:
- lib/merge_ruby_client/accounting/types/field_mapping_api_instance.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #id ⇒ String readonly
- #is_integration_wide ⇒ Boolean readonly
- #remote_field ⇒ Merge::Accounting::FieldMappingApiInstanceRemoteField readonly
- #target_field ⇒ Merge::Accounting::FieldMappingApiInstanceTargetField readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Accounting::FieldMappingApiInstance
Deserialize a JSON object to an instance of FieldMappingApiInstance.
-
.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(id: OMIT, is_integration_wide: OMIT, target_field: OMIT, remote_field: OMIT, additional_properties: nil) ⇒ Merge::Accounting::FieldMappingApiInstance constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of FieldMappingApiInstance to a JSON object.
Constructor Details
#initialize(id: OMIT, is_integration_wide: OMIT, target_field: OMIT, remote_field: OMIT, additional_properties: nil) ⇒ Merge::Accounting::FieldMappingApiInstance
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/merge_ruby_client/accounting/types/field_mapping_api_instance.rb', line 33 def initialize(id: OMIT, is_integration_wide: OMIT, target_field: OMIT, remote_field: OMIT, additional_properties: nil) @id = id if id != OMIT @is_integration_wide = is_integration_wide if is_integration_wide != OMIT @target_field = target_field if target_field != OMIT @remote_field = remote_field if remote_field != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "is_integration_wide": is_integration_wide, "target_field": target_field, "remote_field": remote_field }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
20 21 22 |
# File 'lib/merge_ruby_client/accounting/types/field_mapping_api_instance.rb', line 20 def additional_properties @additional_properties end |
#id ⇒ String (readonly)
12 13 14 |
# File 'lib/merge_ruby_client/accounting/types/field_mapping_api_instance.rb', line 12 def id @id end |
#is_integration_wide ⇒ Boolean (readonly)
14 15 16 |
# File 'lib/merge_ruby_client/accounting/types/field_mapping_api_instance.rb', line 14 def is_integration_wide @is_integration_wide end |
#remote_field ⇒ Merge::Accounting::FieldMappingApiInstanceRemoteField (readonly)
18 19 20 |
# File 'lib/merge_ruby_client/accounting/types/field_mapping_api_instance.rb', line 18 def remote_field @remote_field end |
#target_field ⇒ Merge::Accounting::FieldMappingApiInstanceTargetField (readonly)
16 17 18 |
# File 'lib/merge_ruby_client/accounting/types/field_mapping_api_instance.rb', line 16 def target_field @target_field end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Accounting::FieldMappingApiInstance
Deserialize a JSON object to an instance of FieldMappingApiInstance
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/merge_ruby_client/accounting/types/field_mapping_api_instance.rb', line 54 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] is_integration_wide = parsed_json["is_integration_wide"] if parsed_json["target_field"].nil? target_field = nil else target_field = parsed_json["target_field"].to_json target_field = Merge::Accounting::FieldMappingApiInstanceTargetField.from_json(json_object: target_field) end if parsed_json["remote_field"].nil? remote_field = nil else remote_field = parsed_json["remote_field"].to_json remote_field = Merge::Accounting::FieldMappingApiInstanceRemoteField.from_json(json_object: remote_field) end new( id: id, is_integration_wide: is_integration_wide, target_field: target_field, remote_field: remote_field, 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.
93 94 95 96 97 98 |
# File 'lib/merge_ruby_client/accounting/types/field_mapping_api_instance.rb', line 93 def self.validate_raw(obj:) obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.is_integration_wide&.is_a?(Boolean) != false || raise("Passed value for field obj.is_integration_wide is not the expected type, validation failed.") obj.target_field.nil? || Merge::Accounting::FieldMappingApiInstanceTargetField.validate_raw(obj: obj.target_field) obj.remote_field.nil? || Merge::Accounting::FieldMappingApiInstanceRemoteField.validate_raw(obj: obj.remote_field) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of FieldMappingApiInstance to a JSON object
83 84 85 |
# File 'lib/merge_ruby_client/accounting/types/field_mapping_api_instance.rb', line 83 def to_json(*_args) @_field_set&.to_json end |