xero-ruby 3.0.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +257 -222
- data/lib/xero-ruby/api/accounting_api.rb +305 -152
- data/lib/xero-ruby/api/app_store_api.rb +87 -0
- data/lib/xero-ruby/api_client.rb +34 -5
- data/lib/xero-ruby/configuration.rb +2 -0
- data/lib/xero-ruby/models/accounting/account.rb +2 -0
- data/lib/xero-ruby/models/accounting/accounts.rb +2 -0
- data/lib/xero-ruby/models/accounting/accounts_payable.rb +2 -0
- data/lib/xero-ruby/models/accounting/accounts_receivable.rb +2 -0
- data/lib/xero-ruby/models/accounting/action.rb +2 -0
- data/lib/xero-ruby/models/accounting/actions.rb +2 -0
- data/lib/xero-ruby/models/accounting/address.rb +2 -0
- data/lib/xero-ruby/models/accounting/address_for_organisation.rb +2 -0
- data/lib/xero-ruby/models/accounting/allocation.rb +2 -0
- data/lib/xero-ruby/models/accounting/allocations.rb +2 -0
- data/lib/xero-ruby/models/accounting/attachment.rb +2 -0
- data/lib/xero-ruby/models/accounting/attachments.rb +2 -0
- data/lib/xero-ruby/models/accounting/balance_details.rb +2 -0
- data/lib/xero-ruby/models/accounting/balances.rb +2 -0
- data/lib/xero-ruby/models/accounting/bank_transaction.rb +2 -0
- data/lib/xero-ruby/models/accounting/bank_transactions.rb +2 -0
- data/lib/xero-ruby/models/accounting/bank_transfer.rb +2 -0
- data/lib/xero-ruby/models/accounting/bank_transfers.rb +2 -0
- data/lib/xero-ruby/models/accounting/batch_payment.rb +2 -0
- data/lib/xero-ruby/models/accounting/batch_payment_details.rb +2 -0
- data/lib/xero-ruby/models/accounting/batch_payments.rb +2 -0
- data/lib/xero-ruby/models/accounting/bill.rb +2 -0
- data/lib/xero-ruby/models/accounting/branding_theme.rb +2 -0
- data/lib/xero-ruby/models/accounting/branding_themes.rb +2 -0
- 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 +2 -0
- data/lib/xero-ruby/models/accounting/cis_org_settings.rb +2 -0
- data/lib/xero-ruby/models/accounting/cis_setting.rb +2 -0
- data/lib/xero-ruby/models/accounting/cis_settings.rb +2 -0
- data/lib/xero-ruby/models/accounting/contact.rb +2 -0
- data/lib/xero-ruby/models/accounting/contact_group.rb +2 -0
- data/lib/xero-ruby/models/accounting/contact_groups.rb +2 -0
- data/lib/xero-ruby/models/accounting/contact_person.rb +2 -0
- data/lib/xero-ruby/models/accounting/contacts.rb +2 -0
- data/lib/xero-ruby/models/accounting/conversion_balances.rb +2 -0
- data/lib/xero-ruby/models/accounting/conversion_date.rb +2 -0
- data/lib/xero-ruby/models/accounting/credit_note.rb +2 -0
- data/lib/xero-ruby/models/accounting/credit_notes.rb +2 -0
- data/lib/xero-ruby/models/accounting/currencies.rb +2 -0
- data/lib/xero-ruby/models/accounting/currency.rb +2 -0
- data/lib/xero-ruby/models/accounting/element.rb +2 -0
- data/lib/xero-ruby/models/accounting/employee.rb +2 -0
- data/lib/xero-ruby/models/accounting/employees.rb +2 -0
- data/lib/xero-ruby/models/accounting/error.rb +2 -0
- data/lib/xero-ruby/models/accounting/expense_claim.rb +2 -0
- data/lib/xero-ruby/models/accounting/expense_claims.rb +2 -0
- data/lib/xero-ruby/models/accounting/external_link.rb +2 -0
- data/lib/xero-ruby/models/accounting/history_record.rb +2 -0
- data/lib/xero-ruby/models/accounting/history_records.rb +2 -0
- data/lib/xero-ruby/models/accounting/import_summary.rb +2 -0
- data/lib/xero-ruby/models/accounting/import_summary_accounts.rb +2 -0
- data/lib/xero-ruby/models/accounting/import_summary_object.rb +2 -0
- data/lib/xero-ruby/models/accounting/import_summary_organisation.rb +2 -0
- data/lib/xero-ruby/models/accounting/invoice.rb +2 -0
- data/lib/xero-ruby/models/accounting/invoice_reminder.rb +2 -0
- data/lib/xero-ruby/models/accounting/invoice_reminders.rb +2 -0
- data/lib/xero-ruby/models/accounting/invoices.rb +2 -0
- data/lib/xero-ruby/models/accounting/item.rb +2 -0
- data/lib/xero-ruby/models/accounting/items.rb +2 -0
- data/lib/xero-ruby/models/accounting/journal.rb +2 -0
- data/lib/xero-ruby/models/accounting/journal_line.rb +2 -0
- data/lib/xero-ruby/models/accounting/journals.rb +2 -0
- data/lib/xero-ruby/models/accounting/line_item.rb +13 -1
- data/lib/xero-ruby/models/accounting/line_item_tracking.rb +2 -0
- data/lib/xero-ruby/models/accounting/linked_transaction.rb +2 -0
- data/lib/xero-ruby/models/accounting/linked_transactions.rb +2 -0
- data/lib/xero-ruby/models/accounting/manual_journal.rb +2 -0
- data/lib/xero-ruby/models/accounting/manual_journal_line.rb +2 -0
- data/lib/xero-ruby/models/accounting/manual_journals.rb +2 -0
- data/lib/xero-ruby/models/accounting/online_invoice.rb +2 -0
- data/lib/xero-ruby/models/accounting/online_invoices.rb +2 -0
- data/lib/xero-ruby/models/accounting/organisation.rb +2 -0
- data/lib/xero-ruby/models/accounting/organisations.rb +2 -0
- data/lib/xero-ruby/models/accounting/overpayment.rb +2 -0
- data/lib/xero-ruby/models/accounting/overpayments.rb +2 -0
- data/lib/xero-ruby/models/accounting/payment.rb +13 -1
- data/lib/xero-ruby/models/accounting/payment_delete.rb +2 -0
- data/lib/xero-ruby/models/accounting/payment_service.rb +2 -0
- data/lib/xero-ruby/models/accounting/payment_services.rb +2 -0
- data/lib/xero-ruby/models/accounting/payment_term.rb +2 -0
- data/lib/xero-ruby/models/accounting/payments.rb +2 -0
- data/lib/xero-ruby/models/accounting/phone.rb +2 -0
- data/lib/xero-ruby/models/accounting/prepayment.rb +2 -0
- data/lib/xero-ruby/models/accounting/prepayments.rb +2 -0
- data/lib/xero-ruby/models/accounting/purchase.rb +2 -0
- data/lib/xero-ruby/models/accounting/purchase_order.rb +2 -0
- data/lib/xero-ruby/models/accounting/purchase_orders.rb +2 -0
- data/lib/xero-ruby/models/accounting/quote.rb +2 -0
- data/lib/xero-ruby/models/accounting/quotes.rb +2 -0
- data/lib/xero-ruby/models/accounting/receipt.rb +2 -0
- data/lib/xero-ruby/models/accounting/receipts.rb +2 -0
- data/lib/xero-ruby/models/accounting/repeating_invoice.rb +2 -0
- data/lib/xero-ruby/models/accounting/repeating_invoices.rb +2 -0
- data/lib/xero-ruby/models/accounting/report.rb +3 -11
- data/lib/xero-ruby/models/accounting/report_attribute.rb +2 -0
- data/lib/xero-ruby/models/accounting/report_cell.rb +2 -0
- data/lib/xero-ruby/models/accounting/report_fields.rb +2 -0
- data/lib/xero-ruby/models/accounting/report_row.rb +2 -0
- data/lib/xero-ruby/models/accounting/report_rows.rb +2 -0
- data/lib/xero-ruby/models/accounting/report_with_row.rb +3 -1
- data/lib/xero-ruby/models/accounting/report_with_rows.rb +2 -0
- data/lib/xero-ruby/models/accounting/reports.rb +2 -0
- data/lib/xero-ruby/models/accounting/request_empty.rb +2 -0
- data/lib/xero-ruby/models/accounting/sales_tracking_category.rb +2 -0
- data/lib/xero-ruby/models/accounting/schedule.rb +2 -0
- data/lib/xero-ruby/models/accounting/setup.rb +2 -0
- data/lib/xero-ruby/models/accounting/tax_component.rb +2 -0
- data/lib/xero-ruby/models/accounting/tax_rate.rb +2 -0
- data/lib/xero-ruby/models/accounting/tax_rates.rb +2 -0
- data/lib/xero-ruby/models/accounting/ten_ninety_nine_contact.rb +2 -0
- data/lib/xero-ruby/models/accounting/time_zone.rb +1 -0
- data/lib/xero-ruby/models/accounting/tracking_categories.rb +2 -0
- data/lib/xero-ruby/models/accounting/tracking_category.rb +2 -0
- data/lib/xero-ruby/models/accounting/tracking_option.rb +2 -0
- data/lib/xero-ruby/models/accounting/tracking_options.rb +2 -0
- data/lib/xero-ruby/models/accounting/user.rb +2 -0
- data/lib/xero-ruby/models/accounting/users.rb +2 -0
- data/lib/xero-ruby/models/accounting/validation_error.rb +2 -0
- data/lib/xero-ruby/models/app_store/plan.rb +310 -0
- data/lib/xero-ruby/models/app_store/price.rb +257 -0
- data/lib/xero-ruby/models/app_store/problem_details.rb +272 -0
- data/lib/xero-ruby/models/app_store/product.rb +278 -0
- data/lib/xero-ruby/models/app_store/subscription.rb +324 -0
- data/lib/xero-ruby/models/app_store/subscription_item.rb +292 -0
- data/lib/xero-ruby/models/assets/asset.rb +2 -0
- data/lib/xero-ruby/models/assets/asset_type.rb +2 -0
- data/lib/xero-ruby/models/assets/assets.rb +2 -0
- data/lib/xero-ruby/models/assets/book_depreciation_detail.rb +2 -0
- data/lib/xero-ruby/models/assets/book_depreciation_setting.rb +2 -0
- data/lib/xero-ruby/models/assets/error.rb +2 -0
- data/lib/xero-ruby/models/assets/field_validation_errors_element.rb +2 -0
- data/lib/xero-ruby/models/assets/pagination.rb +2 -0
- data/lib/xero-ruby/models/assets/resource_validation_errors_element.rb +2 -0
- data/lib/xero-ruby/models/assets/setting.rb +2 -0
- data/lib/xero-ruby/models/files/association.rb +2 -0
- data/lib/xero-ruby/models/files/file_object.rb +2 -0
- data/lib/xero-ruby/models/files/files.rb +2 -0
- data/lib/xero-ruby/models/files/folder.rb +2 -0
- data/lib/xero-ruby/models/files/folders.rb +2 -0
- data/lib/xero-ruby/models/files/upload_object.rb +2 -0
- data/lib/xero-ruby/models/files/user.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/account.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/api_exception.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/bank_account.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/deduction_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/deduction_type.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/earnings_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/employee.rb +32 -1
- data/lib/xero-ruby/models/payroll_au/employees.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/home_address.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/leave_accrual_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/leave_application.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/leave_applications.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/leave_balance.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/leave_earnings_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/leave_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/leave_lines.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/leave_period.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/leave_type.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/opening_balances.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/pay_item.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/pay_items.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/pay_run.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/pay_runs.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/pay_template.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/payroll_calendar.rb +13 -1
- data/lib/xero-ruby/models/payroll_au/payroll_calendars.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/payslip.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/payslip_lines.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/payslip_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/payslip_summary.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/payslips.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/reimbursement_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/reimbursement_lines.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/reimbursement_type.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/settings.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/settings_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/settings_tracking_categories.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/settings_tracking_categories_employee_groups.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/settings_tracking_categories_timesheet_categories.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/super_fund.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/super_fund_product.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/super_fund_products.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/super_funds.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/super_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/super_membership.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/superannuation_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/tax_declaration.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/tax_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/timesheet.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/timesheet_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/timesheet_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/timesheets.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/validation_error.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/account.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/accounts.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/address.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/bank_account.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/benefit.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/deduction.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/deduction_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/deduction_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/deductions.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/earnings_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/earnings_order.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/earnings_order_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/earnings_orders.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/earnings_rate.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/earnings_rate_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/earnings_rates.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/earnings_template.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/earnings_template_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_earnings_templates.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_leave.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_leave_balance.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_leave_balances.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_leave_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_leave_setup_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_leave_type_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_leave_types.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_leaves.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_opening_balance.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_opening_balances_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_pay_template.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_pay_template_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_pay_templates.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_balance.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_balance_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_summary.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_leaves_summaries.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leave.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leave_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leaves.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_tax.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employee_tax_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employees.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employment.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/employment_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/gross_earnings_history.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/invalid_field.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/leave_accrual_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/leave_earnings_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/leave_period.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/leave_periods.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/leave_type.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/leave_type_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/leave_types.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/pagination.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/pay_run.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/pay_run_calendar.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/pay_run_calendar_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/pay_run_calendars.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/pay_run_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/pay_runs.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/pay_slip.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/pay_slip_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/pay_slips.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/payment_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/payment_method.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/payment_method_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/problem.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/reimbursement.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/reimbursement_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/reimbursement_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/reimbursements.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/salary_and_wage.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/salary_and_wage_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/salary_and_wages.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/settings.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/statutory_deduction.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/statutory_deduction_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/statutory_deduction_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/statutory_deductions.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/superannuation_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/superannuation_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/superannuations.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/tax_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/tax_settings.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/timesheet.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/timesheet_earnings_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/timesheet_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/timesheet_line_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/timesheet_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/timesheets.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/tracking_categories.rb +2 -0
- data/lib/xero-ruby/models/payroll_nz/tracking_category.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/account.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/accounts.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/address.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/bank_account.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/benefit.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/benefit_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/benefit_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/benefits.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/court_order_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/deduction.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/deduction_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/deduction_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/deductions.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/earnings_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/earnings_order.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/earnings_order_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/earnings_orders.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +5 -2
- data/lib/xero-ruby/models/payroll_uk/earnings_rate_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/earnings_rates.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/earnings_template.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/earnings_template_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_leave.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_leave_balance.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_leave_balances.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_leave_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_leave_type.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_leave_type_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_leave_types.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_leaves.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_opening_balances.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_opening_balances_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_pay_template.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_pay_template_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_pay_templates.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_summary.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leaves_summaries.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leave.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leave_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leaves.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_tax.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employee_tax_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employees.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employment.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/employment_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/invalid_field.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/leave_accrual_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/leave_earnings_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/leave_period.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/leave_periods.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/leave_type.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/leave_type_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/leave_types.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/pagination.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/pay_run.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/pay_run_calendar.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/pay_run_calendar_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/pay_run_calendars.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/pay_run_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/pay_runs.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/payment_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/payment_method.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/payment_method_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/payslip.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/payslip_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/payslips.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/problem.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/reimbursement.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/reimbursement_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/reimbursement_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/reimbursements.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/salary_and_wage.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/salary_and_wage_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/salary_and_wages.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/settings.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/statutory_deduction.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/tax_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/timesheet.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/timesheet_earnings_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/timesheet_line.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/timesheet_line_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/timesheet_object.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/timesheets.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/tracking_categories.rb +2 -0
- data/lib/xero-ruby/models/payroll_uk/tracking_category.rb +2 -0
- data/lib/xero-ruby/models/projects/amount.rb +2 -0
- data/lib/xero-ruby/models/projects/error.rb +2 -0
- data/lib/xero-ruby/models/projects/pagination.rb +2 -0
- data/lib/xero-ruby/models/projects/project.rb +2 -0
- data/lib/xero-ruby/models/projects/project_create_or_update.rb +2 -0
- data/lib/xero-ruby/models/projects/project_patch.rb +2 -0
- data/lib/xero-ruby/models/projects/project_user.rb +2 -0
- data/lib/xero-ruby/models/projects/project_users.rb +2 -0
- data/lib/xero-ruby/models/projects/projects.rb +2 -0
- data/lib/xero-ruby/models/projects/task.rb +2 -0
- data/lib/xero-ruby/models/projects/task_create_or_update.rb +2 -0
- data/lib/xero-ruby/models/projects/tasks.rb +2 -0
- data/lib/xero-ruby/models/projects/time_entries.rb +2 -0
- data/lib/xero-ruby/models/projects/time_entry.rb +2 -0
- data/lib/xero-ruby/models/projects/time_entry_create_or_update.rb +2 -0
- data/lib/xero-ruby/version.rb +2 -2
- data/lib/xero-ruby.rb +11 -0
- data/spec/api_client_spec.rb +25 -2
- data/spec/app_store/api/app_store_api_spec.rb +45 -0
- data/spec/app_store/models/plan_spec.rb +62 -0
- data/spec/app_store/models/price_spec.rb +52 -0
- data/spec/app_store/models/problem_details_spec.rb +70 -0
- data/spec/app_store/models/product_spec.rb +56 -0
- data/spec/app_store/models/subscription_item_spec.rb +70 -0
- data/spec/app_store/models/subscription_spec.rb +82 -0
- metadata +30 -5
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Xero AppStore API
|
|
3
|
+
|
|
4
|
+
#These endpoints are for Xero Partners to interact with the App Store Billing platform
|
|
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
|
+
module XeroRuby
|
|
13
|
+
class AppStoreApi
|
|
14
|
+
attr_accessor :api_client
|
|
15
|
+
|
|
16
|
+
def initialize(api_client = ApiClient.new)
|
|
17
|
+
@api_client = api_client
|
|
18
|
+
end
|
|
19
|
+
# Retrieves a subscription for a given subscriptionId
|
|
20
|
+
# @param subscription_id [String] Unique identifier for Subscription object
|
|
21
|
+
# @param [Hash] opts the optional parameters
|
|
22
|
+
# @return [Subscription]
|
|
23
|
+
def get_subscription(subscription_id, opts = {})
|
|
24
|
+
data, _status_code, _headers = get_subscription_with_http_info(subscription_id, opts)
|
|
25
|
+
data
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Retrieves a subscription for a given subscriptionId
|
|
29
|
+
# @param subscription_id [String] Unique identifier for Subscription object
|
|
30
|
+
# @param [Hash] opts the optional parameters
|
|
31
|
+
# @return [Array<(Subscription, Integer, Hash)>] Subscription data, response status code and response headers
|
|
32
|
+
def get_subscription_with_http_info(subscription_id, options = {})
|
|
33
|
+
opts = options.dup
|
|
34
|
+
if @api_client.config.debugging
|
|
35
|
+
@api_client.config.logger.debug 'Calling API: AppStoreApi.get_subscription ...'
|
|
36
|
+
end
|
|
37
|
+
# verify the required parameter 'subscription_id' is set
|
|
38
|
+
if @api_client.config.client_side_validation && subscription_id.nil?
|
|
39
|
+
fail ArgumentError, "Missing the required parameter 'subscription_id' when calling AppStoreApi.get_subscription"
|
|
40
|
+
end
|
|
41
|
+
# resource path
|
|
42
|
+
local_var_path = '/subscriptions/{subscriptionId}'.sub('{' + 'subscriptionId' + '}', subscription_id.to_s)
|
|
43
|
+
|
|
44
|
+
# camelize keys of incoming `where` opts
|
|
45
|
+
opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
|
|
46
|
+
|
|
47
|
+
# query parameters
|
|
48
|
+
query_params = opts[:query_params] || {}
|
|
49
|
+
|
|
50
|
+
# XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
|
|
51
|
+
query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
|
|
52
|
+
query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
|
|
53
|
+
|
|
54
|
+
# header parameters
|
|
55
|
+
header_params = opts[:header_params] || {}
|
|
56
|
+
# HTTP header 'Accept' (if needed)
|
|
57
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
58
|
+
|
|
59
|
+
# form parameters
|
|
60
|
+
form_params = opts[:form_params] || {}
|
|
61
|
+
|
|
62
|
+
# http body (model)
|
|
63
|
+
post_body = opts[:body]
|
|
64
|
+
|
|
65
|
+
# return_type
|
|
66
|
+
return_type = opts[:return_type] || 'Subscription'
|
|
67
|
+
|
|
68
|
+
# auth_names
|
|
69
|
+
auth_names = opts[:auth_names] || ['OAuth2']
|
|
70
|
+
|
|
71
|
+
new_options = opts.merge(
|
|
72
|
+
:header_params => header_params,
|
|
73
|
+
:query_params => query_params,
|
|
74
|
+
:form_params => form_params,
|
|
75
|
+
:body => post_body,
|
|
76
|
+
:auth_names => auth_names,
|
|
77
|
+
:return_type => return_type
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, "AppStoreApi", new_options)
|
|
81
|
+
if @api_client.config.debugging
|
|
82
|
+
@api_client.config.logger.debug "API called: AppStoreApi#get_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
83
|
+
end
|
|
84
|
+
return data, status_code, headers
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
data/lib/xero-ruby/api_client.rb
CHANGED
|
@@ -29,7 +29,7 @@ module XeroRuby
|
|
|
29
29
|
# Defines the headers to be used in HTTP requests of all API calls by default.
|
|
30
30
|
#
|
|
31
31
|
# @return [Hash]
|
|
32
|
-
attr_accessor :default_headers
|
|
32
|
+
attr_accessor :default_headers, :grant_type
|
|
33
33
|
|
|
34
34
|
# Initializes the ApiClient
|
|
35
35
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
|
@@ -37,6 +37,7 @@ module XeroRuby
|
|
|
37
37
|
@client_id = credentials[:client_id]
|
|
38
38
|
@client_secret = credentials[:client_secret]
|
|
39
39
|
@redirect_uri = credentials[:redirect_uri]
|
|
40
|
+
@grant_type = credentials[:grant_type] || 'authorization_code'
|
|
40
41
|
@scopes = credentials[:scopes]
|
|
41
42
|
@state = credentials[:state]
|
|
42
43
|
default_config = Configuration.default.clone
|
|
@@ -56,9 +57,17 @@ module XeroRuby
|
|
|
56
57
|
end
|
|
57
58
|
|
|
58
59
|
def authorization_url
|
|
59
|
-
url =
|
|
60
|
-
url
|
|
61
|
-
|
|
60
|
+
url = URI.parse(@config.login_url)
|
|
61
|
+
url.query = URI.encode_www_form(
|
|
62
|
+
{
|
|
63
|
+
response_type: 'code',
|
|
64
|
+
client_id: @client_id,
|
|
65
|
+
redirect_uri: @redirect_uri,
|
|
66
|
+
scope: @scopes,
|
|
67
|
+
state: @state
|
|
68
|
+
}.compact
|
|
69
|
+
)
|
|
70
|
+
url.to_s
|
|
62
71
|
end
|
|
63
72
|
|
|
64
73
|
def accounting_api
|
|
@@ -96,6 +105,11 @@ module XeroRuby
|
|
|
96
105
|
XeroRuby::PayrollUkApi.new(self)
|
|
97
106
|
end
|
|
98
107
|
|
|
108
|
+
def app_store_api
|
|
109
|
+
@config.base_url = @config.app_store_url
|
|
110
|
+
XeroRuby::AppStoreApi.new(self)
|
|
111
|
+
end
|
|
112
|
+
|
|
99
113
|
# Token Helpers
|
|
100
114
|
def token_set
|
|
101
115
|
@config.token_set
|
|
@@ -135,9 +149,18 @@ module XeroRuby
|
|
|
135
149
|
@config.id_token = id_token
|
|
136
150
|
end
|
|
137
151
|
|
|
152
|
+
def get_client_credentials_token
|
|
153
|
+
data = {
|
|
154
|
+
grant_type: @grant_type
|
|
155
|
+
}
|
|
156
|
+
token_set = token_request(data, '/token')
|
|
157
|
+
|
|
158
|
+
return token_set
|
|
159
|
+
end
|
|
160
|
+
|
|
138
161
|
def get_token_set_from_callback(params)
|
|
139
162
|
data = {
|
|
140
|
-
grant_type:
|
|
163
|
+
grant_type: @grant_type,
|
|
141
164
|
code: params['code'],
|
|
142
165
|
redirect_uri: @redirect_uri
|
|
143
166
|
}
|
|
@@ -222,6 +245,10 @@ module XeroRuby
|
|
|
222
245
|
response[0]
|
|
223
246
|
end
|
|
224
247
|
|
|
248
|
+
def last_connection
|
|
249
|
+
connections.sort { |a,b| DateTime.parse(a['updatedDateUtc']) <=> DateTime.parse(b['updatedDateUtc'])}.first
|
|
250
|
+
end
|
|
251
|
+
|
|
225
252
|
def disconnect(connection_id)
|
|
226
253
|
@config.base_url = 'https://api.xero.com'
|
|
227
254
|
opts = { :header_params => {'Content-Type': 'application/json'}, :auth_names => ['OAuth2'] }
|
|
@@ -479,6 +506,8 @@ module XeroRuby
|
|
|
479
506
|
XeroRuby::PayrollNz.const_get(return_type).build_from_hash(data)
|
|
480
507
|
when 'PayrollUkApi'
|
|
481
508
|
XeroRuby::PayrollUk.const_get(return_type).build_from_hash(data)
|
|
509
|
+
when 'AppStoreApi'
|
|
510
|
+
XeroRuby::AppStore.const_get(return_type).build_from_hash(data)
|
|
482
511
|
else
|
|
483
512
|
XeroRuby::Accounting.const_get(return_type).build_from_hash(data)
|
|
484
513
|
end
|
|
@@ -33,6 +33,7 @@ module XeroRuby
|
|
|
33
33
|
attr_accessor :payroll_au_url
|
|
34
34
|
attr_accessor :payroll_nz_url
|
|
35
35
|
attr_accessor :payroll_uk_url
|
|
36
|
+
attr_accessor :app_store_url
|
|
36
37
|
|
|
37
38
|
# Defines API keys used with API Key authentications.
|
|
38
39
|
#
|
|
@@ -149,6 +150,7 @@ module XeroRuby
|
|
|
149
150
|
@payroll_au_url = 'https://api.xero.com/payroll.xro/1.0/'
|
|
150
151
|
@payroll_nz_url = 'https://api.xero.com/payroll.xro/2.0/'
|
|
151
152
|
@payroll_uk_url = 'https://api.xero.com/payroll.xro/2.0/'
|
|
153
|
+
@app_store_url = 'https://api.xero.com/appstore/2.0/'
|
|
152
154
|
@access_token = nil
|
|
153
155
|
@id_token = nil
|
|
154
156
|
@api_key = {}
|
|
@@ -525,6 +525,8 @@ module XeroRuby::Accounting
|
|
|
525
525
|
original, date, timezone = *date_pattern.match(datestring)
|
|
526
526
|
date = (date.to_i / 1000)
|
|
527
527
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
528
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
529
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
528
530
|
else # handle date 'types' for small subset of payroll API's
|
|
529
531
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
530
532
|
end
|
|
@@ -214,6 +214,8 @@ module XeroRuby::Accounting
|
|
|
214
214
|
original, date, timezone = *date_pattern.match(datestring)
|
|
215
215
|
date = (date.to_i / 1000)
|
|
216
216
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
217
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
218
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
217
219
|
else # handle date 'types' for small subset of payroll API's
|
|
218
220
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
219
221
|
end
|
|
@@ -222,6 +222,8 @@ module XeroRuby::Accounting
|
|
|
222
222
|
original, date, timezone = *date_pattern.match(datestring)
|
|
223
223
|
date = (date.to_i / 1000)
|
|
224
224
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
225
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
226
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
225
227
|
else # handle date 'types' for small subset of payroll API's
|
|
226
228
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
227
229
|
end
|
|
@@ -222,6 +222,8 @@ module XeroRuby::Accounting
|
|
|
222
222
|
original, date, timezone = *date_pattern.match(datestring)
|
|
223
223
|
date = (date.to_i / 1000)
|
|
224
224
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
225
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
226
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
225
227
|
else # handle date 'types' for small subset of payroll API's
|
|
226
228
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
227
229
|
end
|
|
@@ -258,6 +258,8 @@ module XeroRuby::Accounting
|
|
|
258
258
|
original, date, timezone = *date_pattern.match(datestring)
|
|
259
259
|
date = (date.to_i / 1000)
|
|
260
260
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
261
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
262
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
261
263
|
else # handle date 'types' for small subset of payroll API's
|
|
262
264
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
263
265
|
end
|
|
@@ -214,6 +214,8 @@ module XeroRuby::Accounting
|
|
|
214
214
|
original, date, timezone = *date_pattern.match(datestring)
|
|
215
215
|
date = (date.to_i / 1000)
|
|
216
216
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
217
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
218
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
217
219
|
else # handle date 'types' for small subset of payroll API's
|
|
218
220
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
219
221
|
end
|
|
@@ -473,6 +473,8 @@ module XeroRuby::Accounting
|
|
|
473
473
|
original, date, timezone = *date_pattern.match(datestring)
|
|
474
474
|
date = (date.to_i / 1000)
|
|
475
475
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
476
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
477
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
476
478
|
else # handle date 'types' for small subset of payroll API's
|
|
477
479
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
478
480
|
end
|
|
@@ -474,6 +474,8 @@ module XeroRuby::Accounting
|
|
|
474
474
|
original, date, timezone = *date_pattern.match(datestring)
|
|
475
475
|
date = (date.to_i / 1000)
|
|
476
476
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
477
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
478
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
477
479
|
else # handle date 'types' for small subset of payroll API's
|
|
478
480
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
479
481
|
end
|
|
@@ -299,6 +299,8 @@ module XeroRuby::Accounting
|
|
|
299
299
|
original, date, timezone = *date_pattern.match(datestring)
|
|
300
300
|
date = (date.to_i / 1000)
|
|
301
301
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
302
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
303
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
302
304
|
else # handle date 'types' for small subset of payroll API's
|
|
303
305
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
304
306
|
end
|
|
@@ -214,6 +214,8 @@ module XeroRuby::Accounting
|
|
|
214
214
|
original, date, timezone = *date_pattern.match(datestring)
|
|
215
215
|
date = (date.to_i / 1000)
|
|
216
216
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
217
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
218
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
217
219
|
else # handle date 'types' for small subset of payroll API's
|
|
218
220
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
219
221
|
end
|
|
@@ -262,6 +262,8 @@ module XeroRuby::Accounting
|
|
|
262
262
|
original, date, timezone = *date_pattern.match(datestring)
|
|
263
263
|
date = (date.to_i / 1000)
|
|
264
264
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
265
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
266
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
265
267
|
else # handle date 'types' for small subset of payroll API's
|
|
266
268
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
267
269
|
end
|
|
@@ -214,6 +214,8 @@ module XeroRuby::Accounting
|
|
|
214
214
|
original, date, timezone = *date_pattern.match(datestring)
|
|
215
215
|
date = (date.to_i / 1000)
|
|
216
216
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
217
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
218
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
217
219
|
else # handle date 'types' for small subset of payroll API's
|
|
218
220
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
219
221
|
end
|
|
@@ -233,6 +233,8 @@ module XeroRuby::Accounting
|
|
|
233
233
|
original, date, timezone = *date_pattern.match(datestring)
|
|
234
234
|
date = (date.to_i / 1000)
|
|
235
235
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
236
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
237
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
236
238
|
else # handle date 'types' for small subset of payroll API's
|
|
237
239
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
238
240
|
end
|
|
@@ -223,6 +223,8 @@ module XeroRuby::Accounting
|
|
|
223
223
|
original, date, timezone = *date_pattern.match(datestring)
|
|
224
224
|
date = (date.to_i / 1000)
|
|
225
225
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
226
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
227
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
226
228
|
else # handle date 'types' for small subset of payroll API's
|
|
227
229
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
228
230
|
end
|
|
@@ -500,6 +500,8 @@ module XeroRuby::Accounting
|
|
|
500
500
|
original, date, timezone = *date_pattern.match(datestring)
|
|
501
501
|
date = (date.to_i / 1000)
|
|
502
502
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
503
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
504
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
503
505
|
else # handle date 'types' for small subset of payroll API's
|
|
504
506
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
505
507
|
end
|
|
@@ -214,6 +214,8 @@ module XeroRuby::Accounting
|
|
|
214
214
|
original, date, timezone = *date_pattern.match(datestring)
|
|
215
215
|
date = (date.to_i / 1000)
|
|
216
216
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
217
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
218
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
217
219
|
else # handle date 'types' for small subset of payroll API's
|
|
218
220
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
219
221
|
end
|
|
@@ -331,6 +331,8 @@ module XeroRuby::Accounting
|
|
|
331
331
|
original, date, timezone = *date_pattern.match(datestring)
|
|
332
332
|
date = (date.to_i / 1000)
|
|
333
333
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
334
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
335
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
334
336
|
else # handle date 'types' for small subset of payroll API's
|
|
335
337
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
336
338
|
end
|
|
@@ -214,6 +214,8 @@ module XeroRuby::Accounting
|
|
|
214
214
|
original, date, timezone = *date_pattern.match(datestring)
|
|
215
215
|
date = (date.to_i / 1000)
|
|
216
216
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
217
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
218
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
217
219
|
else # handle date 'types' for small subset of payroll API's
|
|
218
220
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
219
221
|
end
|
|
@@ -486,6 +486,8 @@ module XeroRuby::Accounting
|
|
|
486
486
|
original, date, timezone = *date_pattern.match(datestring)
|
|
487
487
|
date = (date.to_i / 1000)
|
|
488
488
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
489
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
490
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
489
491
|
else # handle date 'types' for small subset of payroll API's
|
|
490
492
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
491
493
|
end
|
|
@@ -283,6 +283,8 @@ module XeroRuby::Accounting
|
|
|
283
283
|
original, date, timezone = *date_pattern.match(datestring)
|
|
284
284
|
date = (date.to_i / 1000)
|
|
285
285
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
286
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
287
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
286
288
|
else # handle date 'types' for small subset of payroll API's
|
|
287
289
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
288
290
|
end
|
|
@@ -214,6 +214,8 @@ module XeroRuby::Accounting
|
|
|
214
214
|
original, date, timezone = *date_pattern.match(datestring)
|
|
215
215
|
date = (date.to_i / 1000)
|
|
216
216
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
217
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
218
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
217
219
|
else # handle date 'types' for small subset of payroll API's
|
|
218
220
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
219
221
|
end
|
|
@@ -222,6 +222,8 @@ module XeroRuby::Accounting
|
|
|
222
222
|
original, date, timezone = *date_pattern.match(datestring)
|
|
223
223
|
date = (date.to_i / 1000)
|
|
224
224
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
225
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
226
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
225
227
|
else # handle date 'types' for small subset of payroll API's
|
|
226
228
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
227
229
|
end
|
|
@@ -297,6 +297,8 @@ module XeroRuby::Accounting
|
|
|
297
297
|
original, date, timezone = *date_pattern.match(datestring)
|
|
298
298
|
date = (date.to_i / 1000)
|
|
299
299
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
300
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
301
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
300
302
|
else # handle date 'types' for small subset of payroll API's
|
|
301
303
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
302
304
|
end
|
|
@@ -214,6 +214,8 @@ module XeroRuby::Accounting
|
|
|
214
214
|
original, date, timezone = *date_pattern.match(datestring)
|
|
215
215
|
date = (date.to_i / 1000)
|
|
216
216
|
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
217
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
218
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
217
219
|
else # handle date 'types' for small subset of payroll API's
|
|
218
220
|
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
219
221
|
end
|
|
@@ -0,0 +1,327 @@
|
|
|
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 Budget
|
|
19
|
+
# Xero identifier
|
|
20
|
+
attr_accessor :budget_id
|
|
21
|
+
|
|
22
|
+
# Type of Budget. OVERALL or TRACKING
|
|
23
|
+
attr_accessor :type
|
|
24
|
+
OVERALL = "OVERALL".freeze
|
|
25
|
+
TRACKING = "TRACKING".freeze
|
|
26
|
+
|
|
27
|
+
# The Budget description
|
|
28
|
+
attr_accessor :description
|
|
29
|
+
|
|
30
|
+
# UTC timestamp of last update to budget
|
|
31
|
+
attr_accessor :updated_date_utc
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
attr_accessor :budget_lines
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
attr_accessor :tracking
|
|
38
|
+
|
|
39
|
+
class EnumAttributeValidator
|
|
40
|
+
attr_reader :datatype
|
|
41
|
+
attr_reader :allowable_values
|
|
42
|
+
|
|
43
|
+
def initialize(datatype, allowable_values)
|
|
44
|
+
@allowable_values = allowable_values.map do |value|
|
|
45
|
+
case datatype.to_s
|
|
46
|
+
when /Integer/i
|
|
47
|
+
value.to_i
|
|
48
|
+
when /Float/i
|
|
49
|
+
value.to_f
|
|
50
|
+
else
|
|
51
|
+
value
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def valid?(value)
|
|
57
|
+
!value || allowable_values.include?(value)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
62
|
+
def self.attribute_map
|
|
63
|
+
{
|
|
64
|
+
:'budget_id' => :'BudgetID',
|
|
65
|
+
:'type' => :'Type',
|
|
66
|
+
:'description' => :'Description',
|
|
67
|
+
:'updated_date_utc' => :'UpdatedDateUTC',
|
|
68
|
+
:'budget_lines' => :'BudgetLines',
|
|
69
|
+
:'tracking' => :'Tracking'
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Attribute type mapping.
|
|
74
|
+
def self.openapi_types
|
|
75
|
+
{
|
|
76
|
+
:'budget_id' => :'String',
|
|
77
|
+
:'type' => :'String',
|
|
78
|
+
:'description' => :'String',
|
|
79
|
+
:'updated_date_utc' => :'DateTime',
|
|
80
|
+
:'budget_lines' => :'Array<BudgetLine>',
|
|
81
|
+
:'tracking' => :'Array<TrackingCategory>'
|
|
82
|
+
}
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Initializes the object
|
|
86
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
87
|
+
def initialize(attributes = {})
|
|
88
|
+
if (!attributes.is_a?(Hash))
|
|
89
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::Budget` initialize method"
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
93
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
94
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
95
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Accounting::Budget`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
96
|
+
end
|
|
97
|
+
h[k.to_sym] = v
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'budget_id')
|
|
101
|
+
self.budget_id = attributes[:'budget_id']
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'type')
|
|
105
|
+
self.type = attributes[:'type']
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'description')
|
|
109
|
+
self.description = attributes[:'description']
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'updated_date_utc')
|
|
113
|
+
self.updated_date_utc = attributes[:'updated_date_utc']
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if attributes.key?(:'budget_lines')
|
|
117
|
+
if (value = attributes[:'budget_lines']).is_a?(Array)
|
|
118
|
+
self.budget_lines = value
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'tracking')
|
|
123
|
+
if (value = attributes[:'tracking']).is_a?(Array)
|
|
124
|
+
self.tracking = value
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
130
|
+
# @return Array for valid properties with the reasons
|
|
131
|
+
def list_invalid_properties
|
|
132
|
+
invalid_properties = Array.new
|
|
133
|
+
if !@description.nil? && @description.to_s.length > 255
|
|
134
|
+
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 255.')
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
invalid_properties
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Check to see if the all the properties in the model are valid
|
|
141
|
+
# @return true if the model is valid
|
|
142
|
+
def valid?
|
|
143
|
+
type_validator = EnumAttributeValidator.new('String', ["OVERALL", "TRACKING"])
|
|
144
|
+
return false unless type_validator.valid?(@type)
|
|
145
|
+
return false if !@description.nil? && @description.to_s.length > 255
|
|
146
|
+
true
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
150
|
+
# @param [Object] type Object to be assigned
|
|
151
|
+
def type=(type)
|
|
152
|
+
validator = EnumAttributeValidator.new('String', ["OVERALL", "TRACKING"])
|
|
153
|
+
unless validator.valid?(type)
|
|
154
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
155
|
+
end
|
|
156
|
+
@type = type
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Custom attribute writer method with validation
|
|
160
|
+
# @param [Object] description Value to be assigned
|
|
161
|
+
def description=(description)
|
|
162
|
+
if !description.nil? && description.to_s.length > 255
|
|
163
|
+
fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 255.'
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
@description = description
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Checks equality by comparing each attribute.
|
|
170
|
+
# @param [Object] Object to be compared
|
|
171
|
+
def ==(o)
|
|
172
|
+
return true if self.equal?(o)
|
|
173
|
+
self.class == o.class &&
|
|
174
|
+
budget_id == o.budget_id &&
|
|
175
|
+
type == o.type &&
|
|
176
|
+
description == o.description &&
|
|
177
|
+
updated_date_utc == o.updated_date_utc &&
|
|
178
|
+
budget_lines == o.budget_lines &&
|
|
179
|
+
tracking == o.tracking
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# @see the `==` method
|
|
183
|
+
# @param [Object] Object to be compared
|
|
184
|
+
def eql?(o)
|
|
185
|
+
self == o
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Calculates hash code according to all attributes.
|
|
189
|
+
# @return [Integer] Hash code
|
|
190
|
+
def hash
|
|
191
|
+
[budget_id, type, description, updated_date_utc, budget_lines, tracking].hash
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Builds the object from hash
|
|
195
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
196
|
+
# @return [Object] Returns the model itself
|
|
197
|
+
def self.build_from_hash(attributes)
|
|
198
|
+
new.build_from_hash(attributes)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Builds the object from hash
|
|
202
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
203
|
+
# @return [Object] Returns the model itself
|
|
204
|
+
def build_from_hash(attributes)
|
|
205
|
+
return nil unless attributes.is_a?(Hash)
|
|
206
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
207
|
+
if type =~ /\AArray<(.*)>/i
|
|
208
|
+
# check to ensure the input is an array given that the attribute
|
|
209
|
+
# is documented as an array but the input is not
|
|
210
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
211
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
212
|
+
end
|
|
213
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
214
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
215
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
self
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Deserializes the data based on type
|
|
222
|
+
# @param string type Data type
|
|
223
|
+
# @param string value Value to be deserialized
|
|
224
|
+
# @return [Object] Deserialized data
|
|
225
|
+
def _deserialize(type, value)
|
|
226
|
+
case type.to_sym
|
|
227
|
+
when :DateTime
|
|
228
|
+
DateTime.parse(parse_date(value))
|
|
229
|
+
when :Date
|
|
230
|
+
Date.parse(parse_date(value))
|
|
231
|
+
when :String
|
|
232
|
+
value.to_s
|
|
233
|
+
when :Integer
|
|
234
|
+
value.to_i
|
|
235
|
+
when :Float
|
|
236
|
+
value.to_f
|
|
237
|
+
when :BigDecimal
|
|
238
|
+
BigDecimal(value.to_s)
|
|
239
|
+
when :Boolean
|
|
240
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
241
|
+
true
|
|
242
|
+
else
|
|
243
|
+
false
|
|
244
|
+
end
|
|
245
|
+
when :Object
|
|
246
|
+
# generic object (usually a Hash), return directly
|
|
247
|
+
value
|
|
248
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
249
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
250
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
251
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
252
|
+
k_type = Regexp.last_match[:k_type]
|
|
253
|
+
v_type = Regexp.last_match[:v_type]
|
|
254
|
+
{}.tap do |hash|
|
|
255
|
+
value.each do |k, v|
|
|
256
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
else # model
|
|
260
|
+
XeroRuby::Accounting.const_get(type).build_from_hash(value)
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Returns the string representation of the object
|
|
265
|
+
# @return [String] String presentation of the object
|
|
266
|
+
def to_s
|
|
267
|
+
to_hash.to_s
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
271
|
+
# @return [Hash] Returns the object in the form of hash
|
|
272
|
+
def to_body
|
|
273
|
+
to_hash
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
# Returns the object in the form of hash
|
|
277
|
+
# @return [Hash] Returns the object in the form of hash
|
|
278
|
+
def to_hash(downcase: false)
|
|
279
|
+
hash = {}
|
|
280
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
281
|
+
value = self.send(attr)
|
|
282
|
+
next if value.nil?
|
|
283
|
+
key = downcase ? attr : param
|
|
284
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
|
285
|
+
end
|
|
286
|
+
hash
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# Returns the object in the form of hash with snake_case
|
|
290
|
+
def to_attributes
|
|
291
|
+
to_hash(downcase: true)
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Outputs non-array value in the form of hash
|
|
295
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
296
|
+
# @param [Object] value Any valid value
|
|
297
|
+
# @return [Hash] Returns the value in the form of hash
|
|
298
|
+
def _to_hash(value, downcase: false)
|
|
299
|
+
if value.is_a?(Array)
|
|
300
|
+
value.map do |v|
|
|
301
|
+
v.to_hash(downcase: downcase)
|
|
302
|
+
end
|
|
303
|
+
elsif value.is_a?(Hash)
|
|
304
|
+
{}.tap do |hash|
|
|
305
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
|
306
|
+
end
|
|
307
|
+
elsif value.respond_to? :to_hash
|
|
308
|
+
value.to_hash(downcase: downcase)
|
|
309
|
+
else
|
|
310
|
+
value
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
def parse_date(datestring)
|
|
315
|
+
if datestring.include?('Date')
|
|
316
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
|
317
|
+
original, date, timezone = *date_pattern.match(datestring)
|
|
318
|
+
date = (date.to_i / 1000)
|
|
319
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
320
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
321
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
322
|
+
else # handle date 'types' for small subset of payroll API's
|
|
323
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
324
|
+
end
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
end
|