Class: Merge::Crm::EngagementRequest

Inherits:
Object
  • Object
show all
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

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

Parameters:

  • owner (Merge::Crm::EngagementRequestOwner) (defaults to: OMIT)

    The engagement’s owner.

  • content (String) (defaults to: OMIT)

    The engagement’s content.

  • subject (String) (defaults to: OMIT)

    The engagement’s subject.

  • direction (Merge::Crm::DirectionEnum) (defaults to: OMIT)

    The engagement’s direction.

    • ‘INBOUND` - INBOUND

    • ‘OUTBOUND` - OUTBOUND

  • engagement_type (Merge::Crm::EngagementRequestEngagementType) (defaults to: OMIT)

    The engagement type of the engagement.

  • start_time (DateTime) (defaults to: OMIT)

    The time at which the engagement started.

  • end_time (DateTime) (defaults to: OMIT)

    The time at which the engagement ended.

  • account (Merge::Crm::EngagementRequestAccount) (defaults to: OMIT)

    The account of the engagement.

  • contacts (Array<Merge::Crm::EngagementRequestContactsItem>) (defaults to: OMIT)
  • integration_params (Hash{String => Object}) (defaults to: OMIT)
  • linked_account_params (Hash{String => Object}) (defaults to: OMIT)
  • remote_fields (Array<Merge::Crm::RemoteFieldRequest>) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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 =  if  != OMIT
  @contacts = contacts if contacts != OMIT
  @integration_params = integration_params if integration_params != OMIT
  @linked_account_params =  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

#accountMerge::Crm::EngagementRequestAccount (readonly)

Returns The account of the engagement.

Returns:



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

def 
  @account
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#contactsArray<Merge::Crm::EngagementRequestContactsItem> (readonly)



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

def contacts
  @contacts
end

#contentString (readonly)

Returns The engagement’s content.

Returns:

  • (String)

    The engagement’s content.



25
26
27
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 25

def content
  @content
end

#directionMerge::Crm::DirectionEnum (readonly)

Returns The engagement’s direction.

  • ‘INBOUND` - INBOUND

  • ‘OUTBOUND` - OUTBOUND.

Returns:



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

def direction
  @direction
end

#end_timeDateTime (readonly)

Returns The time at which the engagement ended.

Returns:

  • (DateTime)

    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_typeMerge::Crm::EngagementRequestEngagementType (readonly)

Returns The engagement type of the engagement.

Returns:



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

def engagement_type
  @engagement_type
end

#integration_paramsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


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

def integration_params
  @integration_params
end

#linked_account_paramsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


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

def 
  @linked_account_params
end

#ownerMerge::Crm::EngagementRequestOwner (readonly)

Returns The engagement’s owner.

Returns:



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

def owner
  @owner
end

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

Returns:



47
48
49
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 47

def remote_fields
  @remote_fields
end

#start_timeDateTime (readonly)

Returns The time at which the engagement started.

Returns:

  • (DateTime)

    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

#subjectString (readonly)

Returns The engagement’s subject.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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?
     = nil
  else
     = parsed_json["account"].to_json
     = Merge::Crm::EngagementRequestAccount.from_json(json_object: )
  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"]
   = 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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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..nil? || Merge::Crm::EngagementRequestAccount.validate_raw(obj: obj.)
  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 EngagementRequest to a JSON object

Returns:

  • (String)


165
166
167
# File 'lib/merge_ruby_client/crm/types/engagement_request.rb', line 165

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