Class: Merge::Crm::PatchedEngagementRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/crm/types/patched_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

Class Method Summary collapse

Instance Method Summary collapse

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::PatchedEngagementRequest



68
69
70
71
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
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 68

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 =  if  != OMIT
  @contacts = contacts if contacts != OMIT
  @integration_params = integration_params if integration_params != OMIT
   =  if  != 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": ,
    "contacts": contacts,
    "integration_params": integration_params,
    "linked_account_params": ,
    "remote_fields": remote_fields
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#accountString (readonly)



35
36
37
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 35

def 
  @account
end

#additional_propertiesOpenStruct (readonly)



45
46
47
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 45

def additional_properties
  @additional_properties
end

#contactsArray<String> (readonly)



37
38
39
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 37

def contacts
  @contacts
end

#contentString (readonly)



21
22
23
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 21

def content
  @content
end

#directionMerge::Crm::DirectionEnum (readonly)



27
28
29
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 27

def direction
  @direction
end

#end_timeDateTime (readonly)



33
34
35
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 33

def end_time
  @end_time
end

#engagement_typeString (readonly)



29
30
31
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 29

def engagement_type
  @engagement_type
end

#integration_paramsHash{String => Object} (readonly)



39
40
41
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 39

def integration_params
  @integration_params
end

#linked_account_paramsHash{String => Object} (readonly)



41
42
43
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 41

def 
  
end

#ownerString (readonly)



19
20
21
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 19

def owner
  @owner
end

#remote_fieldsArray<Merge::Crm::RemoteFieldRequest> (readonly)



43
44
45
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 43

def remote_fields
  @remote_fields
end

#start_timeDateTime (readonly)



31
32
33
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 31

def start_time
  @start_time
end

#subjectString (readonly)



23
24
25
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 23

def subject
  @subject
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Crm::PatchedEngagementRequest

Deserialize a JSON object to an instance of PatchedEngagementRequest



105
106
107
108
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
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 105

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  owner = parsed_json["owner"]
  content = parsed_json["content"]
  subject = parsed_json["subject"]
  direction = parsed_json["direction"]
  engagement_type = parsed_json["engagement_type"]
  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?)
   = parsed_json["account"]
  contacts = parsed_json["contacts"]
  integration_params = parsed_json["integration_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: ,
    contacts: contacts,
    integration_params: integration_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.


153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 153

def self.validate_raw(obj:)
  obj.owner&.is_a?(String) != false || raise("Passed value for field obj.owner is not the expected type, validation failed.")
  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&.is_a?(String) != false || raise("Passed value for field obj.engagement_type is not the expected type, validation failed.")
  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.&.is_a?(String) != false || raise("Passed value for field obj.account is not the expected type, validation failed.")
  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.&.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 PatchedEngagementRequest to a JSON object



143
144
145
# File 'lib/merge_ruby_client/crm/types/patched_engagement_request.rb', line 143

def to_json(*_args)
  @_field_set&.to_json
end