Class: Merge::Crm::LeadRequest
- Inherits:
-
Object
- Object
- Merge::Crm::LeadRequest
- Defined in:
- lib/merge_ruby_client/crm/types/lead_request.rb
Overview
# The Lead Object
### Description
The `Lead` object is used to represent an individual who is a potential
customer.
### Usage Example
TODO
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #addresses ⇒ Array<Merge::Crm::AddressRequest> readonly
-
#company ⇒ String
readonly
The lead’s company.
-
#converted_account ⇒ Merge::Crm::LeadRequestConvertedAccount
readonly
The account of the converted lead.
-
#converted_contact ⇒ Merge::Crm::LeadRequestConvertedContact
readonly
The contact of the converted lead.
-
#converted_date ⇒ DateTime
readonly
When the lead was converted.
- #email_addresses ⇒ Array<Merge::Crm::EmailAddressRequest> readonly
-
#first_name ⇒ String
readonly
The lead’s first name.
- #integration_params ⇒ Hash{String => Object} readonly
-
#last_name ⇒ String
readonly
The lead’s last name.
-
#lead_source ⇒ String
readonly
The lead’s source.
- #linked_account_params ⇒ Hash{String => Object} readonly
-
#owner ⇒ Merge::Crm::LeadRequestOwner
readonly
The lead’s owner.
- #phone_numbers ⇒ Array<Merge::Crm::PhoneNumberRequest> readonly
- #remote_fields ⇒ Array<Merge::Crm::RemoteFieldRequest> readonly
-
#title ⇒ String
readonly
The lead’s title.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Crm::LeadRequest
Deserialize a JSON object to an instance of LeadRequest.
-
.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, lead_source: OMIT, title: OMIT, company: OMIT, first_name: OMIT, last_name: OMIT, addresses: OMIT, email_addresses: OMIT, phone_numbers: OMIT, converted_date: OMIT, converted_contact: OMIT, converted_account: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil) ⇒ Merge::Crm::LeadRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of LeadRequest to a JSON object.
Constructor Details
#initialize(owner: OMIT, lead_source: OMIT, title: OMIT, company: OMIT, first_name: OMIT, last_name: OMIT, addresses: OMIT, email_addresses: OMIT, phone_numbers: OMIT, converted_date: OMIT, converted_contact: OMIT, converted_account: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil) ⇒ Merge::Crm::LeadRequest
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 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 78 def initialize(owner: OMIT, lead_source: OMIT, title: OMIT, company: OMIT, first_name: OMIT, last_name: OMIT, addresses: OMIT, email_addresses: OMIT, phone_numbers: OMIT, converted_date: OMIT, converted_contact: OMIT, converted_account: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil) @owner = owner if owner != OMIT @lead_source = lead_source if lead_source != OMIT @title = title if title != OMIT @company = company if company != OMIT @first_name = first_name if first_name != OMIT @last_name = last_name if last_name != OMIT @addresses = addresses if addresses != OMIT @email_addresses = email_addresses if email_addresses != OMIT @phone_numbers = phone_numbers if phone_numbers != OMIT @converted_date = converted_date if converted_date != OMIT @converted_contact = converted_contact if converted_contact != OMIT @converted_account = converted_account if converted_account != 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, "lead_source": lead_source, "title": title, "company": company, "first_name": first_name, "last_name": last_name, "addresses": addresses, "email_addresses": email_addresses, "phone_numbers": phone_numbers, "converted_date": converted_date, "converted_contact": converted_contact, "converted_account": converted_account, "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
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
54 55 56 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 54 def additional_properties @additional_properties end |
#addresses ⇒ Array<Merge::Crm::AddressRequest> (readonly)
36 37 38 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 36 def addresses @addresses end |
#company ⇒ String (readonly)
Returns The lead’s company.
30 31 32 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 30 def company @company end |
#converted_account ⇒ Merge::Crm::LeadRequestConvertedAccount (readonly)
Returns The account of the converted lead.
46 47 48 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 46 def converted_account @converted_account end |
#converted_contact ⇒ Merge::Crm::LeadRequestConvertedContact (readonly)
Returns The contact of the converted lead.
44 45 46 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 44 def converted_contact @converted_contact end |
#converted_date ⇒ DateTime (readonly)
Returns When the lead was converted.
42 43 44 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 42 def converted_date @converted_date end |
#email_addresses ⇒ Array<Merge::Crm::EmailAddressRequest> (readonly)
38 39 40 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 38 def email_addresses @email_addresses end |
#first_name ⇒ String (readonly)
Returns The lead’s first name.
32 33 34 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 32 def first_name @first_name end |
#integration_params ⇒ Hash{String => Object} (readonly)
48 49 50 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 48 def integration_params @integration_params end |
#last_name ⇒ String (readonly)
Returns The lead’s last name.
34 35 36 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 34 def last_name @last_name end |
#lead_source ⇒ String (readonly)
Returns The lead’s source.
26 27 28 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 26 def lead_source @lead_source end |
#linked_account_params ⇒ Hash{String => Object} (readonly)
50 51 52 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 50 def linked_account_params @linked_account_params end |
#owner ⇒ Merge::Crm::LeadRequestOwner (readonly)
Returns The lead’s owner.
24 25 26 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 24 def owner @owner end |
#phone_numbers ⇒ Array<Merge::Crm::PhoneNumberRequest> (readonly)
40 41 42 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 40 def phone_numbers @phone_numbers end |
#remote_fields ⇒ Array<Merge::Crm::RemoteFieldRequest> (readonly)
52 53 54 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 52 def remote_fields @remote_fields end |
#title ⇒ String (readonly)
Returns The lead’s title.
28 29 30 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 28 def title @title end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Crm::LeadRequest
Deserialize a JSON object to an instance of LeadRequest
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 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 121 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::LeadRequestOwner.from_json(json_object: owner) end lead_source = parsed_json["lead_source"] title = parsed_json["title"] company = parsed_json["company"] first_name = parsed_json["first_name"] last_name = parsed_json["last_name"] addresses = parsed_json["addresses"]&.map do |item| item = item.to_json Merge::Crm::AddressRequest.from_json(json_object: item) end email_addresses = parsed_json["email_addresses"]&.map do |item| item = item.to_json Merge::Crm::EmailAddressRequest.from_json(json_object: item) end phone_numbers = parsed_json["phone_numbers"]&.map do |item| item = item.to_json Merge::Crm::PhoneNumberRequest.from_json(json_object: item) end converted_date = (DateTime.parse(parsed_json["converted_date"]) unless parsed_json["converted_date"].nil?) if parsed_json["converted_contact"].nil? converted_contact = nil else converted_contact = parsed_json["converted_contact"].to_json converted_contact = Merge::Crm::LeadRequestConvertedContact.from_json(json_object: converted_contact) end if parsed_json["converted_account"].nil? converted_account = nil else converted_account = parsed_json["converted_account"].to_json converted_account = Merge::Crm::LeadRequestConvertedAccount.from_json(json_object: converted_account) 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, lead_source: lead_source, title: title, company: company, first_name: first_name, last_name: last_name, addresses: addresses, email_addresses: email_addresses, phone_numbers: phone_numbers, converted_date: converted_date, converted_contact: converted_contact, converted_account: converted_account, 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.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 199 def self.validate_raw(obj:) obj.owner.nil? || Merge::Crm::LeadRequestOwner.validate_raw(obj: obj.owner) obj.lead_source&.is_a?(String) != false || raise("Passed value for field obj.lead_source is not the expected type, validation failed.") obj.title&.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.") obj.company&.is_a?(String) != false || raise("Passed value for field obj.company is not the expected type, validation failed.") obj.first_name&.is_a?(String) != false || raise("Passed value for field obj.first_name is not the expected type, validation failed.") obj.last_name&.is_a?(String) != false || raise("Passed value for field obj.last_name is not the expected type, validation failed.") obj.addresses&.is_a?(Array) != false || raise("Passed value for field obj.addresses is not the expected type, validation failed.") obj.email_addresses&.is_a?(Array) != false || raise("Passed value for field obj.email_addresses is not the expected type, validation failed.") obj.phone_numbers&.is_a?(Array) != false || raise("Passed value for field obj.phone_numbers is not the expected type, validation failed.") obj.converted_date&.is_a?(DateTime) != false || raise("Passed value for field obj.converted_date is not the expected type, validation failed.") obj.converted_contact.nil? || Merge::Crm::LeadRequestConvertedContact.validate_raw(obj: obj.converted_contact) obj.converted_account.nil? || Merge::Crm::LeadRequestConvertedAccount.validate_raw(obj: obj.converted_account) 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 LeadRequest to a JSON object
189 190 191 |
# File 'lib/merge_ruby_client/crm/types/lead_request.rb', line 189 def to_json(*_args) @_field_set&.to_json end |