xero-ruby 2.4.1 → 2.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -5
- data/lib/xero-ruby.rb +1 -1
- data/lib/xero-ruby/api/accounting_api.rb +6 -1
- data/lib/xero-ruby/api/asset_api.rb +0 -1
- data/lib/xero-ruby/api/files_api.rb +0 -1
- data/lib/xero-ruby/api/payroll_au_api.rb +0 -1
- data/lib/xero-ruby/api/payroll_nz_api.rb +0 -1
- data/lib/xero-ruby/api/payroll_uk_api.rb +0 -1
- data/lib/xero-ruby/api/project_api.rb +0 -1
- data/lib/xero-ruby/api_client.rb +34 -27
- data/lib/xero-ruby/api_error.rb +3 -3
- data/lib/xero-ruby/configuration.rb +0 -1
- data/lib/xero-ruby/models/accounting/account.rb +14 -7
- data/lib/xero-ruby/models/accounting/account_type.rb +0 -1
- data/lib/xero-ruby/models/accounting/accounts.rb +14 -6
- data/lib/xero-ruby/models/accounting/accounts_payable.rb +14 -6
- data/lib/xero-ruby/models/accounting/accounts_receivable.rb +14 -6
- data/lib/xero-ruby/models/accounting/action.rb +14 -6
- data/lib/xero-ruby/models/accounting/actions.rb +14 -6
- data/lib/xero-ruby/models/accounting/address.rb +16 -9
- data/lib/xero-ruby/models/accounting/address_for_organisation.rb +478 -0
- data/lib/xero-ruby/models/accounting/allocation.rb +14 -6
- data/lib/xero-ruby/models/accounting/allocations.rb +14 -6
- data/lib/xero-ruby/models/accounting/attachment.rb +14 -6
- data/lib/xero-ruby/models/accounting/attachments.rb +14 -6
- data/lib/xero-ruby/models/accounting/balance_details.rb +14 -6
- data/lib/xero-ruby/models/accounting/balances.rb +14 -6
- data/lib/xero-ruby/models/accounting/bank_transaction.rb +14 -6
- data/lib/xero-ruby/models/accounting/bank_transactions.rb +14 -6
- data/lib/xero-ruby/models/accounting/bank_transfer.rb +14 -6
- data/lib/xero-ruby/models/accounting/bank_transfers.rb +14 -6
- data/lib/xero-ruby/models/accounting/batch_payment.rb +14 -6
- data/lib/xero-ruby/models/accounting/batch_payment_details.rb +14 -6
- data/lib/xero-ruby/models/accounting/batch_payments.rb +14 -6
- data/lib/xero-ruby/models/accounting/bill.rb +14 -6
- data/lib/xero-ruby/models/accounting/branding_theme.rb +14 -6
- data/lib/xero-ruby/models/accounting/branding_themes.rb +14 -6
- data/lib/xero-ruby/models/accounting/cis_org_setting.rb +15 -7
- data/lib/xero-ruby/models/accounting/cis_setting.rb +15 -7
- data/lib/xero-ruby/models/accounting/cis_settings.rb +14 -6
- data/lib/xero-ruby/models/accounting/contact.rb +14 -6
- data/lib/xero-ruby/models/accounting/contact_group.rb +14 -6
- data/lib/xero-ruby/models/accounting/contact_groups.rb +14 -6
- data/lib/xero-ruby/models/accounting/contact_person.rb +14 -6
- data/lib/xero-ruby/models/accounting/contacts.rb +14 -6
- data/lib/xero-ruby/models/accounting/conversion_balances.rb +14 -6
- data/lib/xero-ruby/models/accounting/conversion_date.rb +14 -6
- data/lib/xero-ruby/models/accounting/country_code.rb +0 -1
- data/lib/xero-ruby/models/accounting/credit_note.rb +35 -7
- data/lib/xero-ruby/models/accounting/credit_notes.rb +14 -6
- data/lib/xero-ruby/models/accounting/currencies.rb +14 -6
- data/lib/xero-ruby/models/accounting/currency.rb +14 -6
- data/lib/xero-ruby/models/accounting/currency_code.rb +0 -1
- data/lib/xero-ruby/models/accounting/element.rb +14 -6
- data/lib/xero-ruby/models/accounting/employee.rb +14 -6
- data/lib/xero-ruby/models/accounting/employees.rb +14 -6
- data/lib/xero-ruby/models/accounting/error.rb +14 -6
- data/lib/xero-ruby/models/accounting/expense_claim.rb +14 -6
- data/lib/xero-ruby/models/accounting/expense_claims.rb +14 -6
- data/lib/xero-ruby/models/accounting/external_link.rb +14 -6
- data/lib/xero-ruby/models/accounting/history_record.rb +14 -6
- data/lib/xero-ruby/models/accounting/history_records.rb +14 -6
- data/lib/xero-ruby/models/accounting/import_summary.rb +14 -6
- data/lib/xero-ruby/models/accounting/import_summary_accounts.rb +14 -6
- data/lib/xero-ruby/models/accounting/import_summary_object.rb +14 -6
- data/lib/xero-ruby/models/accounting/import_summary_organisation.rb +14 -6
- data/lib/xero-ruby/models/accounting/invoice.rb +26 -23
- data/lib/xero-ruby/models/accounting/invoice_reminder.rb +14 -6
- data/lib/xero-ruby/models/accounting/invoice_reminders.rb +14 -6
- data/lib/xero-ruby/models/accounting/invoices.rb +14 -6
- data/lib/xero-ruby/models/accounting/item.rb +14 -6
- data/lib/xero-ruby/models/accounting/items.rb +14 -6
- data/lib/xero-ruby/models/accounting/journal.rb +14 -6
- data/lib/xero-ruby/models/accounting/journal_line.rb +14 -6
- data/lib/xero-ruby/models/accounting/journals.rb +14 -6
- data/lib/xero-ruby/models/accounting/line_amount_types.rb +0 -1
- data/lib/xero-ruby/models/accounting/line_item.rb +14 -6
- data/lib/xero-ruby/models/accounting/line_item_tracking.rb +14 -6
- data/lib/xero-ruby/models/accounting/linked_transaction.rb +14 -6
- data/lib/xero-ruby/models/accounting/linked_transactions.rb +14 -6
- data/lib/xero-ruby/models/accounting/manual_journal.rb +14 -6
- data/lib/xero-ruby/models/accounting/manual_journal_line.rb +14 -6
- data/lib/xero-ruby/models/accounting/manual_journals.rb +14 -6
- data/lib/xero-ruby/models/accounting/online_invoice.rb +14 -6
- data/lib/xero-ruby/models/accounting/online_invoices.rb +14 -6
- data/lib/xero-ruby/models/accounting/organisation.rb +15 -9
- data/lib/xero-ruby/models/accounting/organisations.rb +14 -6
- data/lib/xero-ruby/models/accounting/overpayment.rb +14 -6
- data/lib/xero-ruby/models/accounting/overpayments.rb +14 -6
- data/lib/xero-ruby/models/accounting/payment.rb +14 -6
- data/lib/xero-ruby/models/accounting/payment_delete.rb +14 -6
- data/lib/xero-ruby/models/accounting/payment_service.rb +14 -6
- data/lib/xero-ruby/models/accounting/payment_services.rb +14 -6
- data/lib/xero-ruby/models/accounting/payment_term.rb +14 -6
- data/lib/xero-ruby/models/accounting/payment_term_type.rb +0 -1
- data/lib/xero-ruby/models/accounting/payments.rb +14 -6
- data/lib/xero-ruby/models/accounting/phone.rb +14 -6
- data/lib/xero-ruby/models/accounting/prepayment.rb +14 -6
- data/lib/xero-ruby/models/accounting/prepayments.rb +14 -6
- data/lib/xero-ruby/models/accounting/purchase.rb +14 -6
- data/lib/xero-ruby/models/accounting/purchase_order.rb +14 -6
- data/lib/xero-ruby/models/accounting/purchase_orders.rb +14 -6
- data/lib/xero-ruby/models/accounting/quote.rb +14 -6
- data/lib/xero-ruby/models/accounting/quote_line_amount_types.rb +0 -1
- data/lib/xero-ruby/models/accounting/quote_status_codes.rb +0 -1
- data/lib/xero-ruby/models/accounting/quotes.rb +14 -6
- data/lib/xero-ruby/models/accounting/receipt.rb +14 -6
- data/lib/xero-ruby/models/accounting/receipts.rb +14 -6
- data/lib/xero-ruby/models/accounting/repeating_invoice.rb +14 -6
- data/lib/xero-ruby/models/accounting/repeating_invoices.rb +14 -6
- data/lib/xero-ruby/models/accounting/report.rb +14 -6
- data/lib/xero-ruby/models/accounting/report_attribute.rb +14 -6
- data/lib/xero-ruby/models/accounting/report_cell.rb +14 -6
- data/lib/xero-ruby/models/accounting/report_fields.rb +14 -6
- data/lib/xero-ruby/models/accounting/report_row.rb +14 -6
- data/lib/xero-ruby/models/accounting/report_rows.rb +14 -6
- data/lib/xero-ruby/models/accounting/report_with_row.rb +14 -6
- data/lib/xero-ruby/models/accounting/report_with_rows.rb +14 -6
- data/lib/xero-ruby/models/accounting/reports.rb +14 -6
- data/lib/xero-ruby/models/accounting/request_empty.rb +14 -6
- data/lib/xero-ruby/models/accounting/row_type.rb +0 -1
- data/lib/xero-ruby/models/accounting/sales_tracking_category.rb +14 -6
- data/lib/xero-ruby/models/accounting/schedule.rb +14 -6
- data/lib/xero-ruby/models/accounting/setup.rb +14 -6
- data/lib/xero-ruby/models/accounting/tax_component.rb +14 -6
- data/lib/xero-ruby/models/accounting/tax_rate.rb +14 -6
- data/lib/xero-ruby/models/accounting/tax_rates.rb +14 -6
- data/lib/xero-ruby/models/accounting/tax_type.rb +0 -1
- data/lib/xero-ruby/models/accounting/ten_ninety_nine_contact.rb +14 -6
- data/lib/xero-ruby/models/accounting/time_zone.rb +0 -1
- data/lib/xero-ruby/models/accounting/tracking_categories.rb +14 -6
- data/lib/xero-ruby/models/accounting/tracking_category.rb +14 -6
- data/lib/xero-ruby/models/accounting/tracking_option.rb +14 -6
- data/lib/xero-ruby/models/accounting/tracking_options.rb +14 -6
- data/lib/xero-ruby/models/accounting/user.rb +14 -6
- data/lib/xero-ruby/models/accounting/users.rb +14 -6
- data/lib/xero-ruby/models/accounting/validation_error.rb +14 -6
- data/lib/xero-ruby/models/assets/asset.rb +14 -6
- data/lib/xero-ruby/models/assets/asset_status.rb +0 -1
- data/lib/xero-ruby/models/assets/asset_status_query_param.rb +0 -1
- data/lib/xero-ruby/models/assets/asset_type.rb +14 -6
- data/lib/xero-ruby/models/assets/assets.rb +14 -6
- data/lib/xero-ruby/models/assets/book_depreciation_detail.rb +14 -6
- data/lib/xero-ruby/models/assets/book_depreciation_setting.rb +14 -6
- data/lib/xero-ruby/models/assets/error.rb +14 -6
- data/lib/xero-ruby/models/assets/field_validation_errors_element.rb +14 -6
- data/lib/xero-ruby/models/assets/pagination.rb +14 -6
- data/lib/xero-ruby/models/assets/resource_validation_errors_element.rb +14 -6
- data/lib/xero-ruby/models/assets/setting.rb +14 -6
- data/lib/xero-ruby/models/files/association.rb +14 -6
- data/lib/xero-ruby/models/files/file_object.rb +14 -6
- data/lib/xero-ruby/models/files/file_response204.rb +14 -6
- data/lib/xero-ruby/models/files/files.rb +14 -6
- data/lib/xero-ruby/models/files/folder.rb +14 -6
- data/lib/xero-ruby/models/files/folders.rb +14 -6
- data/lib/xero-ruby/models/files/inline_object.rb +14 -6
- data/lib/xero-ruby/models/files/object_group.rb +0 -1
- data/lib/xero-ruby/models/files/object_type.rb +0 -1
- data/lib/xero-ruby/models/files/user.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/account.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/account_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/allowance_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/api_exception.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/bank_account.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/calendar_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/deduction_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/deduction_type.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/deduction_type_calculation_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/earnings_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/earnings_rate_calculation_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/earnings_type.rb +1 -1
- data/lib/xero-ruby/models/payroll_au/employee.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/employee_status.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/employees.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/employment_basis.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/employment_termination_payment_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/entitlement_final_pay_payout_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/home_address.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/leave_accrual_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/leave_application.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/leave_applications.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/leave_balance.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/leave_earnings_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/leave_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/leave_line_calculation_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/leave_lines.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/leave_period.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/leave_period_status.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/leave_type.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/leave_type_contribution_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/manual_tax_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/opening_balances.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/pay_item.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/pay_items.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/pay_run.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/pay_run_status.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/pay_runs.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/pay_template.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/payment_frequency_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/payroll_calendar.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/payroll_calendars.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/payslip.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/payslip_lines.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/payslip_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/payslip_summary.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/payslips.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/rate_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/reimbursement_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/reimbursement_lines.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/reimbursement_type.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/residency_status.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/settings.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/settings_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/settings_tracking_categories.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/settings_tracking_categories_employee_groups.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/settings_tracking_categories_timesheet_categories.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/state.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/super_fund.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/super_fund_product.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/super_fund_products.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/super_fund_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/super_funds.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/super_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/super_membership.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/superannuation_calculation_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/superannuation_contribution_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/superannuation_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/tax_declaration.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/tax_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/tfn_exemption_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/timesheet.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/timesheet_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/timesheet_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/timesheet_status.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/timesheets.rb +14 -6
- data/lib/xero-ruby/models/payroll_au/validation_error.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/account.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/accounts.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/address.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/bank_account.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/benefit.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/calendar_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_nz/deduction.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/deduction_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/deduction_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/deductions.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/earnings_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/earnings_order.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/earnings_order_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/earnings_orders.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/earnings_rate.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/earnings_rate_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/earnings_rates.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/earnings_template.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/earnings_template_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_earnings_templates.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_leave.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_leave_balance.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_leave_balances.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_leave_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_leave_setup_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_leave_type_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_leave_types.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_leaves.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_opening_balance.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_opening_balances_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_pay_template.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_pay_template_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_pay_templates.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_balance.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_balance_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_leave_summary.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_leaves_summaries.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leave.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leave_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_statutory_sick_leaves.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_tax.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employee_tax_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employees.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employment.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/employment_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/gross_earnings_history.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/invalid_field.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/leave_accrual_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/leave_earnings_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/leave_period.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/leave_periods.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/leave_type.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/leave_type_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/leave_types.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/pagination.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/pay_run.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/pay_run_calendar.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/pay_run_calendar_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/pay_run_calendars.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/pay_run_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/pay_runs.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/pay_slip.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/pay_slip_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/pay_slips.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/payment_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/payment_method.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/payment_method_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/problem.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/reimbursement.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/reimbursement_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/reimbursement_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/reimbursements.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/salary_and_wage.rb +15 -7
- data/lib/xero-ruby/models/payroll_nz/salary_and_wage_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/salary_and_wages.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/settings.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/statutory_deduction.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/statutory_deduction_category.rb +0 -1
- data/lib/xero-ruby/models/payroll_nz/statutory_deduction_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/statutory_deduction_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/statutory_deductions.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/superannuation_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/superannuation_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/superannuations.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/tax_code.rb +0 -1
- data/lib/xero-ruby/models/payroll_nz/tax_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/tax_settings.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/timesheet.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/timesheet_earnings_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/timesheet_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/timesheet_line_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/timesheet_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/timesheets.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/tracking_categories.rb +14 -6
- data/lib/xero-ruby/models/payroll_nz/tracking_category.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/account.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/accounts.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/address.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/bank_account.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/benefit.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/benefit_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/benefit_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/benefits.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/court_order_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/deduction.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/deduction_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/deduction_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/deductions.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/earnings_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/earnings_order.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/earnings_order_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/earnings_orders.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/earnings_rate_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/earnings_rates.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/earnings_template.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/earnings_template_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_leave.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_leave_balance.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_leave_balances.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_leave_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_leave_type.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_leave_type_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_leave_types.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_leaves.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_opening_balances.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_opening_balances_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_pay_template.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_pay_template_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_pay_templates.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_summary.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leaves_summaries.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leave.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leave_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_sick_leaves.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_tax.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employee_tax_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employees.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employment.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/employment_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/invalid_field.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/leave_accrual_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/leave_earnings_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/leave_period.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/leave_periods.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/leave_type.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/leave_type_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/leave_types.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/pagination.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/pay_run.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/pay_run_calendar.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/pay_run_calendar_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/pay_run_calendars.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/pay_run_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/pay_runs.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/payment_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/payment_method.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/payment_method_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/payslip.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/payslip_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/payslips.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/problem.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/reimbursement.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/reimbursement_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/reimbursement_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/reimbursements.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/salary_and_wage.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/salary_and_wage_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/salary_and_wages.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/settings.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/statutory_deduction.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/statutory_deduction_category.rb +0 -1
- data/lib/xero-ruby/models/payroll_uk/tax_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/timesheet.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/timesheet_earnings_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/timesheet_line.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/timesheet_line_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/timesheet_object.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/timesheets.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/tracking_categories.rb +14 -6
- data/lib/xero-ruby/models/payroll_uk/tracking_category.rb +14 -6
- data/lib/xero-ruby/models/projects/amount.rb +14 -6
- data/lib/xero-ruby/models/projects/charge_type.rb +0 -1
- data/lib/xero-ruby/models/projects/currency_code.rb +0 -1
- data/lib/xero-ruby/models/projects/error.rb +14 -6
- data/lib/xero-ruby/models/projects/pagination.rb +14 -6
- data/lib/xero-ruby/models/projects/project.rb +14 -6
- data/lib/xero-ruby/models/projects/project_create_or_update.rb +14 -6
- data/lib/xero-ruby/models/projects/project_patch.rb +14 -6
- data/lib/xero-ruby/models/projects/project_status.rb +0 -1
- data/lib/xero-ruby/models/projects/project_user.rb +14 -6
- data/lib/xero-ruby/models/projects/project_users.rb +14 -6
- data/lib/xero-ruby/models/projects/projects.rb +14 -6
- data/lib/xero-ruby/models/projects/task.rb +14 -6
- data/lib/xero-ruby/models/projects/task_create_or_update.rb +14 -6
- data/lib/xero-ruby/models/projects/tasks.rb +14 -6
- data/lib/xero-ruby/models/projects/time_entries.rb +14 -6
- data/lib/xero-ruby/models/projects/time_entry.rb +14 -6
- data/lib/xero-ruby/models/projects/time_entry_create_or_update.rb +14 -6
- data/lib/xero-ruby/version.rb +2 -2
- data/spec/api_client_spec.rb +101 -13
- data/spec/api_error_spec.rb +45 -0
- data/spec/configuration_spec.rb +9 -16
- data/spec/helper_methods_spec.rb +82 -0
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac629bbf25ab4ffb1de61531dc83b88655157bff77e69b30385d7117f432c9db
|
4
|
+
data.tar.gz: 1f1741df2a1d4aa3b76668dced5b7b5dbc4e2a189f82b384b71dbb517484a1ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56ce2386be68427b63d2dad049780ac1d6cd670eedc8f5d0c28072a9feb41777b5ca672137f59cdd1fb14fa861ec3be4b75e49fc8b833db5ead20d9cd67b6129
|
7
|
+
data.tar.gz: 49d77102f9918b211f303639170aeedabc34d1cf7df6084d64f9c2ff6751654c506fec1967bdc7d8c6a94f61c44bfc0f11138d7144da1ef3abf1415e3a12bcae
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# xero-ruby
|
2
2
|
Xero Ruby SDK for OAuth 2.0 generated from [Xero API OpenAPI Spec](https://github.com/XeroAPI/Xero-OpenAPI).
|
3
3
|
|
4
|
-
[![RubyGem](https://img.shields.io/badge/xero--ruby%20gem-
|
4
|
+
[![RubyGem](https://img.shields.io/badge/xero--ruby%20gem-v2.6.1-brightgreen)](https://rubygems.org/gems/xero-ruby)
|
5
5
|
|
6
6
|
# Documentation
|
7
|
-
Xero Ruby SDK supports Xero's OAuth2.0 authentication and
|
7
|
+
Xero Ruby SDK supports Xero's OAuth2.0 authentication and the following Xero API sets.
|
8
8
|
|
9
9
|
## API Client Docs
|
10
10
|
* [Accounting Api Docs](/docs/accounting/AccountingApi.md)
|
@@ -51,7 +51,7 @@ gem 'xero-ruby'
|
|
51
51
|
|
52
52
|
### Creating a Client
|
53
53
|
* Get the credential values from an API application at https://developer.xero.com/myapps/.
|
54
|
-
* Include [neccesary scopes](https://developer.xero.com/documentation/oauth2/scopes) as
|
54
|
+
* Include [neccesary scopes](https://developer.xero.com/documentation/oauth2/scopes) as a space-separated list
|
55
55
|
* example => "`openid profile email accounting.transactions accounting.settings`"
|
56
56
|
```
|
57
57
|
require 'xero-ruby'
|
@@ -61,7 +61,8 @@ creds = {
|
|
61
61
|
client_id: ENV['CLIENT_ID'],
|
62
62
|
client_secret: ENV['CLIENT_SECRET'],
|
63
63
|
redirect_uri: ENV['REDIRECT_URI'],
|
64
|
-
scopes: ENV['SCOPES']
|
64
|
+
scopes: ENV['SCOPES'],
|
65
|
+
state: "this-can-be-a-custom-state-parameter" # optional
|
65
66
|
}
|
66
67
|
xero_client ||= XeroRuby::ApiClient.new(credentials: creds)
|
67
68
|
```
|
@@ -86,6 +87,9 @@ In your callback route catch, calling `get_token_set_from_callback` will exchang
|
|
86
87
|
token_set = xero_client.get_token_set_from_callback(params)
|
87
88
|
|
88
89
|
# save token_set JSON in a datastore in relation to the user authentication
|
90
|
+
|
91
|
+
puts params['state']
|
92
|
+
=> "this-can-be-a-custom-state-parameter"
|
89
93
|
```
|
90
94
|
|
91
95
|
## Making API calls once you have a token_set
|
@@ -151,7 +155,7 @@ require 'jwt'
|
|
151
155
|
|
152
156
|
def token_expired?
|
153
157
|
token_expiry = Time.at(decoded_access_token['exp'])
|
154
|
-
token_expiry
|
158
|
+
token_expiry > Time.now
|
155
159
|
end
|
156
160
|
|
157
161
|
def decoded_access_token
|
@@ -179,6 +183,10 @@ accounts = xero_client.accounting_api.get_accounts(tenant_id).accounts
|
|
179
183
|
invoices = { invoices: [{ type: XeroRuby::Accounting::Invoice::ACCREC, contact: { contact_id: contacts[0].contact_id }, line_items: [{ description: "Big Agency", quantity: BigDecimal("2.0"), unit_amount: BigDecimal("50.99"), account_code: "600", tax_type: XeroRuby::Accounting::TaxType::NONE }], date: "2019-03-11", due_date: "2018-12-10", reference: "Website Design", status: XeroRuby::Accounting::Invoice::DRAFT }]}
|
180
184
|
invoice = xero_client.accounting_api.create_invoices(tenant_id, invoices).invoices.first
|
181
185
|
|
186
|
+
# display out all the serialized data as a hash
|
187
|
+
puts invoices.attributes
|
188
|
+
=> {type: 'ACCREC', line_items: [...]}
|
189
|
+
|
182
190
|
# Create History
|
183
191
|
payment = xero_client.accounting_api.get_payments(tenant_id).payments.first
|
184
192
|
history_records = { history_records: [{ details: "This payment now has some History!" }]}
|
@@ -328,3 +336,24 @@ xero_client.accounting_api.get_bank_transfers(tenant_id, opts).bank_transfers
|
|
328
336
|
The best resource to understanding how to best leverage this SDK is the sample applications showing all the features of the gem.
|
329
337
|
> https://github.com/XeroAPI/xero-ruby-oauth2-starter (Sinatra - simple getting started)
|
330
338
|
> https://github.com/XeroAPI/xero-ruby-oauth2-app (Rails - full featured examples)
|
339
|
+
|
340
|
+
## Contributing
|
341
|
+
Most of the repo code is auto generated but PR's on issues you encounter are highly encouraged. Xero maintainers will re-incorporate them back into the core SDK build. To develop this gem locally against your project you can use the following development pattern:
|
342
|
+
|
343
|
+
> xero-ruby
|
344
|
+
```bash
|
345
|
+
gem build
|
346
|
+
mv xero-ruby-<vsn>.gem xero-ruby.gem
|
347
|
+
pwd
|
348
|
+
=> /Users/chris.knight/code/sdks/xero-ruby/
|
349
|
+
```
|
350
|
+
|
351
|
+
> xero-ruby-oauth2-app
|
352
|
+
Replace gem file with local path:
|
353
|
+
```bash
|
354
|
+
gem 'xero-ruby', path: '/Users/chris.knight/code/sdks/xero-ruby/'
|
355
|
+
bundle install
|
356
|
+
```
|
357
|
+
|
358
|
+
## Testing
|
359
|
+
* `rspec spec/`
|
data/lib/xero-ruby.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
5
|
|
6
|
-
The version of the OpenAPI document: 2.6.0
|
7
6
|
Contact: api@xero.com
|
8
7
|
Generated by: https://openapi-generator.tech
|
9
8
|
OpenAPI Generator version: 4.3.1
|
@@ -332,6 +331,7 @@ require 'xero-ruby/models/accounting/accounts_receivable'
|
|
332
331
|
require 'xero-ruby/models/accounting/action'
|
333
332
|
require 'xero-ruby/models/accounting/actions'
|
334
333
|
require 'xero-ruby/models/accounting/address'
|
334
|
+
require 'xero-ruby/models/accounting/address_for_organisation'
|
335
335
|
require 'xero-ruby/models/accounting/allocation'
|
336
336
|
require 'xero-ruby/models/accounting/allocations'
|
337
337
|
require 'xero-ruby/models/accounting/attachment'
|
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
5
|
|
6
|
-
The version of the OpenAPI document: 2.6.0
|
7
6
|
Contact: api@xero.com
|
8
7
|
Generated by: https://openapi-generator.tech
|
9
8
|
OpenAPI Generator version: 4.3.1
|
@@ -595,6 +594,7 @@ module XeroRuby
|
|
595
594
|
return data, status_code, headers
|
596
595
|
end
|
597
596
|
|
597
|
+
# Allows you to create history record for a bank transfers
|
598
598
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
599
599
|
# @param bank_transfer_id [String] Xero generated unique identifier for a bank transfer
|
600
600
|
# @param history_records [HistoryRecords] HistoryRecords containing an array of HistoryRecord objects in body of request
|
@@ -605,6 +605,7 @@ module XeroRuby
|
|
605
605
|
data
|
606
606
|
end
|
607
607
|
|
608
|
+
# Allows you to create history record for a bank transfers
|
608
609
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
609
610
|
# @param bank_transfer_id [String] Xero generated unique identifier for a bank transfer
|
610
611
|
# @param history_records [HistoryRecords] HistoryRecords containing an array of HistoryRecord objects in body of request
|
@@ -1663,6 +1664,7 @@ module XeroRuby
|
|
1663
1664
|
return data, status_code, headers
|
1664
1665
|
end
|
1665
1666
|
|
1667
|
+
# Allows you to create a new currency for an org
|
1666
1668
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
1667
1669
|
# @param currency [Currency] Currency obejct in the body of request
|
1668
1670
|
# @param [Hash] opts the optional parameters
|
@@ -1672,6 +1674,7 @@ module XeroRuby
|
|
1672
1674
|
data
|
1673
1675
|
end
|
1674
1676
|
|
1677
|
+
# Allows you to create a new currency for an org
|
1675
1678
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
1676
1679
|
# @param currency [Currency] Currency obejct in the body of request
|
1677
1680
|
# @param [Hash] opts the optional parameters
|
@@ -15322,6 +15325,7 @@ module XeroRuby
|
|
15322
15325
|
return data, status_code, headers
|
15323
15326
|
end
|
15324
15327
|
|
15328
|
+
# Allows you to update one contact in a Xero organisation
|
15325
15329
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
15326
15330
|
# @param contact_id [String] Unique identifier for a Contact
|
15327
15331
|
# @param contacts [Contacts] an array of Contacts containing single Contact object with properties to update
|
@@ -15332,6 +15336,7 @@ module XeroRuby
|
|
15332
15336
|
data
|
15333
15337
|
end
|
15334
15338
|
|
15339
|
+
# Allows you to update one contact in a Xero organisation
|
15335
15340
|
# @param xero_tenant_id [String] Xero identifier for Tenant
|
15336
15341
|
# @param contact_id [String] Unique identifier for a Contact
|
15337
15342
|
# @param contacts [Contacts] an array of Contacts containing single Contact object with properties to update
|
data/lib/xero-ruby/api_client.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
5
|
|
6
|
-
The version of the OpenAPI document: 2.6.0
|
7
6
|
Contact: api@xero.com
|
8
7
|
Generated by: https://openapi-generator.tech
|
9
8
|
OpenAPI Generator version: 4.3.1
|
@@ -34,6 +33,7 @@ module XeroRuby
|
|
34
33
|
@client_secret = credentials[:client_secret]
|
35
34
|
@redirect_uri = credentials[:redirect_uri]
|
36
35
|
@scopes = credentials[:scopes]
|
36
|
+
@state = credentials[:state]
|
37
37
|
@config = config
|
38
38
|
@user_agent = "xero-ruby-#{VERSION}"
|
39
39
|
@default_headers = {
|
@@ -44,6 +44,7 @@ module XeroRuby
|
|
44
44
|
|
45
45
|
def authorization_url
|
46
46
|
url = "#{@config.login_url}?response_type=code&client_id=#{@client_id}&redirect_uri=#{@redirect_uri}&scope=#{@scopes}"
|
47
|
+
url << "&state=#{@state}" if @state
|
47
48
|
return url
|
48
49
|
end
|
49
50
|
|
@@ -125,6 +126,7 @@ module XeroRuby
|
|
125
126
|
req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
126
127
|
req.body = URI.encode_www_form(data)
|
127
128
|
end
|
129
|
+
return_error(response) unless response.success?
|
128
130
|
body = JSON.parse(response.body)
|
129
131
|
set_token_set(body)
|
130
132
|
return body
|
@@ -132,20 +134,17 @@ module XeroRuby
|
|
132
134
|
|
133
135
|
# Connection heplers
|
134
136
|
def connections
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
body = JSON.parse(response.body)
|
140
|
-
return body
|
137
|
+
@config.base_url = 'https://api.xero.com'
|
138
|
+
opts = { :header_params => {'Content-Type': 'application/json'}, :auth_names => ['OAuth2'] }
|
139
|
+
response = call_api(:GET, "/connections/", nil, opts)
|
140
|
+
response[0]
|
141
141
|
end
|
142
142
|
|
143
143
|
def disconnect(connection_id)
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
return connections
|
144
|
+
@config.base_url = 'https://api.xero.com'
|
145
|
+
opts = { :header_params => {'Content-Type': 'application/json'}, :auth_names => ['OAuth2'] }
|
146
|
+
call_api(:DELETE, "/connections/#{connection_id}", nil, opts)
|
147
|
+
connections
|
149
148
|
end
|
150
149
|
|
151
150
|
# Call an API with given options.
|
@@ -179,18 +178,7 @@ module XeroRuby
|
|
179
178
|
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
180
179
|
end
|
181
180
|
|
182
|
-
unless response.success?
|
183
|
-
if response.status == 0
|
184
|
-
# Errors from libcurl will be made visible here
|
185
|
-
fail ApiError.new(:code => 0,
|
186
|
-
:message => response.return_message)
|
187
|
-
else
|
188
|
-
fail ApiError.new(:code => response.status,
|
189
|
-
:response_headers => response.headers,
|
190
|
-
:response_body => response.body),
|
191
|
-
response.reason_phrase
|
192
|
-
end
|
193
|
-
end
|
181
|
+
return_error(response) unless response.success?
|
194
182
|
rescue Faraday::TimeoutError
|
195
183
|
fail ApiError.new('Connection timed out')
|
196
184
|
end
|
@@ -198,12 +186,27 @@ module XeroRuby
|
|
198
186
|
if opts[:return_type]
|
199
187
|
prepare_file(response) if opts[:return_type] == 'File'
|
200
188
|
data = deserialize(response, opts[:return_type], api_client)
|
189
|
+
elsif !response.body.empty?
|
190
|
+
data = JSON.parse(response.body)
|
201
191
|
else
|
202
192
|
data = nil
|
203
193
|
end
|
204
194
|
return data, response.status, response.headers
|
205
195
|
end
|
206
196
|
|
197
|
+
def return_error(response)
|
198
|
+
if response.status == 0
|
199
|
+
# Errors from libcurl will be made visible here
|
200
|
+
fail ApiError.new(:code => 0,
|
201
|
+
:message => response.return_message)
|
202
|
+
else
|
203
|
+
fail ApiError.new(:code => response.status,
|
204
|
+
:response_headers => response.headers,
|
205
|
+
:response_body => response.body),
|
206
|
+
response.reason_phrase
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
207
210
|
# Builds the HTTP request
|
208
211
|
#
|
209
212
|
# @param [String] http_method HTTP method/verb (e.g. POST)
|
@@ -416,9 +419,13 @@ module XeroRuby
|
|
416
419
|
end
|
417
420
|
|
418
421
|
def build_request_url(path)
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
+
if @config.base_url
|
423
|
+
# Add leading and trailing slashes to path
|
424
|
+
path = "/#{path}".gsub(/\/+/, '/')
|
425
|
+
@config.base_url + path
|
426
|
+
else
|
427
|
+
path
|
428
|
+
end
|
422
429
|
end
|
423
430
|
|
424
431
|
# Update hearder and query params based on authentication settings.
|
data/lib/xero-ruby/api_error.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
5
|
|
6
|
-
The version of the OpenAPI document: 2.6.0
|
7
6
|
Contact: api@xero.com
|
8
7
|
Generated by: https://openapi-generator.tech
|
9
8
|
OpenAPI Generator version: 4.3.1
|
@@ -21,8 +20,8 @@ module XeroRuby
|
|
21
20
|
# ApiError.new(:code => 404, :message => "Not Found")
|
22
21
|
def initialize(arg = nil)
|
23
22
|
if arg.is_a? Hash
|
24
|
-
if arg.key?(:message) || arg.key?('message')
|
25
|
-
super(arg[:message] || arg['message'])
|
23
|
+
if arg.key?(:message) || arg.key?('message') || arg.key?(:Message) || arg.key?('Message')
|
24
|
+
super(arg[:message] || arg['message'] || arg.key?(:Message) || arg.key?('Message'))
|
26
25
|
else
|
27
26
|
super arg
|
28
27
|
end
|
@@ -31,6 +30,7 @@ module XeroRuby
|
|
31
30
|
instance_variable_set "@#{k}", v
|
32
31
|
end
|
33
32
|
else
|
33
|
+
@message = arg
|
34
34
|
super arg
|
35
35
|
end
|
36
36
|
end
|
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
5
5
|
|
6
|
-
The version of the OpenAPI document: 2.6.0
|
7
6
|
Contact: api@xero.com
|
8
7
|
Generated by: https://openapi-generator.tech
|
9
8
|
OpenAPI Generator version: 4.3.1
|
@@ -91,7 +90,6 @@ module XeroRuby::Accounting
|
|
91
90
|
CISLABOURINCOME = "CISLABOURINCOME".freeze
|
92
91
|
CISLIABILITY = "CISLIABILITY".freeze
|
93
92
|
CISMATERIALS = "CISMATERIALS".freeze
|
94
|
-
# duplicate definitions generated: https://github.com/XeroAPI/xero-ruby/issues/53#issuecomment-668893305
|
95
93
|
# EMPTY = "".freeze
|
96
94
|
|
97
95
|
# Shown if set
|
@@ -485,16 +483,22 @@ module XeroRuby::Accounting
|
|
485
483
|
|
486
484
|
# Returns the object in the form of hash
|
487
485
|
# @return [Hash] Returns the object in the form of hash
|
488
|
-
def to_hash
|
486
|
+
def to_hash(downcase: false)
|
489
487
|
hash = {}
|
490
488
|
self.class.attribute_map.each_pair do |attr, param|
|
491
489
|
value = self.send(attr)
|
492
490
|
next if value.nil?
|
493
|
-
|
491
|
+
key = downcase ? attr : param
|
492
|
+
hash[key] = _to_hash(value)
|
494
493
|
end
|
495
494
|
hash
|
496
495
|
end
|
497
496
|
|
497
|
+
# Returns the object in the form of hash with snake_case
|
498
|
+
def attributes
|
499
|
+
to_hash(downcase: true)
|
500
|
+
end
|
501
|
+
|
498
502
|
# Outputs non-array value in the form of hash
|
499
503
|
# For object, use to_hash. Otherwise, just return the value
|
500
504
|
# @param [Object] value Any valid value
|
@@ -513,10 +517,13 @@ module XeroRuby::Accounting
|
|
513
517
|
end
|
514
518
|
end
|
515
519
|
|
516
|
-
# customized data_parser
|
517
520
|
def parse_date(datestring)
|
518
|
-
|
519
|
-
|
521
|
+
if datestring.include?('Date')
|
522
|
+
seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
|
523
|
+
Time.at(seconds_since_epoch).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
524
|
+
else # handle date 'types' for small subset of payroll API's
|
525
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
526
|
+
end
|
520
527
|
end
|
521
528
|
end
|
522
529
|
end
|