Class: Merge::Crm::NoteRequest

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

Class Method Summary collapse

Instance Method Summary collapse

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

Parameters:



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

Instance Attribute Details

#accountMerge::Crm::NoteRequestAccount (readonly)

Returns The note’s account.

Returns:



26
27
28
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 26

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



36
37
38
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 36

def additional_properties
  @additional_properties
end

#contactMerge::Crm::NoteRequestContact (readonly)

Returns The note’s contact.

Returns:



24
25
26
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 24

def contact
  @contact
end

#contentString (readonly)

Returns The note’s content.

Returns:

  • (String)

    The note’s content.



22
23
24
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 22

def content
  @content
end

#integration_paramsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


30
31
32
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 30

def integration_params
  @integration_params
end

#linked_account_paramsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


32
33
34
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 32

def 
  @linked_account_params
end

#opportunityMerge::Crm::NoteRequestOpportunity (readonly)

Returns The note’s opportunity.

Returns:



28
29
30
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 28

def opportunity
  @opportunity
end

#ownerMerge::Crm::NoteRequestOwner (readonly)

Returns The note’s owner.

Returns:



20
21
22
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 20

def owner
  @owner
end

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

Returns:



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

Parameters:

  • json_object (String)

Returns:



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


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..nil? || Merge::Crm::NoteRequestAccount.validate_raw(obj: obj.)
  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.&.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

Returns:

  • (String)


132
133
134
# File 'lib/merge_ruby_client/crm/types/note_request.rb', line 132

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