Class: XeroRuby::Accounting::Contact
- Inherits:
-
Object
- Object
- XeroRuby::Accounting::Contact
- Defined in:
- lib/xero-ruby/models/accounting/contact.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#account_number ⇒ Object
A user defined account number.
-
#accounts_payable_tax_type ⇒ Object
The tax type from TaxRates.
-
#accounts_receivable_tax_type ⇒ Object
The tax type from TaxRates.
-
#addresses ⇒ Object
Store certain address types for a contact – see address types.
-
#attachments ⇒ Object
Displays array of attachments from the API.
-
#balances ⇒ Object
Returns the value of attribute balances.
-
#bank_account_details ⇒ Object
Bank account number of contact.
-
#batch_payments ⇒ Object
Returns the value of attribute batch_payments.
-
#branding_theme ⇒ Object
Returns the value of attribute branding_theme.
-
#company_number ⇒ Object
Company registration number (max length = 50).
-
#contact_groups ⇒ Object
Displays which contact groups a contact is included in.
-
#contact_id ⇒ Object
Xero identifier.
-
#contact_number ⇒ Object
This can be updated via the API only i.e.
-
#contact_persons ⇒ Object
See contact persons.
-
#contact_status ⇒ Object
Current status of a contact – see contact status types.
-
#default_currency ⇒ Object
Returns the value of attribute default_currency.
-
#discount ⇒ Object
The default discount rate for the contact (read only).
-
#email_address ⇒ Object
Email address of contact person (umlauts not supported) (max length = 255).
-
#first_name ⇒ Object
First name of contact person (max length = 255).
-
#has_attachments ⇒ Object
A boolean to indicate if a contact has an attachment.
-
#has_validation_errors ⇒ Object
A boolean to indicate if a contact has an validation errors.
-
#is_customer ⇒ Object
true or false – Boolean that describes if a contact has any AR invoices entered against them.
-
#is_supplier ⇒ Object
true or false – Boolean that describes if a contact that has any AP invoices entered against them.
-
#last_name ⇒ Object
Last name of contact person (max length = 255).
-
#merged_to_contact_id ⇒ Object
ID for the destination of a merged contact.
-
#name ⇒ Object
Full name of contact/organisation (max length = 255).
-
#payment_terms ⇒ Object
Returns the value of attribute payment_terms.
-
#phones ⇒ Object
Store certain phone types for a contact – see phone types.
-
#purchases_default_account_code ⇒ Object
The default purchases account code for contacts.
-
#purchases_default_line_amount_type ⇒ Object
The default purchases line amount type for a contact Only available when summaryOnly parameter or paging is used, or when fetch by ContactId or ContactNumber.
-
#purchases_tracking_categories ⇒ Object
The default purchases tracking categories for contacts.
-
#sales_default_account_code ⇒ Object
The default sales account code for contacts.
-
#sales_default_line_amount_type ⇒ Object
The default sales line amount type for a contact.
-
#sales_tracking_categories ⇒ Object
The default sales tracking categories for contacts.
-
#status_attribute_string ⇒ Object
Status of object.
-
#tax_number ⇒ Object
Tax number of contact – this is also known as the ABN (Australia), GST Number (New Zealand), VAT Number (UK) or Tax ID Number (US and global) in the Xero UI depending on which regionalized version of Xero you are using (max length = 50).
-
#tax_number_type ⇒ Object
Identifier of the regional type of tax number, such as US, UK, or other regional tax identifiers.
-
#tracking_category_name ⇒ Object
The name of the Tracking Category assigned to the contact under SalesTrackingCategories and PurchasesTrackingCategories.
-
#tracking_category_option ⇒ Object
The name of the Tracking Option assigned to the contact under SalesTrackingCategories and PurchasesTrackingCategories.
-
#updated_date_utc ⇒ Object
UTC timestamp of last update to contact.
-
#validation_errors ⇒ Object
Displays validation errors returned from the API.
-
#website ⇒ Object
Website address for contact (read only).
-
#xero_network_key ⇒ Object
Store XeroNetworkKey for contacts.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value, downcase: false) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Contact
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
- #parse_date(datestring) ⇒ Object
-
#to_attributes ⇒ Object
Returns the object in the form of hash with snake_case.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash(downcase: false) ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Contact
Initializes the object
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 283 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::Contact` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Accounting::Contact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'contact_id') self.contact_id = attributes[:'contact_id'] end if attributes.key?(:'merged_to_contact_id') self.merged_to_contact_id = attributes[:'merged_to_contact_id'] end if attributes.key?(:'contact_number') self.contact_number = attributes[:'contact_number'] end if attributes.key?(:'account_number') self.account_number = attributes[:'account_number'] end if attributes.key?(:'contact_status') self.contact_status = attributes[:'contact_status'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'first_name') self.first_name = attributes[:'first_name'] end if attributes.key?(:'last_name') self.last_name = attributes[:'last_name'] end if attributes.key?(:'company_number') self.company_number = attributes[:'company_number'] end if attributes.key?(:'email_address') self.email_address = attributes[:'email_address'] end if attributes.key?(:'contact_persons') if (value = attributes[:'contact_persons']).is_a?(Array) self.contact_persons = value end end if attributes.key?(:'bank_account_details') self.bank_account_details = attributes[:'bank_account_details'] end if attributes.key?(:'tax_number') self.tax_number = attributes[:'tax_number'] end if attributes.key?(:'tax_number_type') self.tax_number_type = attributes[:'tax_number_type'] end if attributes.key?(:'accounts_receivable_tax_type') self.accounts_receivable_tax_type = attributes[:'accounts_receivable_tax_type'] end if attributes.key?(:'accounts_payable_tax_type') self.accounts_payable_tax_type = attributes[:'accounts_payable_tax_type'] end if attributes.key?(:'addresses') if (value = attributes[:'addresses']).is_a?(Array) self.addresses = value end end if attributes.key?(:'phones') if (value = attributes[:'phones']).is_a?(Array) self.phones = value end end if attributes.key?(:'is_supplier') self.is_supplier = attributes[:'is_supplier'] end if attributes.key?(:'is_customer') self.is_customer = attributes[:'is_customer'] end if attributes.key?(:'sales_default_line_amount_type') self.sales_default_line_amount_type = attributes[:'sales_default_line_amount_type'] end if attributes.key?(:'purchases_default_line_amount_type') self.purchases_default_line_amount_type = attributes[:'purchases_default_line_amount_type'] end if attributes.key?(:'default_currency') self.default_currency = attributes[:'default_currency'] end if attributes.key?(:'xero_network_key') self.xero_network_key = attributes[:'xero_network_key'] end if attributes.key?(:'sales_default_account_code') self.sales_default_account_code = attributes[:'sales_default_account_code'] end if attributes.key?(:'purchases_default_account_code') self.purchases_default_account_code = attributes[:'purchases_default_account_code'] end if attributes.key?(:'sales_tracking_categories') if (value = attributes[:'sales_tracking_categories']).is_a?(Array) self.sales_tracking_categories = value end end if attributes.key?(:'purchases_tracking_categories') if (value = attributes[:'purchases_tracking_categories']).is_a?(Array) self.purchases_tracking_categories = value end end if attributes.key?(:'tracking_category_name') self.tracking_category_name = attributes[:'tracking_category_name'] end if attributes.key?(:'tracking_category_option') self.tracking_category_option = attributes[:'tracking_category_option'] end if attributes.key?(:'payment_terms') self.payment_terms = attributes[:'payment_terms'] end if attributes.key?(:'updated_date_utc') self.updated_date_utc = attributes[:'updated_date_utc'] end if attributes.key?(:'contact_groups') if (value = attributes[:'contact_groups']).is_a?(Array) self.contact_groups = value end end if attributes.key?(:'website') self.website = attributes[:'website'] end if attributes.key?(:'branding_theme') self.branding_theme = attributes[:'branding_theme'] end if attributes.key?(:'batch_payments') self.batch_payments = attributes[:'batch_payments'] end if attributes.key?(:'discount') self.discount = attributes[:'discount'] end if attributes.key?(:'balances') self.balances = attributes[:'balances'] end if attributes.key?(:'attachments') if (value = attributes[:'attachments']).is_a?(Array) self. = value end end if attributes.key?(:'has_attachments') self. = attributes[:'has_attachments'] else self. = false end if attributes.key?(:'validation_errors') if (value = attributes[:'validation_errors']).is_a?(Array) self.validation_errors = value end end if attributes.key?(:'has_validation_errors') self.has_validation_errors = attributes[:'has_validation_errors'] else self.has_validation_errors = false end if attributes.key?(:'status_attribute_string') self.status_attribute_string = attributes[:'status_attribute_string'] end end |
Instance Attribute Details
#account_number ⇒ Object
A user defined account number. This can be updated via the API and the Xero UI (max length = 50)
29 30 31 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 29 def account_number @account_number end |
#accounts_payable_tax_type ⇒ Object
The tax type from TaxRates
72 73 74 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 72 def accounts_payable_tax_type @accounts_payable_tax_type end |
#accounts_receivable_tax_type ⇒ Object
The tax type from TaxRates
69 70 71 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 69 def accounts_receivable_tax_type @accounts_receivable_tax_type end |
#addresses ⇒ Object
Store certain address types for a contact – see address types
75 76 77 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 75 def addresses @addresses end |
#attachments ⇒ Object
Displays array of attachments from the API
147 148 149 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 147 def @attachments end |
#balances ⇒ Object
Returns the value of attribute balances.
144 145 146 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 144 def balances @balances end |
#bank_account_details ⇒ Object
Bank account number of contact
56 57 58 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 56 def bank_account_details @bank_account_details end |
#batch_payments ⇒ Object
Returns the value of attribute batch_payments.
138 139 140 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 138 def batch_payments @batch_payments end |
#branding_theme ⇒ Object
Returns the value of attribute branding_theme.
135 136 137 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 135 def branding_theme @branding_theme end |
#company_number ⇒ Object
Company registration number (max length = 50)
47 48 49 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 47 def company_number @company_number end |
#contact_groups ⇒ Object
Displays which contact groups a contact is included in
129 130 131 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 129 def contact_groups @contact_groups end |
#contact_id ⇒ Object
Xero identifier
20 21 22 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 20 def contact_id @contact_id end |
#contact_number ⇒ Object
This can be updated via the API only i.e. This field is read only on the Xero contact screen, used to identify contacts in external systems (max length = 50). If the Contact Number is used, this is displayed as Contact Code in the Contacts UI in Xero.
26 27 28 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 26 def contact_number @contact_number end |
#contact_persons ⇒ Object
See contact persons
53 54 55 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 53 def contact_persons @contact_persons end |
#contact_status ⇒ Object
Current status of a contact – see contact status types
32 33 34 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 32 def contact_status @contact_status end |
#default_currency ⇒ Object
Returns the value of attribute default_currency.
99 100 101 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 99 def default_currency @default_currency end |
#discount ⇒ Object
The default discount rate for the contact (read only)
141 142 143 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 141 def discount @discount end |
#email_address ⇒ Object
Email address of contact person (umlauts not supported) (max length = 255)
50 51 52 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 50 def email_address @email_address end |
#first_name ⇒ Object
First name of contact person (max length = 255)
41 42 43 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 41 def first_name @first_name end |
#has_attachments ⇒ Object
A boolean to indicate if a contact has an attachment
150 151 152 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 150 def @has_attachments end |
#has_validation_errors ⇒ Object
A boolean to indicate if a contact has an validation errors
156 157 158 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 156 def has_validation_errors @has_validation_errors end |
#is_customer ⇒ Object
true or false – Boolean that describes if a contact has any AR invoices entered against them. Cannot be set via PUT or POST – it is automatically set when an accounts receivable invoice is generated against this contact.
84 85 86 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 84 def is_customer @is_customer end |
#is_supplier ⇒ Object
true or false – Boolean that describes if a contact that has any AP invoices entered against them. Cannot be set via PUT or POST – it is automatically set when an accounts payable invoice is generated against this contact.
81 82 83 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 81 def is_supplier @is_supplier end |
#last_name ⇒ Object
Last name of contact person (max length = 255)
44 45 46 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 44 def last_name @last_name end |
#merged_to_contact_id ⇒ Object
ID for the destination of a merged contact. Only returned when using paging or when fetching a contact by ContactId or ContactNumber.
23 24 25 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 23 def merged_to_contact_id @merged_to_contact_id end |
#name ⇒ Object
Full name of contact/organisation (max length = 255)
38 39 40 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 38 def name @name end |
#payment_terms ⇒ Object
Returns the value of attribute payment_terms.
123 124 125 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 123 def payment_terms @payment_terms end |
#phones ⇒ Object
Store certain phone types for a contact – see phone types
78 79 80 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 78 def phones @phones end |
#purchases_default_account_code ⇒ Object
The default purchases account code for contacts
108 109 110 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 108 def purchases_default_account_code @purchases_default_account_code end |
#purchases_default_line_amount_type ⇒ Object
The default purchases line amount type for a contact Only available when summaryOnly parameter or paging is used, or when fetch by ContactId or ContactNumber.
93 94 95 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 93 def purchases_default_line_amount_type @purchases_default_line_amount_type end |
#purchases_tracking_categories ⇒ Object
The default purchases tracking categories for contacts
114 115 116 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 114 def purchases_tracking_categories @purchases_tracking_categories end |
#sales_default_account_code ⇒ Object
The default sales account code for contacts
105 106 107 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 105 def sales_default_account_code @sales_default_account_code end |
#sales_default_line_amount_type ⇒ Object
The default sales line amount type for a contact. Only available when summaryOnly parameter or paging is used, or when fetch by ContactId or ContactNumber.
87 88 89 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 87 def sales_default_line_amount_type @sales_default_line_amount_type end |
#sales_tracking_categories ⇒ Object
The default sales tracking categories for contacts
111 112 113 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 111 def sales_tracking_categories @sales_tracking_categories end |
#status_attribute_string ⇒ Object
Status of object
159 160 161 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 159 def status_attribute_string @status_attribute_string end |
#tax_number ⇒ Object
Tax number of contact – this is also known as the ABN (Australia), GST Number (New Zealand), VAT Number (UK) or Tax ID Number (US and global) in the Xero UI depending on which regionalized version of Xero you are using (max length = 50)
59 60 61 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 59 def tax_number @tax_number end |
#tax_number_type ⇒ Object
Identifier of the regional type of tax number, such as US, UK, or other regional tax identifiers
62 63 64 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 62 def tax_number_type @tax_number_type end |
#tracking_category_name ⇒ Object
The name of the Tracking Category assigned to the contact under SalesTrackingCategories and PurchasesTrackingCategories
117 118 119 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 117 def tracking_category_name @tracking_category_name end |
#tracking_category_option ⇒ Object
The name of the Tracking Option assigned to the contact under SalesTrackingCategories and PurchasesTrackingCategories
120 121 122 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 120 def tracking_category_option @tracking_category_option end |
#updated_date_utc ⇒ Object
UTC timestamp of last update to contact
126 127 128 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 126 def updated_date_utc @updated_date_utc end |
#validation_errors ⇒ Object
Displays validation errors returned from the API
153 154 155 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 153 def validation_errors @validation_errors end |
#website ⇒ Object
Website address for contact (read only)
132 133 134 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 132 def website @website end |
#xero_network_key ⇒ Object
Store XeroNetworkKey for contacts.
102 103 104 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 102 def xero_network_key @xero_network_key end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 184 def self.attribute_map { :'contact_id' => :'ContactID', :'merged_to_contact_id' => :'MergedToContactID', :'contact_number' => :'ContactNumber', :'account_number' => :'AccountNumber', :'contact_status' => :'ContactStatus', :'name' => :'Name', :'first_name' => :'FirstName', :'last_name' => :'LastName', :'company_number' => :'CompanyNumber', :'email_address' => :'EmailAddress', :'contact_persons' => :'ContactPersons', :'bank_account_details' => :'BankAccountDetails', :'tax_number' => :'TaxNumber', :'tax_number_type' => :'TaxNumberType', :'accounts_receivable_tax_type' => :'AccountsReceivableTaxType', :'accounts_payable_tax_type' => :'AccountsPayableTaxType', :'addresses' => :'Addresses', :'phones' => :'Phones', :'is_supplier' => :'IsSupplier', :'is_customer' => :'IsCustomer', :'sales_default_line_amount_type' => :'SalesDefaultLineAmountType', :'purchases_default_line_amount_type' => :'PurchasesDefaultLineAmountType', :'default_currency' => :'DefaultCurrency', :'xero_network_key' => :'XeroNetworkKey', :'sales_default_account_code' => :'SalesDefaultAccountCode', :'purchases_default_account_code' => :'PurchasesDefaultAccountCode', :'sales_tracking_categories' => :'SalesTrackingCategories', :'purchases_tracking_categories' => :'PurchasesTrackingCategories', :'tracking_category_name' => :'TrackingCategoryName', :'tracking_category_option' => :'TrackingCategoryOption', :'payment_terms' => :'PaymentTerms', :'updated_date_utc' => :'UpdatedDateUTC', :'contact_groups' => :'ContactGroups', :'website' => :'Website', :'branding_theme' => :'BrandingTheme', :'batch_payments' => :'BatchPayments', :'discount' => :'Discount', :'balances' => :'Balances', :'attachments' => :'Attachments', :'has_attachments' => :'HasAttachments', :'validation_errors' => :'ValidationErrors', :'has_validation_errors' => :'HasValidationErrors', :'status_attribute_string' => :'StatusAttributeString' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
735 736 737 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 735 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_types ⇒ Object
Attribute type mapping.
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 233 def self.openapi_types { :'contact_id' => :'String', :'merged_to_contact_id' => :'String', :'contact_number' => :'String', :'account_number' => :'String', :'contact_status' => :'String', :'name' => :'String', :'first_name' => :'String', :'last_name' => :'String', :'company_number' => :'String', :'email_address' => :'String', :'contact_persons' => :'Array<ContactPerson>', :'bank_account_details' => :'String', :'tax_number' => :'String', :'tax_number_type' => :'String', :'accounts_receivable_tax_type' => :'String', :'accounts_payable_tax_type' => :'String', :'addresses' => :'Array<Address>', :'phones' => :'Array<Phone>', :'is_supplier' => :'Boolean', :'is_customer' => :'Boolean', :'sales_default_line_amount_type' => :'String', :'purchases_default_line_amount_type' => :'String', :'default_currency' => :'CurrencyCode', :'xero_network_key' => :'String', :'sales_default_account_code' => :'String', :'purchases_default_account_code' => :'String', :'sales_tracking_categories' => :'Array<SalesTrackingCategory>', :'purchases_tracking_categories' => :'Array<SalesTrackingCategory>', :'tracking_category_name' => :'String', :'tracking_category_option' => :'String', :'payment_terms' => :'PaymentTerm', :'updated_date_utc' => :'DateTime', :'contact_groups' => :'Array<ContactGroup>', :'website' => :'String', :'branding_theme' => :'BrandingTheme', :'batch_payments' => :'BatchPaymentDetails', :'discount' => :'BigDecimal', :'balances' => :'Balances', :'attachments' => :'Array<Attachment>', :'has_attachments' => :'Boolean', :'validation_errors' => :'Array<ValidationError>', :'has_validation_errors' => :'Boolean', :'status_attribute_string' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 672 def ==(o) return true if self.equal?(o) self.class == o.class && contact_id == o.contact_id && merged_to_contact_id == o.merged_to_contact_id && contact_number == o.contact_number && account_number == o.account_number && contact_status == o.contact_status && name == o.name && first_name == o.first_name && last_name == o.last_name && company_number == o.company_number && email_address == o.email_address && contact_persons == o.contact_persons && bank_account_details == o.bank_account_details && tax_number == o.tax_number && tax_number_type == o.tax_number_type && accounts_receivable_tax_type == o.accounts_receivable_tax_type && accounts_payable_tax_type == o.accounts_payable_tax_type && addresses == o.addresses && phones == o.phones && is_supplier == o.is_supplier && is_customer == o.is_customer && sales_default_line_amount_type == o.sales_default_line_amount_type && purchases_default_line_amount_type == o.purchases_default_line_amount_type && default_currency == o.default_currency && xero_network_key == o.xero_network_key && sales_default_account_code == o.sales_default_account_code && purchases_default_account_code == o.purchases_default_account_code && sales_tracking_categories == o.sales_tracking_categories && purchases_tracking_categories == o.purchases_tracking_categories && tracking_category_name == o.tracking_category_name && tracking_category_option == o.tracking_category_option && payment_terms == o.payment_terms && updated_date_utc == o.updated_date_utc && contact_groups == o.contact_groups && website == o.website && branding_theme == o.branding_theme && batch_payments == o.batch_payments && discount == o.discount && balances == o.balances && == o. && == o. && validation_errors == o.validation_errors && has_validation_errors == o.has_validation_errors && status_attribute_string == o.status_attribute_string end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 763 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(parse_date(value)) when :Date Date.parse(parse_date(value)) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BigDecimal BigDecimal(value.to_s) when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model XeroRuby::Accounting.const_get(type).build_from_hash(value) end end |
#_to_hash(value, downcase: false) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 836 def _to_hash(value, downcase: false) if value.is_a?(Array) value.map do |v| v.to_hash(downcase: downcase) end elsif value.is_a?(Hash) {}.tap do |hash| value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) } end elsif value.respond_to? :to_hash value.to_hash(downcase: downcase) else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 742 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
722 723 724 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 722 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
728 729 730 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 728 def hash [contact_id, merged_to_contact_id, contact_number, account_number, contact_status, name, first_name, last_name, company_number, email_address, contact_persons, bank_account_details, tax_number, tax_number_type, accounts_receivable_tax_type, accounts_payable_tax_type, addresses, phones, is_supplier, is_customer, sales_default_line_amount_type, purchases_default_line_amount_type, default_currency, xero_network_key, sales_default_account_code, purchases_default_account_code, sales_tracking_categories, purchases_tracking_categories, tracking_category_name, tracking_category_option, payment_terms, updated_date_utc, contact_groups, website, branding_theme, batch_payments, discount, balances, , , validation_errors, has_validation_errors, status_attribute_string].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 491 def list_invalid_properties invalid_properties = Array.new if !@contact_number.nil? && @contact_number.to_s.length > 50 invalid_properties.push('invalid value for "contact_number", the character length must be smaller than or equal to 50.') end if !@account_number.nil? && @account_number.to_s.length > 50 invalid_properties.push('invalid value for "account_number", the character length must be smaller than or equal to 50.') end if !@name.nil? && @name.to_s.length > 255 invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.') end if !@first_name.nil? && @first_name.to_s.length > 255 invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 255.') end if !@last_name.nil? && @last_name.to_s.length > 255 invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 255.') end if !@company_number.nil? && @company_number.to_s.length > 50 invalid_properties.push('invalid value for "company_number", the character length must be smaller than or equal to 50.') end if !@email_address.nil? && @email_address.to_s.length > 255 invalid_properties.push('invalid value for "email_address", the character length must be smaller than or equal to 255.') end if !@tax_number.nil? && @tax_number.to_s.length > 50 invalid_properties.push('invalid value for "tax_number", the character length must be smaller than or equal to 50.') end invalid_properties end |
#parse_date(datestring) ⇒ Object
852 853 854 855 856 857 858 859 860 861 862 863 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 852 def parse_date(datestring) if datestring.include?('Date') date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\// original, date, timezone = *date_pattern.match(datestring) date = (date.to_i / 1000) Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s else # handle date 'types' for small subset of payroll API's Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s end end |
#to_attributes ⇒ Object
Returns the object in the form of hash with snake_case
828 829 830 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 828 def to_attributes to_hash(downcase: true) end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
810 811 812 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 810 def to_body to_hash end |
#to_hash(downcase: false) ⇒ Hash
Returns the object in the form of hash
816 817 818 819 820 821 822 823 824 825 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 816 def to_hash(downcase: false) hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? key = downcase ? attr : param hash[key] = _to_hash(value, downcase: downcase) end hash end |
#to_s ⇒ String
Returns the string representation of the object
804 805 806 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 804 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 |
# File 'lib/xero-ruby/models/accounting/contact.rb', line 530 def valid? return false if !@contact_number.nil? && @contact_number.to_s.length > 50 return false if !@account_number.nil? && @account_number.to_s.length > 50 contact_status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "ARCHIVED", "GDPRREQUEST"]) return false unless contact_status_validator.valid?(@contact_status) return false if !@name.nil? && @name.to_s.length > 255 return false if !@first_name.nil? && @first_name.to_s.length > 255 return false if !@last_name.nil? && @last_name.to_s.length > 255 return false if !@company_number.nil? && @company_number.to_s.length > 50 return false if !@email_address.nil? && @email_address.to_s.length > 255 return false if !@tax_number.nil? && @tax_number.to_s.length > 50 tax_number_type_validator = EnumAttributeValidator.new('String', ["SSN", "EIN", "ITIN", "ATIN"]) return false unless tax_number_type_validator.valid?(@tax_number_type) sales_default_line_amount_type_validator = EnumAttributeValidator.new('String', ["INCLUSIVE", "EXCLUSIVE", "NONE"]) return false unless sales_default_line_amount_type_validator.valid?(@sales_default_line_amount_type) purchases_default_line_amount_type_validator = EnumAttributeValidator.new('String', ["INCLUSIVE", "EXCLUSIVE", "NONE"]) return false unless purchases_default_line_amount_type_validator.valid?(@purchases_default_line_amount_type) true end |