Class: Merge::Crm::EngagementRequest
- Inherits:
-
Object
- Object
- Merge::Crm::EngagementRequest
- Defined in:
- lib/merge_ruby_client/crm/types/engagement_request.rb
Overview
# The Engagement Object
### Description
The `Engagement` object is used to represent an interaction noted in a CRM
system.
### Usage Example
TODO
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#account ⇒ Merge::Crm::EngagementRequestAccount
readonly
The account of the engagement.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #contacts ⇒ Array<Merge::Crm::EngagementRequestContactsItem> readonly
-
#content ⇒ String
readonly
The engagement’s content.
-
#direction ⇒ Merge::Crm::DirectionEnum
readonly
The engagement’s direction.
-
#end_time ⇒ DateTime
readonly
The time at which the engagement ended.
-
#engagement_type ⇒ Merge::Crm::EngagementRequestEngagementType
readonly
The engagement type of the engagement.
- #integration_params ⇒ Hash{String => Object} readonly
- #linked_account_params ⇒ Hash{String => Object} readonly
-
#owner ⇒ Merge::Crm::EngagementRequestOwner
readonly
The engagement’s owner.
- #remote_fields ⇒ Array<Merge::Crm::RemoteFieldRequest> readonly
-
#start_time ⇒ DateTime
readonly
The time at which the engagement started.
-
#subject ⇒ String
readonly
The engagement’s subject.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Crm::EngagementRequest
Deserialize a JSON object to an instance of EngagementRequest.
-
.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, subject: OMIT, direction: OMIT, engagement_type: OMIT, start_time: OMIT, end_time: OMIT, account: OMIT, contacts: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil) ⇒ Merge::Crm::EngagementRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of EngagementRequest to a JSON object.
Constructor Details
#initialize(owner: OMIT, content: OMIT, subject: OMIT, direction: OMIT, engagement_type: OMIT, start_time: OMIT, end_time: OMIT, account: OMIT, contacts: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil) ⇒ Merge::Crm::EngagementRequest
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 72 def initialize(owner: OMIT, content: OMIT, subject: OMIT, direction: OMIT, engagement_type: OMIT, start_time: OMIT, end_time: OMIT, account: OMIT, contacts: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil) @owner = owner if owner != OMIT @content = content if content != OMIT @subject = subject if subject != OMIT @direction = direction if direction != OMIT @engagement_type = engagement_type if engagement_type != OMIT @start_time = start_time if start_time != OMIT @end_time = end_time if end_time != OMIT @account = account if account != OMIT @contacts = contacts if contacts != 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, "subject": subject, "direction": direction, "engagement_type": engagement_type, "start_time": start_time, "end_time": end_time, "account": account, "contacts": contacts, "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::EngagementRequestAccount (readonly)
Returns The account of the engagement.
39 40 41 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 39 def account @account end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
49 50 51 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 49 def additional_properties @additional_properties end |
#contacts ⇒ Array<Merge::Crm::EngagementRequestContactsItem> (readonly)
41 42 43 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 41 def contacts @contacts end |
#content ⇒ String (readonly)
Returns The engagement’s content.
25 26 27 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 25 def content @content end |
#direction ⇒ Merge::Crm::DirectionEnum (readonly)
Returns The engagement’s direction.
-
‘INBOUND` - INBOUND
-
‘OUTBOUND` - OUTBOUND.
31 32 33 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 31 def direction @direction end |
#end_time ⇒ DateTime (readonly)
Returns The time at which the engagement ended.
37 38 39 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 37 def end_time @end_time end |
#engagement_type ⇒ Merge::Crm::EngagementRequestEngagementType (readonly)
Returns The engagement type of the engagement.
33 34 35 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 33 def engagement_type @engagement_type end |
#integration_params ⇒ Hash{String => Object} (readonly)
43 44 45 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 43 def integration_params @integration_params end |
#linked_account_params ⇒ Hash{String => Object} (readonly)
45 46 47 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 45 def linked_account_params @linked_account_params end |
#owner ⇒ Merge::Crm::EngagementRequestOwner (readonly)
Returns The engagement’s owner.
23 24 25 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 23 def owner @owner end |
#remote_fields ⇒ Array<Merge::Crm::RemoteFieldRequest> (readonly)
47 48 49 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 47 def remote_fields @remote_fields end |
#start_time ⇒ DateTime (readonly)
Returns The time at which the engagement started.
35 36 37 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 35 def start_time @start_time end |
#subject ⇒ String (readonly)
Returns The engagement’s subject.
27 28 29 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 27 def subject @subject end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Crm::EngagementRequest
Deserialize a JSON object to an instance of EngagementRequest
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 109 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::EngagementRequestOwner.from_json(json_object: owner) end content = parsed_json["content"] subject = parsed_json["subject"] direction = parsed_json["direction"] if parsed_json["engagement_type"].nil? engagement_type = nil else engagement_type = parsed_json["engagement_type"].to_json engagement_type = Merge::Crm::EngagementRequestEngagementType.from_json(json_object: engagement_type) end start_time = (DateTime.parse(parsed_json["start_time"]) unless parsed_json["start_time"].nil?) end_time = (DateTime.parse(parsed_json["end_time"]) unless parsed_json["end_time"].nil?) if parsed_json["account"].nil? account = nil else account = parsed_json["account"].to_json account = Merge::Crm::EngagementRequestAccount.from_json(json_object: account) end contacts = parsed_json["contacts"]&.map do |item| item = item.to_json Merge::Crm::EngagementRequestContactsItem.from_json(json_object: item) 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, subject: subject, direction: direction, engagement_type: engagement_type, start_time: start_time, end_time: end_time, account: account, contacts: contacts, 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.
175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 175 def self.validate_raw(obj:) obj.owner.nil? || Merge::Crm::EngagementRequestOwner.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.subject&.is_a?(String) != false || raise("Passed value for field obj.subject is not the expected type, validation failed.") obj.direction&.is_a?(Merge::Crm::DirectionEnum) != false || raise("Passed value for field obj.direction is not the expected type, validation failed.") obj.engagement_type.nil? || Merge::Crm::EngagementRequestEngagementType.validate_raw(obj: obj.engagement_type) obj.start_time&.is_a?(DateTime) != false || raise("Passed value for field obj.start_time is not the expected type, validation failed.") obj.end_time&.is_a?(DateTime) != false || raise("Passed value for field obj.end_time is not the expected type, validation failed.") obj.account.nil? || Merge::Crm::EngagementRequestAccount.validate_raw(obj: obj.account) obj.contacts&.is_a?(Array) != false || raise("Passed value for field obj.contacts is not the expected type, validation failed.") 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 EngagementRequest to a JSON object
165 166 167 |
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 165 def to_json(*_args) @_field_set&.to_json end |