Class: Merge::Crm::NoteRequest
- Inherits:
-
Object
- Object
- Merge::Crm::NoteRequest
- Defined in:
- lib/merge_ruby_client/crm/types/note_request.rb
Overview
# The Note Object
### Description
The `Note` object is used to represent a note on another object.
### Usage Example
TODO
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#account ⇒ Merge::Crm::NoteRequestAccount
readonly
The note’s account.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#contact ⇒ Merge::Crm::NoteRequestContact
readonly
The note’s contact.
-
#content ⇒ String
readonly
The note’s content.
- #integration_params ⇒ Hash{String => Object} readonly
- #linked_account_params ⇒ Hash{String => Object} readonly
-
#opportunity ⇒ Merge::Crm::NoteRequestOpportunity
readonly
The note’s opportunity.
-
#owner ⇒ Merge::Crm::NoteRequestOwner
readonly
The note’s owner.
- #remote_fields ⇒ Array<Merge::Crm::RemoteFieldRequest> readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Crm::NoteRequest
Deserialize a JSON object to an instance of NoteRequest.
-
.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(owner: OMIT, content: OMIT, contact: OMIT, account: OMIT, opportunity: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil) ⇒ Merge::Crm::NoteRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of NoteRequest to a JSON object.
Constructor Details
#initialize(owner: OMIT, content: OMIT, contact: OMIT, account: OMIT, opportunity: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil) ⇒ Merge::Crm::NoteRequest
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 53 def initialize(owner: OMIT, content: OMIT, contact: OMIT, account: OMIT, opportunity: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil) @owner = owner if owner != OMIT @content = content if content != OMIT @contact = contact if contact != OMIT @account = account if account != OMIT @opportunity = opportunity if opportunity != OMIT @integration_params = integration_params if integration_params != OMIT @linked_account_params = linked_account_params if linked_account_params != OMIT @remote_fields = remote_fields if remote_fields != OMIT @additional_properties = additional_properties @_field_set = { "owner": owner, "content": content, "contact": contact, "account": account, "opportunity": opportunity, "integration_params": integration_params, "linked_account_params": linked_account_params, "remote_fields": remote_fields }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#account ⇒ Merge::Crm::NoteRequestAccount (readonly)
Returns The note’s account.
26 27 28 |
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 26 def account @account end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
36 37 38 |
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 36 def additional_properties @additional_properties end |
#contact ⇒ Merge::Crm::NoteRequestContact (readonly)
Returns The note’s contact.
24 25 26 |
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 24 def contact @contact end |
#content ⇒ String (readonly)
Returns The note’s content.
22 23 24 |
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 22 def content @content end |
#integration_params ⇒ Hash{String => Object} (readonly)
30 31 32 |
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 30 def integration_params @integration_params end |
#linked_account_params ⇒ Hash{String => Object} (readonly)
32 33 34 |
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 32 def linked_account_params @linked_account_params end |
#opportunity ⇒ Merge::Crm::NoteRequestOpportunity (readonly)
Returns The note’s opportunity.
28 29 30 |
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 28 def opportunity @opportunity end |
#owner ⇒ Merge::Crm::NoteRequestOwner (readonly)
Returns The note’s owner.
20 21 22 |
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 20 def owner @owner end |
#remote_fields ⇒ Array<Merge::Crm::RemoteFieldRequest> (readonly)
34 35 36 |
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 34 def remote_fields @remote_fields end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Crm::NoteRequest
Deserialize a JSON object to an instance of NoteRequest
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 82 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["owner"].nil? owner = nil else owner = parsed_json["owner"].to_json owner = Merge::Crm::NoteRequestOwner.from_json(json_object: owner) end content = parsed_json["content"] if parsed_json["contact"].nil? contact = nil else contact = parsed_json["contact"].to_json contact = Merge::Crm::NoteRequestContact.from_json(json_object: contact) end if parsed_json["account"].nil? account = nil else account = parsed_json["account"].to_json account = Merge::Crm::NoteRequestAccount.from_json(json_object: account) end if parsed_json["opportunity"].nil? opportunity = nil else opportunity = parsed_json["opportunity"].to_json opportunity = Merge::Crm::NoteRequestOpportunity.from_json(json_object: opportunity) end integration_params = parsed_json["integration_params"] linked_account_params = parsed_json["linked_account_params"] remote_fields = parsed_json["remote_fields"]&.map do |item| item = item.to_json Merge::Crm::RemoteFieldRequest.from_json(json_object: item) end new( owner: owner, content: content, contact: contact, account: account, opportunity: opportunity, integration_params: integration_params, linked_account_params: linked_account_params, remote_fields: remote_fields, 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.
142 143 144 145 146 147 148 149 150 151 |
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 142 def self.validate_raw(obj:) obj.owner.nil? || Merge::Crm::NoteRequestOwner.validate_raw(obj: obj.owner) obj.content&.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") obj.contact.nil? || Merge::Crm::NoteRequestContact.validate_raw(obj: obj.contact) obj.account.nil? || Merge::Crm::NoteRequestAccount.validate_raw(obj: obj.account) obj.opportunity.nil? || Merge::Crm::NoteRequestOpportunity.validate_raw(obj: obj.opportunity) obj.integration_params&.is_a?(Hash) != false || raise("Passed value for field obj.integration_params is not the expected type, validation failed.") obj.linked_account_params&.is_a?(Hash) != false || raise("Passed value for field obj.linked_account_params is not the expected type, validation failed.") obj.remote_fields&.is_a?(Array) != false || raise("Passed value for field obj.remote_fields is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of NoteRequest to a JSON object
132 133 134 |
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 132 def to_json(*_args) @_field_set&.to_json end |