Class: Merge::Crm::AssociationSubType
- Inherits:
-
Object
- Object
- Merge::Crm::AssociationSubType
- Defined in:
- lib/merge_ruby_client/crm/types/association_sub_type.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#created_at ⇒ DateTime
readonly
The datetime that this object was created by Merge.
- #id ⇒ String readonly
-
#modified_at ⇒ DateTime
readonly
The datetime that this object was modified by Merge.
- #origin_type ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Crm::AssociationSubType
Deserialize a JSON object to an instance of AssociationSubType.
-
.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, created_at: OMIT, modified_at: OMIT, origin_type: OMIT, additional_properties: nil) ⇒ Merge::Crm::AssociationSubType constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AssociationSubType to a JSON object.
Constructor Details
#initialize(id: OMIT, created_at: OMIT, modified_at: OMIT, origin_type: OMIT, additional_properties: nil) ⇒ Merge::Crm::AssociationSubType
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/merge_ruby_client/crm/types/association_sub_type.rb', line 32 def initialize(id: OMIT, created_at: OMIT, modified_at: OMIT, origin_type: OMIT, additional_properties: nil) @id = id if id != OMIT @created_at = created_at if created_at != OMIT @modified_at = modified_at if modified_at != OMIT @origin_type = origin_type if origin_type != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "created_at": created_at, "modified_at": modified_at, "origin_type": origin_type }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/merge_ruby_client/crm/types/association_sub_type.rb', line 19 def additional_properties @additional_properties end |
#created_at ⇒ DateTime (readonly)
Returns The datetime that this object was created by Merge.
13 14 15 |
# File 'lib/merge_ruby_client/crm/types/association_sub_type.rb', line 13 def created_at @created_at end |
#id ⇒ String (readonly)
11 12 13 |
# File 'lib/merge_ruby_client/crm/types/association_sub_type.rb', line 11 def id @id end |
#modified_at ⇒ DateTime (readonly)
Returns The datetime that this object was modified by Merge.
15 16 17 |
# File 'lib/merge_ruby_client/crm/types/association_sub_type.rb', line 15 def modified_at @modified_at end |
#origin_type ⇒ String (readonly)
17 18 19 |
# File 'lib/merge_ruby_client/crm/types/association_sub_type.rb', line 17 def origin_type @origin_type end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Crm::AssociationSubType
Deserialize a JSON object to an instance of AssociationSubType
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/merge_ruby_client/crm/types/association_sub_type.rb', line 52 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] created_at = (DateTime.parse(parsed_json["created_at"]) unless parsed_json["created_at"].nil?) modified_at = (DateTime.parse(parsed_json["modified_at"]) unless parsed_json["modified_at"].nil?) origin_type = parsed_json["origin_type"] new( id: id, created_at: created_at, modified_at: modified_at, origin_type: origin_type, 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.
81 82 83 84 85 86 |
# File 'lib/merge_ruby_client/crm/types/association_sub_type.rb', line 81 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.created_at&.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.modified_at&.is_a?(DateTime) != false || raise("Passed value for field obj.modified_at is not the expected type, validation failed.") obj.origin_type&.is_a?(String) != false || raise("Passed value for field obj.origin_type is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of AssociationSubType to a JSON object
71 72 73 |
# File 'lib/merge_ruby_client/crm/types/association_sub_type.rb', line 71 def to_json(*_args) @_field_set&.to_json end |