Class: XeroRuby::Accounting::Organisation
- Inherits:
-
Object
- Object
- XeroRuby::Accounting::Organisation
- Defined in:
- lib/xero-ruby/models/accounting/organisation.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Constant Summary collapse
- AU =
"AU".freeze
- NZ =
"NZ".freeze
- GLOBAL =
"GLOBAL".freeze
- UK =
"UK".freeze
- US =
"US".freeze
- AUONRAMP =
"AUONRAMP".freeze
- NZONRAMP =
"NZONRAMP".freeze
- GLOBALONRAMP =
"GLOBALONRAMP".freeze
- UKONRAMP =
"UKONRAMP".freeze
- USONRAMP =
"USONRAMP".freeze
- ACCOUNTING_PRACTICE =
"ACCOUNTING_PRACTICE".freeze
- COMPANY =
"COMPANY".freeze
- CHARITY =
"CHARITY".freeze
- CLUB_OR_SOCIETY =
"CLUB_OR_SOCIETY".freeze
- LOOK_THROUGH_COMPANY =
"LOOK_THROUGH_COMPANY".freeze
- NOT_FOR_PROFIT =
"NOT_FOR_PROFIT".freeze
- PARTNERSHIP =
"PARTNERSHIP".freeze
- S_CORPORATION =
"S_CORPORATION".freeze
- SELF_MANAGED_SUPERANNUATION_FUND =
"SELF_MANAGED_SUPERANNUATION_FUND".freeze
- SOLE_TRADER =
"SOLE_TRADER".freeze
- SUPERANNUATION_FUND =
"SUPERANNUATION_FUND".freeze
- TRUST =
"TRUST".freeze
- PAYMENTS =
"PAYMENTS".freeze
- INVOICE =
"INVOICE".freeze
- NONE =
"NONE".freeze
- CASH =
"CASH".freeze
- ACCRUAL =
"ACCRUAL".freeze
- FLATRATECASH =
"FLATRATECASH".freeze
- FLATRATEACCRUAL =
"FLATRATEACCRUAL".freeze
- ACCRUALS =
"ACCRUALS".freeze
- MONTHLY =
"MONTHLY".freeze
- QUARTERLY1 =
"QUARTERLY1".freeze
- QUARTERLY2 =
"QUARTERLY2".freeze
- QUARTERLY3 =
"QUARTERLY3".freeze
- ANNUALLY =
"ANNUALLY".freeze
- ONEMONTHS =
"ONEMONTHS".freeze
- TWOMONTHS =
"TWOMONTHS".freeze
- SIXMONTHS =
"SIXMONTHS".freeze
- N1_MONTHLY =
"1MONTHLY".freeze
- N2_MONTHLY =
"2MONTHLY".freeze
- N3_MONTHLY =
"3MONTHLY".freeze
- N6_MONTHLY =
"6MONTHLY".freeze
- QUARTERLY =
"QUARTERLY".freeze
- YEARLY =
"YEARLY".freeze
- DEMO =
"DEMO".freeze
- TRIAL =
"TRIAL".freeze
- STARTER =
"STARTER".freeze
- STANDARD =
"STANDARD".freeze
- PREMIUM =
"PREMIUM".freeze
- PREMIUM_20 =
"PREMIUM_20".freeze
- PREMIUM_50 =
"PREMIUM_50".freeze
- PREMIUM_100 =
"PREMIUM_100".freeze
- LEDGER =
"LEDGER".freeze
- GST_CASHBOOK =
"GST_CASHBOOK".freeze
- NON_GST_CASHBOOK =
"NON_GST_CASHBOOK".freeze
- BUSINESS =
"BUSINESS".freeze
- PARTNER =
"PARTNER".freeze
Instance Attribute Summary collapse
-
#_class ⇒ Object
Organisation Classes describe which plan the Xero organisation is on (e.g. DEMO, TRIAL, PREMIUM).
-
#addresses ⇒ Object
Address details for organisation – see Addresses.
-
#api_key ⇒ Object
Display a unique key used for Xero-to-Xero transactions.
-
#base_currency ⇒ Object
Returns the value of attribute base_currency.
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#created_date_utc ⇒ Object
Timestamp when the organisation was created in Xero.
-
#default_purchases_tax ⇒ Object
The default for LineAmountTypes on purchase transactions.
-
#default_sales_tax ⇒ Object
The default for LineAmountTypes on sales transactions.
-
#edition ⇒ Object
BUSINESS or PARTNER.
-
#employer_identification_number ⇒ Object
Shown if set.
-
#end_of_year_lock_date ⇒ Object
Shown if set.
-
#external_links ⇒ Object
Organisation profile links for popular services such as Facebook,Twitter, GooglePlus and LinkedIn.
-
#financial_year_end_day ⇒ Object
Calendar day e.g.
-
#financial_year_end_month ⇒ Object
Calendar Month e.g.
-
#is_demo_company ⇒ Object
Boolean to describe if organisation is a demo company.
-
#legal_name ⇒ Object
Organisation name shown on Reports.
-
#line_of_business ⇒ Object
Description of business type as defined in Organisation settings.
-
#name ⇒ Object
Display name of organisation shown in Xero.
-
#organisation_entity_type ⇒ Object
Organisation Entity Type.
-
#organisation_id ⇒ Object
Unique Xero identifier.
-
#organisation_status ⇒ Object
Will be set to ACTIVE if you can connect to organisation via the Xero API.
-
#organisation_type ⇒ Object
Organisation Type.
-
#payment_terms ⇒ Object
Returns the value of attribute payment_terms.
-
#pays_tax ⇒ Object
Boolean to describe if organisation is registered with a local tax authority i.e.
-
#period_lock_date ⇒ Object
Shown if set.
-
#phones ⇒ Object
Phones details for organisation – see Phones.
-
#registration_number ⇒ Object
Shows for New Zealand, Australian and UK organisations.
-
#sales_tax_basis ⇒ Object
The accounting basis used for tax returns.
-
#sales_tax_period ⇒ Object
The frequency with which tax returns are processed.
-
#short_code ⇒ Object
A unique identifier for the organisation.
-
#tax_number ⇒ Object
Shown if set.
-
#timezone ⇒ Object
Returns the value of attribute timezone.
-
#version ⇒ Object
See Version Types.
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) ⇒ 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 = {}) ⇒ Organisation
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#parse_date(datestring) ⇒ Object
customized data_parser.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ 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 = {}) ⇒ Organisation
Initializes the object
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 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 293 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::Organisation` 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::Organisation`. 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?(:'organisation_id') self.organisation_id = attributes[:'organisation_id'] end if attributes.key?(:'api_key') self.api_key = attributes[:'api_key'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'legal_name') self.legal_name = attributes[:'legal_name'] end if attributes.key?(:'pays_tax') self.pays_tax = attributes[:'pays_tax'] end if attributes.key?(:'version') self.version = attributes[:'version'] end if attributes.key?(:'organisation_type') self.organisation_type = attributes[:'organisation_type'] end if attributes.key?(:'base_currency') self.base_currency = attributes[:'base_currency'] end if attributes.key?(:'country_code') self.country_code = attributes[:'country_code'] end if attributes.key?(:'is_demo_company') self.is_demo_company = attributes[:'is_demo_company'] end if attributes.key?(:'organisation_status') self.organisation_status = attributes[:'organisation_status'] end if attributes.key?(:'registration_number') self.registration_number = attributes[:'registration_number'] end if attributes.key?(:'employer_identification_number') self.employer_identification_number = attributes[:'employer_identification_number'] end if attributes.key?(:'tax_number') self.tax_number = attributes[:'tax_number'] end if attributes.key?(:'financial_year_end_day') self.financial_year_end_day = attributes[:'financial_year_end_day'] end if attributes.key?(:'financial_year_end_month') self.financial_year_end_month = attributes[:'financial_year_end_month'] end if attributes.key?(:'sales_tax_basis') self.sales_tax_basis = attributes[:'sales_tax_basis'] end if attributes.key?(:'sales_tax_period') self.sales_tax_period = attributes[:'sales_tax_period'] end if attributes.key?(:'default_sales_tax') self.default_sales_tax = attributes[:'default_sales_tax'] end if attributes.key?(:'default_purchases_tax') self.default_purchases_tax = attributes[:'default_purchases_tax'] end if attributes.key?(:'period_lock_date') self.period_lock_date = attributes[:'period_lock_date'] end if attributes.key?(:'end_of_year_lock_date') self.end_of_year_lock_date = attributes[:'end_of_year_lock_date'] end if attributes.key?(:'created_date_utc') self.created_date_utc = attributes[:'created_date_utc'] end if attributes.key?(:'timezone') self.timezone = attributes[:'timezone'] end if attributes.key?(:'organisation_entity_type') self.organisation_entity_type = attributes[:'organisation_entity_type'] end if attributes.key?(:'short_code') self.short_code = attributes[:'short_code'] end if attributes.key?(:'_class') self._class = attributes[:'_class'] end if attributes.key?(:'edition') self.edition = attributes[:'edition'] end if attributes.key?(:'line_of_business') self.line_of_business = attributes[:'line_of_business'] 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?(:'external_links') if (value = attributes[:'external_links']).is_a?(Array) self.external_links = value end end if attributes.key?(:'payment_terms') self.payment_terms = attributes[:'payment_terms'] end end |
Instance Attribute Details
#_class ⇒ Object
Organisation Classes describe which plan the Xero organisation is on (e.g. DEMO, TRIAL, PREMIUM)
158 159 160 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 158 def _class @_class end |
#addresses ⇒ Object
Address details for organisation – see Addresses
180 181 182 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 180 def addresses @addresses end |
#api_key ⇒ Object
Display a unique key used for Xero-to-Xero transactions
24 25 26 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 24 def api_key @api_key end |
#base_currency ⇒ Object
Returns the value of attribute base_currency.
64 65 66 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 64 def base_currency @base_currency end |
#country_code ⇒ Object
Returns the value of attribute country_code.
67 68 69 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 67 def country_code @country_code end |
#created_date_utc ⇒ Object
Timestamp when the organisation was created in Xero
133 134 135 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 133 def created_date_utc @created_date_utc end |
#default_purchases_tax ⇒ Object
The default for LineAmountTypes on purchase transactions
124 125 126 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 124 def default_purchases_tax @default_purchases_tax end |
#default_sales_tax ⇒ Object
The default for LineAmountTypes on sales transactions
121 122 123 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 121 def default_sales_tax @default_sales_tax end |
#edition ⇒ Object
BUSINESS or PARTNER. Partner edition organisations are sold exclusively through accounting partners and have restricted functionality (e.g. no access to invoicing)
172 173 174 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 172 def edition @edition end |
#employer_identification_number ⇒ Object
Shown if set. US Only.
79 80 81 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 79 def employer_identification_number @employer_identification_number end |
#end_of_year_lock_date ⇒ Object
Shown if set. See lock dates
130 131 132 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 130 def end_of_year_lock_date @end_of_year_lock_date end |
#external_links ⇒ Object
Organisation profile links for popular services such as Facebook,Twitter, GooglePlus and LinkedIn. You can also add link to your website here. Shown if Organisation settings is updated in Xero. See ExternalLinks below
186 187 188 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 186 def external_links @external_links end |
#financial_year_end_day ⇒ Object
Calendar day e.g. 0-31
85 86 87 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 85 def financial_year_end_day @financial_year_end_day end |
#financial_year_end_month ⇒ Object
Calendar Month e.g. 1-12
88 89 90 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 88 def financial_year_end_month @financial_year_end_month end |
#is_demo_company ⇒ Object
Boolean to describe if organisation is a demo company.
70 71 72 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 70 def is_demo_company @is_demo_company end |
#legal_name ⇒ Object
Organisation name shown on Reports
30 31 32 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 30 def legal_name @legal_name end |
#line_of_business ⇒ Object
Description of business type as defined in Organisation settings
177 178 179 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 177 def line_of_business @line_of_business end |
#name ⇒ Object
Display name of organisation shown in Xero
27 28 29 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 27 def name @name end |
#organisation_entity_type ⇒ Object
Organisation Entity Type
139 140 141 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 139 def organisation_entity_type @organisation_entity_type end |
#organisation_id ⇒ Object
Unique Xero identifier
21 22 23 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 21 def organisation_id @organisation_id end |
#organisation_status ⇒ Object
Will be set to ACTIVE if you can connect to organisation via the Xero API
73 74 75 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 73 def organisation_status @organisation_status end |
#organisation_type ⇒ Object
Organisation Type
49 50 51 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 49 def organisation_type @organisation_type end |
#payment_terms ⇒ Object
Returns the value of attribute payment_terms.
189 190 191 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 189 def payment_terms @payment_terms end |
#pays_tax ⇒ Object
Boolean to describe if organisation is registered with a local tax authority i.e. true, false
33 34 35 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 33 def pays_tax @pays_tax end |
#period_lock_date ⇒ Object
Shown if set. See lock dates
127 128 129 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 127 def period_lock_date @period_lock_date end |
#phones ⇒ Object
Phones details for organisation – see Phones
183 184 185 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 183 def phones @phones end |
#registration_number ⇒ Object
Shows for New Zealand, Australian and UK organisations
76 77 78 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 76 def registration_number @registration_number end |
#sales_tax_basis ⇒ Object
The accounting basis used for tax returns. See Sales Tax Basis
91 92 93 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 91 def sales_tax_basis @sales_tax_basis end |
#sales_tax_period ⇒ Object
The frequency with which tax returns are processed. See Sales Tax Period
102 103 104 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 102 def sales_tax_period @sales_tax_period end |
#short_code ⇒ Object
A unique identifier for the organisation. Potential uses.
155 156 157 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 155 def short_code @short_code end |
#tax_number ⇒ Object
Shown if set. Displays in the Xero UI as Tax File Number (AU), GST Number (NZ), VAT Number (UK) and Tax ID Number (US & Global).
82 83 84 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 82 def tax_number @tax_number end |
#timezone ⇒ Object
Returns the value of attribute timezone.
136 137 138 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 136 def timezone @timezone end |
#version ⇒ Object
See Version Types
36 37 38 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 36 def version @version end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 214 def self.attribute_map { :'organisation_id' => :'OrganisationID', :'api_key' => :'APIKey', :'name' => :'Name', :'legal_name' => :'LegalName', :'pays_tax' => :'PaysTax', :'version' => :'Version', :'organisation_type' => :'OrganisationType', :'base_currency' => :'BaseCurrency', :'country_code' => :'CountryCode', :'is_demo_company' => :'IsDemoCompany', :'organisation_status' => :'OrganisationStatus', :'registration_number' => :'RegistrationNumber', :'employer_identification_number' => :'EmployerIdentificationNumber', :'tax_number' => :'TaxNumber', :'financial_year_end_day' => :'FinancialYearEndDay', :'financial_year_end_month' => :'FinancialYearEndMonth', :'sales_tax_basis' => :'SalesTaxBasis', :'sales_tax_period' => :'SalesTaxPeriod', :'default_sales_tax' => :'DefaultSalesTax', :'default_purchases_tax' => :'DefaultPurchasesTax', :'period_lock_date' => :'PeriodLockDate', :'end_of_year_lock_date' => :'EndOfYearLockDate', :'created_date_utc' => :'CreatedDateUTC', :'timezone' => :'Timezone', :'organisation_entity_type' => :'OrganisationEntityType', :'short_code' => :'ShortCode', :'_class' => :'Class', :'edition' => :'Edition', :'line_of_business' => :'LineOfBusiness', :'addresses' => :'Addresses', :'phones' => :'Phones', :'external_links' => :'ExternalLinks', :'payment_terms' => :'PaymentTerms' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
597 598 599 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 597 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 253 def self.openapi_types { :'organisation_id' => :'String', :'api_key' => :'String', :'name' => :'String', :'legal_name' => :'String', :'pays_tax' => :'Boolean', :'version' => :'String', :'organisation_type' => :'String', :'base_currency' => :'CurrencyCode', :'country_code' => :'CountryCode', :'is_demo_company' => :'Boolean', :'organisation_status' => :'String', :'registration_number' => :'String', :'employer_identification_number' => :'String', :'tax_number' => :'String', :'financial_year_end_day' => :'Integer', :'financial_year_end_month' => :'Integer', :'sales_tax_basis' => :'String', :'sales_tax_period' => :'String', :'default_sales_tax' => :'String', :'default_purchases_tax' => :'String', :'period_lock_date' => :'Date', :'end_of_year_lock_date' => :'Date', :'created_date_utc' => :'DateTime', :'timezone' => :'TimeZone', :'organisation_entity_type' => :'String', :'short_code' => :'String', :'_class' => :'String', :'edition' => :'String', :'line_of_business' => :'String', :'addresses' => :'Array<Address>', :'phones' => :'Array<Phone>', :'external_links' => :'Array<ExternalLink>', :'payment_terms' => :'PaymentTerm' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 544 def ==(o) return true if self.equal?(o) self.class == o.class && organisation_id == o.organisation_id && api_key == o.api_key && name == o.name && legal_name == o.legal_name && pays_tax == o.pays_tax && version == o.version && organisation_type == o.organisation_type && base_currency == o.base_currency && country_code == o.country_code && is_demo_company == o.is_demo_company && organisation_status == o.organisation_status && registration_number == o.registration_number && employer_identification_number == o.employer_identification_number && tax_number == o.tax_number && financial_year_end_day == o.financial_year_end_day && financial_year_end_month == o.financial_year_end_month && sales_tax_basis == o.sales_tax_basis && sales_tax_period == o.sales_tax_period && default_sales_tax == o.default_sales_tax && default_purchases_tax == o.default_purchases_tax && period_lock_date == o.period_lock_date && end_of_year_lock_date == o.end_of_year_lock_date && created_date_utc == o.created_date_utc && timezone == o.timezone && organisation_entity_type == o.organisation_entity_type && short_code == o.short_code && _class == o._class && edition == o.edition && line_of_business == o.line_of_business && addresses == o.addresses && phones == o.phones && external_links == o.external_links && payment_terms == o.payment_terms end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 625 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) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
692 693 694 695 696 697 698 699 700 701 702 703 704 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 692 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 604 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
584 585 586 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 584 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
590 591 592 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 590 def hash [organisation_id, api_key, name, legal_name, pays_tax, version, organisation_type, base_currency, country_code, is_demo_company, organisation_status, registration_number, employer_identification_number, tax_number, financial_year_end_day, financial_year_end_month, sales_tax_basis, sales_tax_period, default_sales_tax, default_purchases_tax, period_lock_date, end_of_year_lock_date, created_date_utc, timezone, organisation_entity_type, short_code, _class, edition, line_of_business, addresses, phones, external_links, payment_terms].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
447 448 449 450 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 447 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#parse_date(datestring) ⇒ Object
customized data_parser
707 708 709 710 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 707 def parse_date(datestring) seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0 return Time.at(seconds_since_epoch).to_s end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
672 673 674 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 672 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
678 679 680 681 682 683 684 685 686 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 678 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
666 667 668 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 666 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 |
# File 'lib/xero-ruby/models/accounting/organisation.rb', line 454 def valid? version_validator = EnumAttributeValidator.new('String', ["AU", "NZ", "GLOBAL", "UK", "US", "AUONRAMP", "NZONRAMP", "GLOBALONRAMP", "UKONRAMP", "USONRAMP"]) return false unless version_validator.valid?(@version) organisation_type_validator = EnumAttributeValidator.new('String', ["ACCOUNTING_PRACTICE", "COMPANY", "CHARITY", "CLUB_OR_SOCIETY", "LOOK_THROUGH_COMPANY", "NOT_FOR_PROFIT", "PARTNERSHIP", "S_CORPORATION", "SELF_MANAGED_SUPERANNUATION_FUND", "SOLE_TRADER", "SUPERANNUATION_FUND", "TRUST"]) return false unless organisation_type_validator.valid?(@organisation_type) sales_tax_basis_validator = EnumAttributeValidator.new('String', ["PAYMENTS", "INVOICE", "NONE", "CASH", "ACCRUAL", "FLATRATECASH", "FLATRATEACCRUAL", "ACCRUALS"]) return false unless sales_tax_basis_validator.valid?(@sales_tax_basis) sales_tax_period_validator = EnumAttributeValidator.new('String', ["MONTHLY", "QUARTERLY1", "QUARTERLY2", "QUARTERLY3", "ANNUALLY", "ONEMONTHS", "TWOMONTHS", "SIXMONTHS", "1MONTHLY", "2MONTHLY", "3MONTHLY", "6MONTHLY", "QUARTERLY", "YEARLY", "NONE"]) return false unless sales_tax_period_validator.valid?(@sales_tax_period) organisation_entity_type_validator = EnumAttributeValidator.new('String', ["ACCOUNTING_PRACTICE", "COMPANY", "CHARITY", "CLUB_OR_SOCIETY", "LOOK_THROUGH_COMPANY", "NOT_FOR_PROFIT", "PARTNERSHIP", "S_CORPORATION", "SELF_MANAGED_SUPERANNUATION_FUND", "SOLE_TRADER", "SUPERANNUATION_FUND", "TRUST"]) return false unless organisation_entity_type_validator.valid?(@organisation_entity_type) _class_validator = EnumAttributeValidator.new('String', ["DEMO", "TRIAL", "STARTER", "STANDARD", "PREMIUM", "PREMIUM_20", "PREMIUM_50", "PREMIUM_100", "LEDGER", "GST_CASHBOOK", "NON_GST_CASHBOOK"]) return false unless _class_validator.valid?(@_class) edition_validator = EnumAttributeValidator.new('String', ["BUSINESS", "PARTNER"]) return false unless edition_validator.valid?(@edition) true end |