xero-ruby 2.10.2 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/lib/xero-ruby.rb +4 -0
- data/lib/xero-ruby/api/accounting_api.rb +307 -151
- data/lib/xero-ruby/models/accounting/account.rb +13 -7
- data/lib/xero-ruby/models/accounting/accounts.rb +13 -7
- data/lib/xero-ruby/models/accounting/accounts_payable.rb +13 -7
- data/lib/xero-ruby/models/accounting/accounts_receivable.rb +13 -7
- data/lib/xero-ruby/models/accounting/action.rb +13 -7
- data/lib/xero-ruby/models/accounting/actions.rb +13 -7
- data/lib/xero-ruby/models/accounting/address.rb +13 -7
- data/lib/xero-ruby/models/accounting/address_for_organisation.rb +13 -7
- data/lib/xero-ruby/models/accounting/allocation.rb +13 -7
- data/lib/xero-ruby/models/accounting/allocations.rb +13 -7
- data/lib/xero-ruby/models/accounting/attachment.rb +13 -7
- data/lib/xero-ruby/models/accounting/attachments.rb +13 -7
- data/lib/xero-ruby/models/accounting/balance_details.rb +13 -7
- data/lib/xero-ruby/models/accounting/balances.rb +13 -7
- data/lib/xero-ruby/models/accounting/bank_transaction.rb +13 -7
- data/lib/xero-ruby/models/accounting/bank_transactions.rb +13 -7
- data/lib/xero-ruby/models/accounting/bank_transfer.rb +13 -7
- data/lib/xero-ruby/models/accounting/bank_transfers.rb +13 -7
- data/lib/xero-ruby/models/accounting/batch_payment.rb +13 -7
- data/lib/xero-ruby/models/accounting/batch_payment_details.rb +13 -7
- data/lib/xero-ruby/models/accounting/batch_payments.rb +13 -7
- data/lib/xero-ruby/models/accounting/bill.rb +13 -7
- data/lib/xero-ruby/models/accounting/branding_theme.rb +13 -7
- data/lib/xero-ruby/models/accounting/branding_themes.rb +13 -7
- data/lib/xero-ruby/models/accounting/budget.rb +327 -0
- data/lib/xero-ruby/models/accounting/budget_balance.rb +267 -0
- data/lib/xero-ruby/models/accounting/budget_line.rb +244 -0
- data/lib/xero-ruby/models/accounting/budgets.rb +224 -0
- data/lib/xero-ruby/models/accounting/cis_org_setting.rb +13 -7
- data/lib/xero-ruby/models/accounting/cis_org_settings.rb +13 -7
- data/lib/xero-ruby/models/accounting/cis_setting.rb +13 -7
- data/lib/xero-ruby/models/accounting/cis_settings.rb +13 -7
- data/lib/xero-ruby/models/accounting/contact.rb +13 -7
- data/lib/xero-ruby/models/accounting/contact_group.rb +13 -7
- data/lib/xero-ruby/models/accounting/contact_groups.rb +13 -7
- data/lib/xero-ruby/models/accounting/contact_person.rb +13 -7
- data/lib/xero-ruby/models/accounting/contacts.rb +13 -7
- data/lib/xero-ruby/models/accounting/conversion_balances.rb +13 -7
- data/lib/xero-ruby/models/accounting/conversion_date.rb +13 -7
- data/lib/xero-ruby/models/accounting/credit_note.rb +13 -7
- data/lib/xero-ruby/models/accounting/credit_notes.rb +13 -7
- data/lib/xero-ruby/models/accounting/currencies.rb +13 -7
- data/lib/xero-ruby/models/accounting/currency.rb +13 -7
- data/lib/xero-ruby/models/accounting/element.rb +13 -7
- data/lib/xero-ruby/models/accounting/employee.rb +13 -7
- data/lib/xero-ruby/models/accounting/employees.rb +13 -7
- data/lib/xero-ruby/models/accounting/error.rb +13 -7
- data/lib/xero-ruby/models/accounting/expense_claim.rb +13 -7
- data/lib/xero-ruby/models/accounting/expense_claims.rb +13 -7
- data/lib/xero-ruby/models/accounting/external_link.rb +13 -7
- data/lib/xero-ruby/models/accounting/history_record.rb +13 -7
- data/lib/xero-ruby/models/accounting/history_records.rb +13 -7
- data/lib/xero-ruby/models/accounting/import_summary.rb +13 -7
- data/lib/xero-ruby/models/accounting/import_summary_accounts.rb +13 -7
- data/lib/xero-ruby/models/accounting/import_summary_object.rb +13 -7
- data/lib/xero-ruby/models/accounting/import_summary_organisation.rb +13 -7
- data/lib/xero-ruby/models/accounting/invoice.rb +13 -7
- data/lib/xero-ruby/models/accounting/invoice_reminder.rb +13 -7
- data/lib/xero-ruby/models/accounting/invoice_reminders.rb +13 -7
- data/lib/xero-ruby/models/accounting/invoices.rb +13 -7
- data/lib/xero-ruby/models/accounting/item.rb +13 -7
- data/lib/xero-ruby/models/accounting/items.rb +13 -7
- data/lib/xero-ruby/models/accounting/journal.rb +13 -7
- data/lib/xero-ruby/models/accounting/journal_line.rb +13 -7
- data/lib/xero-ruby/models/accounting/journals.rb +13 -7
- data/lib/xero-ruby/models/accounting/line_item.rb +24 -8
- data/lib/xero-ruby/models/accounting/line_item_tracking.rb +13 -7
- data/lib/xero-ruby/models/accounting/linked_transaction.rb +13 -7
- data/lib/xero-ruby/models/accounting/linked_transactions.rb +13 -7
- data/lib/xero-ruby/models/accounting/manual_journal.rb +13 -7
- data/lib/xero-ruby/models/accounting/manual_journal_line.rb +13 -7
- data/lib/xero-ruby/models/accounting/manual_journals.rb +13 -7
- data/lib/xero-ruby/models/accounting/online_invoice.rb +13 -7
- data/lib/xero-ruby/models/accounting/online_invoices.rb +13 -7
- data/lib/xero-ruby/models/accounting/organisation.rb +13 -7
- data/lib/xero-ruby/models/accounting/organisations.rb +13 -7
- data/lib/xero-ruby/models/accounting/overpayment.rb +13 -7
- data/lib/xero-ruby/models/accounting/overpayments.rb +13 -7
- data/lib/xero-ruby/models/accounting/payment.rb +13 -7
- data/lib/xero-ruby/models/accounting/payment_delete.rb +13 -7
- data/lib/xero-ruby/models/accounting/payment_service.rb +13 -7
- data/lib/xero-ruby/models/accounting/payment_services.rb +13 -7
- data/lib/xero-ruby/models/accounting/payment_term.rb +13 -7
- data/lib/xero-ruby/models/accounting/payments.rb +13 -7
- data/lib/xero-ruby/models/accounting/phone.rb +13 -7
- data/lib/xero-ruby/models/accounting/prepayment.rb +26 -8
- data/lib/xero-ruby/models/accounting/prepayments.rb +13 -7
- data/lib/xero-ruby/models/accounting/purchase.rb +13 -7
- data/lib/xero-ruby/models/accounting/purchase_order.rb +13 -7
- data/lib/xero-ruby/models/accounting/purchase_orders.rb +13 -7
- data/lib/xero-ruby/models/accounting/quote.rb +13 -7
- data/lib/xero-ruby/models/accounting/quotes.rb +13 -7
- data/lib/xero-ruby/models/accounting/receipt.rb +13 -7
- data/lib/xero-ruby/models/accounting/receipts.rb +13 -7
- data/lib/xero-ruby/models/accounting/repeating_invoice.rb +13 -7
- data/lib/xero-ruby/models/accounting/repeating_invoices.rb +13 -7
- data/lib/xero-ruby/models/accounting/report.rb +14 -18
- data/lib/xero-ruby/models/accounting/report_attribute.rb +13 -7
- data/lib/xero-ruby/models/accounting/report_cell.rb +13 -7
- data/lib/xero-ruby/models/accounting/report_fields.rb +13 -7
- data/lib/xero-ruby/models/accounting/report_row.rb +13 -7
- data/lib/xero-ruby/models/accounting/report_rows.rb +13 -7
- data/lib/xero-ruby/models/accounting/report_with_row.rb +14 -8
- data/lib/xero-ruby/models/accounting/report_with_rows.rb +13 -7
- data/lib/xero-ruby/models/accounting/reports.rb +13 -7
- data/lib/xero-ruby/models/accounting/request_empty.rb +13 -7
- data/lib/xero-ruby/models/accounting/sales_tracking_category.rb +13 -7
- data/lib/xero-ruby/models/accounting/schedule.rb +13 -7
- data/lib/xero-ruby/models/accounting/setup.rb +13 -7
- data/lib/xero-ruby/models/accounting/tax_component.rb +13 -7
- data/lib/xero-ruby/models/accounting/tax_rate.rb +13 -7
- data/lib/xero-ruby/models/accounting/tax_rates.rb +13 -7
- data/lib/xero-ruby/models/accounting/ten_ninety_nine_contact.rb +13 -7
- data/lib/xero-ruby/models/accounting/tracking_categories.rb +13 -7
- data/lib/xero-ruby/models/accounting/tracking_category.rb +13 -7
- data/lib/xero-ruby/models/accounting/tracking_option.rb +13 -7
- data/lib/xero-ruby/models/accounting/tracking_options.rb +13 -7
- data/lib/xero-ruby/models/accounting/user.rb +13 -7
- data/lib/xero-ruby/models/accounting/users.rb +13 -7
- data/lib/xero-ruby/models/accounting/validation_error.rb +13 -7
- data/lib/xero-ruby/models/assets/asset.rb +13 -7
- data/lib/xero-ruby/models/assets/asset_type.rb +13 -7
- data/lib/xero-ruby/models/assets/assets.rb +13 -7
- data/lib/xero-ruby/models/assets/book_depreciation_detail.rb +13 -7
- data/lib/xero-ruby/models/assets/book_depreciation_setting.rb +13 -7
- data/lib/xero-ruby/models/assets/error.rb +13 -7
- data/lib/xero-ruby/models/assets/field_validation_errors_element.rb +13 -7
- data/lib/xero-ruby/models/assets/pagination.rb +13 -7
- data/lib/xero-ruby/models/assets/resource_validation_errors_element.rb +13 -7
- data/lib/xero-ruby/models/assets/setting.rb +13 -7
- data/lib/xero-ruby/models/files/association.rb +13 -7
- data/lib/xero-ruby/models/files/file_object.rb +13 -7
- data/lib/xero-ruby/models/files/files.rb +13 -7
- data/lib/xero-ruby/models/files/folder.rb +13 -7
- data/lib/xero-ruby/models/files/folders.rb +13 -7
- data/lib/xero-ruby/models/files/upload_object.rb +13 -7
- data/lib/xero-ruby/models/files/user.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/account.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/api_exception.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/bank_account.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/deduction_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/deduction_type.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/earnings_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/employee.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/employees.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/home_address.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/leave_accrual_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/leave_application.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/leave_applications.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/leave_balance.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/leave_earnings_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/leave_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/leave_lines.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/leave_period.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/leave_type.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/opening_balances.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/pay_item.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/pay_items.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/pay_run.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/pay_runs.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/pay_template.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/payroll_calendar.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/payroll_calendars.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/payslip.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/payslip_lines.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/payslip_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/payslip_summary.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/payslips.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/reimbursement_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/reimbursement_lines.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/reimbursement_type.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/settings.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/settings_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/settings_tracking_categories.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/settings_tracking_categories_employee_groups.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/settings_tracking_categories_timesheet_categories.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/super_fund.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/super_fund_product.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/super_fund_products.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/super_funds.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/super_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/super_membership.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/superannuation_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/tax_declaration.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/tax_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/timesheet.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/timesheet_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/timesheet_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/timesheets.rb +13 -7
- data/lib/xero-ruby/models/payroll_au/validation_error.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/account.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/accounts.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/address.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/bank_account.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/benefit.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/deduction.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/deduction_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/deduction_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/deductions.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/earnings_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/earnings_order.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/earnings_order_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/earnings_orders.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/earnings_rate.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/earnings_rate_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/earnings_rates.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/earnings_template.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/earnings_template_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_earnings_templates.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_leave.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_leave_balance.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_leave_balances.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_leave_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_leave_setup_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_leave_type_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_leave_types.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_leaves.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_opening_balance.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_opening_balances_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_pay_template.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_pay_template_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_pay_templates.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_balance.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_balance_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_summary.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_leaves_summaries.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leave.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leave_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leaves.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_tax.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employee_tax_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employees.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employment.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/employment_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/gross_earnings_history.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/invalid_field.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/leave_accrual_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/leave_earnings_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/leave_period.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/leave_periods.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/leave_type.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/leave_type_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/leave_types.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/pagination.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/pay_run.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/pay_run_calendar.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/pay_run_calendar_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/pay_run_calendars.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/pay_run_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/pay_runs.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/pay_slip.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/pay_slip_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/pay_slips.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/payment_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/payment_method.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/payment_method_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/problem.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/reimbursement.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/reimbursement_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/reimbursement_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/reimbursements.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/salary_and_wage.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/salary_and_wage_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/salary_and_wages.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/settings.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/statutory_deduction.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/statutory_deduction_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/statutory_deduction_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/statutory_deductions.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/superannuation_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/superannuation_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/superannuations.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/tax_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/tax_settings.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/timesheet.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/timesheet_earnings_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/timesheet_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/timesheet_line_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/timesheet_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/timesheets.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/tracking_categories.rb +13 -7
- data/lib/xero-ruby/models/payroll_nz/tracking_category.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/account.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/accounts.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/address.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/bank_account.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/benefit.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/benefit_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/benefit_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/benefits.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/court_order_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/deduction.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/deduction_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/deduction_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/deductions.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/earnings_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/earnings_order.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/earnings_order_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/earnings_orders.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +16 -9
- data/lib/xero-ruby/models/payroll_uk/earnings_rate_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/earnings_rates.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/earnings_template.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/earnings_template_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_leave.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_leave_balance.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_leave_balances.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_leave_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_leave_type.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_leave_type_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_leave_types.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_leaves.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_opening_balances.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_opening_balances_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_pay_template.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_pay_template_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_pay_templates.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_summary.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leaves_summaries.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leave.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leave_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leaves.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_tax.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employee_tax_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employees.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employment.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/employment_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/invalid_field.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/leave_accrual_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/leave_earnings_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/leave_period.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/leave_periods.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/leave_type.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/leave_type_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/leave_types.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/pagination.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/pay_run.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/pay_run_calendar.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/pay_run_calendar_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/pay_run_calendars.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/pay_run_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/pay_runs.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/payment_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/payment_method.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/payment_method_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/payslip.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/payslip_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/payslips.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/problem.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/reimbursement.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/reimbursement_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/reimbursement_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/reimbursements.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/salary_and_wage.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/salary_and_wage_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/salary_and_wages.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/settings.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/statutory_deduction.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/tax_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/timesheet.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/timesheet_earnings_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/timesheet_line.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/timesheet_line_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/timesheet_object.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/timesheets.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/tracking_categories.rb +13 -7
- data/lib/xero-ruby/models/payroll_uk/tracking_category.rb +13 -7
- data/lib/xero-ruby/models/projects/amount.rb +13 -7
- data/lib/xero-ruby/models/projects/error.rb +13 -7
- data/lib/xero-ruby/models/projects/pagination.rb +13 -7
- data/lib/xero-ruby/models/projects/project.rb +13 -7
- data/lib/xero-ruby/models/projects/project_create_or_update.rb +13 -7
- data/lib/xero-ruby/models/projects/project_patch.rb +13 -7
- data/lib/xero-ruby/models/projects/project_user.rb +13 -7
- data/lib/xero-ruby/models/projects/project_users.rb +13 -7
- data/lib/xero-ruby/models/projects/projects.rb +13 -7
- data/lib/xero-ruby/models/projects/task.rb +13 -7
- data/lib/xero-ruby/models/projects/task_create_or_update.rb +13 -7
- data/lib/xero-ruby/models/projects/tasks.rb +13 -7
- data/lib/xero-ruby/models/projects/time_entries.rb +13 -7
- data/lib/xero-ruby/models/projects/time_entry.rb +13 -7
- data/lib/xero-ruby/models/projects/time_entry_create_or_update.rb +13 -7
- data/lib/xero-ruby/version.rb +2 -2
- data/spec/helper_methods_spec.rb +28 -0
- metadata +9 -5
@@ -0,0 +1,267 @@
|
|
1
|
+
=begin
|
2
|
+
#Xero Accounting API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
Contact: api@xero.com
|
7
|
+
Generated by: https://openapi-generator.tech
|
8
|
+
OpenAPI Generator version: 4.3.1
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'time'
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module XeroRuby::Accounting
|
16
|
+
require 'bigdecimal'
|
17
|
+
|
18
|
+
class BudgetBalance
|
19
|
+
# Period the amount applies to (e.g. “2019-08”)
|
20
|
+
attr_accessor :period
|
21
|
+
|
22
|
+
# LineItem Quantity
|
23
|
+
attr_accessor :amount
|
24
|
+
|
25
|
+
# Budgeted amount
|
26
|
+
attr_accessor :unit_amount
|
27
|
+
|
28
|
+
# Any footnotes associated with this balance
|
29
|
+
attr_accessor :notes
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'period' => :'Period',
|
35
|
+
:'amount' => :'Amount',
|
36
|
+
:'unit_amount' => :'UnitAmount',
|
37
|
+
:'notes' => :'Notes'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.openapi_types
|
43
|
+
{
|
44
|
+
:'period' => :'Date',
|
45
|
+
:'amount' => :'Integer',
|
46
|
+
:'unit_amount' => :'Integer',
|
47
|
+
:'notes' => :'String'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
if (!attributes.is_a?(Hash))
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::BudgetBalance` initialize method"
|
56
|
+
end
|
57
|
+
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
60
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Accounting::BudgetBalance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
62
|
+
end
|
63
|
+
h[k.to_sym] = v
|
64
|
+
}
|
65
|
+
|
66
|
+
if attributes.key?(:'period')
|
67
|
+
self.period = attributes[:'period']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:'amount')
|
71
|
+
self.amount = attributes[:'amount']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'unit_amount')
|
75
|
+
self.unit_amount = attributes[:'unit_amount']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'notes')
|
79
|
+
self.notes = attributes[:'notes']
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
84
|
+
# @return Array for valid properties with the reasons
|
85
|
+
def list_invalid_properties
|
86
|
+
invalid_properties = Array.new
|
87
|
+
if !@notes.nil? && @notes.to_s.length > 255
|
88
|
+
invalid_properties.push('invalid value for "notes", the character length must be smaller than or equal to 255.')
|
89
|
+
end
|
90
|
+
|
91
|
+
invalid_properties
|
92
|
+
end
|
93
|
+
|
94
|
+
# Check to see if the all the properties in the model are valid
|
95
|
+
# @return true if the model is valid
|
96
|
+
def valid?
|
97
|
+
return false if !@notes.nil? && @notes.to_s.length > 255
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
101
|
+
# Custom attribute writer method with validation
|
102
|
+
# @param [Object] notes Value to be assigned
|
103
|
+
def notes=(notes)
|
104
|
+
if !notes.nil? && notes.to_s.length > 255
|
105
|
+
fail ArgumentError, 'invalid value for "notes", the character length must be smaller than or equal to 255.'
|
106
|
+
end
|
107
|
+
|
108
|
+
@notes = notes
|
109
|
+
end
|
110
|
+
|
111
|
+
# Checks equality by comparing each attribute.
|
112
|
+
# @param [Object] Object to be compared
|
113
|
+
def ==(o)
|
114
|
+
return true if self.equal?(o)
|
115
|
+
self.class == o.class &&
|
116
|
+
period == o.period &&
|
117
|
+
amount == o.amount &&
|
118
|
+
unit_amount == o.unit_amount &&
|
119
|
+
notes == o.notes
|
120
|
+
end
|
121
|
+
|
122
|
+
# @see the `==` method
|
123
|
+
# @param [Object] Object to be compared
|
124
|
+
def eql?(o)
|
125
|
+
self == o
|
126
|
+
end
|
127
|
+
|
128
|
+
# Calculates hash code according to all attributes.
|
129
|
+
# @return [Integer] Hash code
|
130
|
+
def hash
|
131
|
+
[period, amount, unit_amount, notes].hash
|
132
|
+
end
|
133
|
+
|
134
|
+
# Builds the object from hash
|
135
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
136
|
+
# @return [Object] Returns the model itself
|
137
|
+
def self.build_from_hash(attributes)
|
138
|
+
new.build_from_hash(attributes)
|
139
|
+
end
|
140
|
+
|
141
|
+
# Builds the object from hash
|
142
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
143
|
+
# @return [Object] Returns the model itself
|
144
|
+
def build_from_hash(attributes)
|
145
|
+
return nil unless attributes.is_a?(Hash)
|
146
|
+
self.class.openapi_types.each_pair do |key, type|
|
147
|
+
if type =~ /\AArray<(.*)>/i
|
148
|
+
# check to ensure the input is an array given that the attribute
|
149
|
+
# is documented as an array but the input is not
|
150
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
151
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
152
|
+
end
|
153
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
154
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
155
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
156
|
+
end
|
157
|
+
|
158
|
+
self
|
159
|
+
end
|
160
|
+
|
161
|
+
# Deserializes the data based on type
|
162
|
+
# @param string type Data type
|
163
|
+
# @param string value Value to be deserialized
|
164
|
+
# @return [Object] Deserialized data
|
165
|
+
def _deserialize(type, value)
|
166
|
+
case type.to_sym
|
167
|
+
when :DateTime
|
168
|
+
DateTime.parse(parse_date(value))
|
169
|
+
when :Date
|
170
|
+
Date.parse(parse_date(value))
|
171
|
+
when :String
|
172
|
+
value.to_s
|
173
|
+
when :Integer
|
174
|
+
value.to_i
|
175
|
+
when :Float
|
176
|
+
value.to_f
|
177
|
+
when :BigDecimal
|
178
|
+
BigDecimal(value.to_s)
|
179
|
+
when :Boolean
|
180
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
181
|
+
true
|
182
|
+
else
|
183
|
+
false
|
184
|
+
end
|
185
|
+
when :Object
|
186
|
+
# generic object (usually a Hash), return directly
|
187
|
+
value
|
188
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
189
|
+
inner_type = Regexp.last_match[:inner_type]
|
190
|
+
value.map { |v| _deserialize(inner_type, v) }
|
191
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
192
|
+
k_type = Regexp.last_match[:k_type]
|
193
|
+
v_type = Regexp.last_match[:v_type]
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each do |k, v|
|
196
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
else # model
|
200
|
+
XeroRuby::Accounting.const_get(type).build_from_hash(value)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# Returns the string representation of the object
|
205
|
+
# @return [String] String presentation of the object
|
206
|
+
def to_s
|
207
|
+
to_hash.to_s
|
208
|
+
end
|
209
|
+
|
210
|
+
# to_body is an alias to to_hash (backward compatibility)
|
211
|
+
# @return [Hash] Returns the object in the form of hash
|
212
|
+
def to_body
|
213
|
+
to_hash
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns the object in the form of hash
|
217
|
+
# @return [Hash] Returns the object in the form of hash
|
218
|
+
def to_hash(downcase: false)
|
219
|
+
hash = {}
|
220
|
+
self.class.attribute_map.each_pair do |attr, param|
|
221
|
+
value = self.send(attr)
|
222
|
+
next if value.nil?
|
223
|
+
key = downcase ? attr : param
|
224
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
225
|
+
end
|
226
|
+
hash
|
227
|
+
end
|
228
|
+
|
229
|
+
# Returns the object in the form of hash with snake_case
|
230
|
+
def to_attributes
|
231
|
+
to_hash(downcase: true)
|
232
|
+
end
|
233
|
+
|
234
|
+
# Outputs non-array value in the form of hash
|
235
|
+
# For object, use to_hash. Otherwise, just return the value
|
236
|
+
# @param [Object] value Any valid value
|
237
|
+
# @return [Hash] Returns the value in the form of hash
|
238
|
+
def _to_hash(value, downcase: false)
|
239
|
+
if value.is_a?(Array)
|
240
|
+
value.map do |v|
|
241
|
+
v.to_hash(downcase: downcase)
|
242
|
+
end
|
243
|
+
elsif value.is_a?(Hash)
|
244
|
+
{}.tap do |hash|
|
245
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
246
|
+
end
|
247
|
+
elsif value.respond_to? :to_hash
|
248
|
+
value.to_hash(downcase: downcase)
|
249
|
+
else
|
250
|
+
value
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
def parse_date(datestring)
|
255
|
+
if datestring.include?('Date')
|
256
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
257
|
+
original, date, timezone = *date_pattern.match(datestring)
|
258
|
+
date = (date.to_i / 1000)
|
259
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
260
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
261
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
262
|
+
else # handle date 'types' for small subset of payroll API's
|
263
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
@@ -0,0 +1,244 @@
|
|
1
|
+
=begin
|
2
|
+
#Xero Accounting API
|
3
|
+
|
4
|
+
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
|
+
|
6
|
+
Contact: api@xero.com
|
7
|
+
Generated by: https://openapi-generator.tech
|
8
|
+
OpenAPI Generator version: 4.3.1
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'time'
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module XeroRuby::Accounting
|
16
|
+
require 'bigdecimal'
|
17
|
+
|
18
|
+
class BudgetLine
|
19
|
+
# See Accounts
|
20
|
+
attr_accessor :account_id
|
21
|
+
|
22
|
+
# See Accounts
|
23
|
+
attr_accessor :account_code
|
24
|
+
|
25
|
+
|
26
|
+
attr_accessor :budget_balances
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'account_id' => :'AccountID',
|
32
|
+
:'account_code' => :'AccountCode',
|
33
|
+
:'budget_balances' => :'BudgetBalances'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.openapi_types
|
39
|
+
{
|
40
|
+
:'account_id' => :'String',
|
41
|
+
:'account_code' => :'String',
|
42
|
+
:'budget_balances' => :'Array<BudgetBalance>'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
if (!attributes.is_a?(Hash))
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::BudgetLine` initialize method"
|
51
|
+
end
|
52
|
+
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Accounting::BudgetLine`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
57
|
+
end
|
58
|
+
h[k.to_sym] = v
|
59
|
+
}
|
60
|
+
|
61
|
+
if attributes.key?(:'account_id')
|
62
|
+
self.account_id = attributes[:'account_id']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.key?(:'account_code')
|
66
|
+
self.account_code = attributes[:'account_code']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.key?(:'budget_balances')
|
70
|
+
if (value = attributes[:'budget_balances']).is_a?(Array)
|
71
|
+
self.budget_balances = value
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
77
|
+
# @return Array for valid properties with the reasons
|
78
|
+
def list_invalid_properties
|
79
|
+
invalid_properties = Array.new
|
80
|
+
invalid_properties
|
81
|
+
end
|
82
|
+
|
83
|
+
# Check to see if the all the properties in the model are valid
|
84
|
+
# @return true if the model is valid
|
85
|
+
def valid?
|
86
|
+
true
|
87
|
+
end
|
88
|
+
|
89
|
+
# Checks equality by comparing each attribute.
|
90
|
+
# @param [Object] Object to be compared
|
91
|
+
def ==(o)
|
92
|
+
return true if self.equal?(o)
|
93
|
+
self.class == o.class &&
|
94
|
+
account_id == o.account_id &&
|
95
|
+
account_code == o.account_code &&
|
96
|
+
budget_balances == o.budget_balances
|
97
|
+
end
|
98
|
+
|
99
|
+
# @see the `==` method
|
100
|
+
# @param [Object] Object to be compared
|
101
|
+
def eql?(o)
|
102
|
+
self == o
|
103
|
+
end
|
104
|
+
|
105
|
+
# Calculates hash code according to all attributes.
|
106
|
+
# @return [Integer] Hash code
|
107
|
+
def hash
|
108
|
+
[account_id, account_code, budget_balances].hash
|
109
|
+
end
|
110
|
+
|
111
|
+
# Builds the object from hash
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
113
|
+
# @return [Object] Returns the model itself
|
114
|
+
def self.build_from_hash(attributes)
|
115
|
+
new.build_from_hash(attributes)
|
116
|
+
end
|
117
|
+
|
118
|
+
# Builds the object from hash
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
+
# @return [Object] Returns the model itself
|
121
|
+
def build_from_hash(attributes)
|
122
|
+
return nil unless attributes.is_a?(Hash)
|
123
|
+
self.class.openapi_types.each_pair do |key, type|
|
124
|
+
if type =~ /\AArray<(.*)>/i
|
125
|
+
# check to ensure the input is an array given that the attribute
|
126
|
+
# is documented as an array but the input is not
|
127
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
128
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
129
|
+
end
|
130
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
131
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
132
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
133
|
+
end
|
134
|
+
|
135
|
+
self
|
136
|
+
end
|
137
|
+
|
138
|
+
# Deserializes the data based on type
|
139
|
+
# @param string type Data type
|
140
|
+
# @param string value Value to be deserialized
|
141
|
+
# @return [Object] Deserialized data
|
142
|
+
def _deserialize(type, value)
|
143
|
+
case type.to_sym
|
144
|
+
when :DateTime
|
145
|
+
DateTime.parse(parse_date(value))
|
146
|
+
when :Date
|
147
|
+
Date.parse(parse_date(value))
|
148
|
+
when :String
|
149
|
+
value.to_s
|
150
|
+
when :Integer
|
151
|
+
value.to_i
|
152
|
+
when :Float
|
153
|
+
value.to_f
|
154
|
+
when :BigDecimal
|
155
|
+
BigDecimal(value.to_s)
|
156
|
+
when :Boolean
|
157
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
158
|
+
true
|
159
|
+
else
|
160
|
+
false
|
161
|
+
end
|
162
|
+
when :Object
|
163
|
+
# generic object (usually a Hash), return directly
|
164
|
+
value
|
165
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
166
|
+
inner_type = Regexp.last_match[:inner_type]
|
167
|
+
value.map { |v| _deserialize(inner_type, v) }
|
168
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
169
|
+
k_type = Regexp.last_match[:k_type]
|
170
|
+
v_type = Regexp.last_match[:v_type]
|
171
|
+
{}.tap do |hash|
|
172
|
+
value.each do |k, v|
|
173
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
else # model
|
177
|
+
XeroRuby::Accounting.const_get(type).build_from_hash(value)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns the string representation of the object
|
182
|
+
# @return [String] String presentation of the object
|
183
|
+
def to_s
|
184
|
+
to_hash.to_s
|
185
|
+
end
|
186
|
+
|
187
|
+
# to_body is an alias to to_hash (backward compatibility)
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_body
|
190
|
+
to_hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the object in the form of hash
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
195
|
+
def to_hash(downcase: false)
|
196
|
+
hash = {}
|
197
|
+
self.class.attribute_map.each_pair do |attr, param|
|
198
|
+
value = self.send(attr)
|
199
|
+
next if value.nil?
|
200
|
+
key = downcase ? attr : param
|
201
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
202
|
+
end
|
203
|
+
hash
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns the object in the form of hash with snake_case
|
207
|
+
def to_attributes
|
208
|
+
to_hash(downcase: true)
|
209
|
+
end
|
210
|
+
|
211
|
+
# Outputs non-array value in the form of hash
|
212
|
+
# For object, use to_hash. Otherwise, just return the value
|
213
|
+
# @param [Object] value Any valid value
|
214
|
+
# @return [Hash] Returns the value in the form of hash
|
215
|
+
def _to_hash(value, downcase: false)
|
216
|
+
if value.is_a?(Array)
|
217
|
+
value.map do |v|
|
218
|
+
v.to_hash(downcase: downcase)
|
219
|
+
end
|
220
|
+
elsif value.is_a?(Hash)
|
221
|
+
{}.tap do |hash|
|
222
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
223
|
+
end
|
224
|
+
elsif value.respond_to? :to_hash
|
225
|
+
value.to_hash(downcase: downcase)
|
226
|
+
else
|
227
|
+
value
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
def parse_date(datestring)
|
232
|
+
if datestring.include?('Date')
|
233
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
234
|
+
original, date, timezone = *date_pattern.match(datestring)
|
235
|
+
date = (date.to_i / 1000)
|
236
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
237
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
238
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
239
|
+
else # handle date 'types' for small subset of payroll API's
|
240
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|