xero-ruby 0.2.4 → 0.4.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.
Files changed (248) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -5
  3. data/docs/AccountingApi.md +53 -0
  4. data/docs/Quote.md +2 -2
  5. data/lib/xero-ruby/api/accounting_api.rb +69 -2
  6. data/lib/xero-ruby/api_client.rb +131 -40
  7. data/lib/xero-ruby/api_error.rb +2 -2
  8. data/lib/xero-ruby/configuration.rb +22 -18
  9. data/lib/xero-ruby/models/account.rb +2 -2
  10. data/lib/xero-ruby/models/account_type.rb +2 -2
  11. data/lib/xero-ruby/models/accounts.rb +2 -2
  12. data/lib/xero-ruby/models/accounts_payable.rb +2 -2
  13. data/lib/xero-ruby/models/accounts_receivable.rb +2 -2
  14. data/lib/xero-ruby/models/address.rb +2 -2
  15. data/lib/xero-ruby/models/allocation.rb +2 -2
  16. data/lib/xero-ruby/models/allocations.rb +2 -2
  17. data/lib/xero-ruby/models/attachment.rb +2 -2
  18. data/lib/xero-ruby/models/attachments.rb +2 -2
  19. data/lib/xero-ruby/models/balances.rb +2 -2
  20. data/lib/xero-ruby/models/bank_transaction.rb +2 -2
  21. data/lib/xero-ruby/models/bank_transactions.rb +2 -2
  22. data/lib/xero-ruby/models/bank_transfer.rb +2 -2
  23. data/lib/xero-ruby/models/bank_transfers.rb +2 -2
  24. data/lib/xero-ruby/models/batch_payment.rb +2 -2
  25. data/lib/xero-ruby/models/batch_payment_details.rb +2 -2
  26. data/lib/xero-ruby/models/batch_payments.rb +2 -2
  27. data/lib/xero-ruby/models/bill.rb +2 -2
  28. data/lib/xero-ruby/models/branding_theme.rb +2 -2
  29. data/lib/xero-ruby/models/branding_themes.rb +2 -2
  30. data/lib/xero-ruby/models/cis_org_setting.rb +2 -2
  31. data/lib/xero-ruby/models/cis_setting.rb +2 -2
  32. data/lib/xero-ruby/models/cis_settings.rb +2 -2
  33. data/lib/xero-ruby/models/contact.rb +2 -2
  34. data/lib/xero-ruby/models/contact_group.rb +2 -2
  35. data/lib/xero-ruby/models/contact_groups.rb +2 -2
  36. data/lib/xero-ruby/models/contact_person.rb +2 -2
  37. data/lib/xero-ruby/models/contacts.rb +2 -2
  38. data/lib/xero-ruby/models/country_code.rb +2 -2
  39. data/lib/xero-ruby/models/credit_note.rb +2 -2
  40. data/lib/xero-ruby/models/credit_notes.rb +2 -2
  41. data/lib/xero-ruby/models/currencies.rb +2 -2
  42. data/lib/xero-ruby/models/currency.rb +2 -2
  43. data/lib/xero-ruby/models/currency_code.rb +2 -2
  44. data/lib/xero-ruby/models/element.rb +2 -2
  45. data/lib/xero-ruby/models/employee.rb +2 -2
  46. data/lib/xero-ruby/models/employees.rb +2 -2
  47. data/lib/xero-ruby/models/error.rb +2 -2
  48. data/lib/xero-ruby/models/expense_claim.rb +2 -2
  49. data/lib/xero-ruby/models/expense_claims.rb +2 -2
  50. data/lib/xero-ruby/models/external_link.rb +2 -2
  51. data/lib/xero-ruby/models/history_record.rb +2 -2
  52. data/lib/xero-ruby/models/history_records.rb +2 -2
  53. data/lib/xero-ruby/models/invoice.rb +2 -2
  54. data/lib/xero-ruby/models/invoice_reminder.rb +2 -2
  55. data/lib/xero-ruby/models/invoice_reminders.rb +2 -2
  56. data/lib/xero-ruby/models/invoices.rb +2 -2
  57. data/lib/xero-ruby/models/item.rb +2 -2
  58. data/lib/xero-ruby/models/items.rb +2 -2
  59. data/lib/xero-ruby/models/journal.rb +2 -2
  60. data/lib/xero-ruby/models/journal_line.rb +2 -2
  61. data/lib/xero-ruby/models/journals.rb +2 -2
  62. data/lib/xero-ruby/models/line_amount_types.rb +2 -2
  63. data/lib/xero-ruby/models/line_item.rb +2 -2
  64. data/lib/xero-ruby/models/line_item_tracking.rb +2 -2
  65. data/lib/xero-ruby/models/linked_transaction.rb +2 -2
  66. data/lib/xero-ruby/models/linked_transactions.rb +2 -2
  67. data/lib/xero-ruby/models/manual_journal.rb +2 -2
  68. data/lib/xero-ruby/models/manual_journal_line.rb +2 -2
  69. data/lib/xero-ruby/models/manual_journals.rb +2 -2
  70. data/lib/xero-ruby/models/online_invoice.rb +2 -2
  71. data/lib/xero-ruby/models/online_invoices.rb +2 -2
  72. data/lib/xero-ruby/models/organisation.rb +2 -2
  73. data/lib/xero-ruby/models/organisations.rb +2 -2
  74. data/lib/xero-ruby/models/overpayment.rb +2 -2
  75. data/lib/xero-ruby/models/overpayments.rb +2 -2
  76. data/lib/xero-ruby/models/payment.rb +2 -2
  77. data/lib/xero-ruby/models/payment_delete.rb +2 -2
  78. data/lib/xero-ruby/models/payment_service.rb +2 -2
  79. data/lib/xero-ruby/models/payment_services.rb +2 -2
  80. data/lib/xero-ruby/models/payment_term.rb +2 -2
  81. data/lib/xero-ruby/models/payment_term_type.rb +2 -2
  82. data/lib/xero-ruby/models/payments.rb +2 -2
  83. data/lib/xero-ruby/models/phone.rb +2 -2
  84. data/lib/xero-ruby/models/prepayment.rb +2 -2
  85. data/lib/xero-ruby/models/prepayments.rb +2 -2
  86. data/lib/xero-ruby/models/purchase.rb +2 -2
  87. data/lib/xero-ruby/models/purchase_order.rb +2 -2
  88. data/lib/xero-ruby/models/purchase_orders.rb +2 -2
  89. data/lib/xero-ruby/models/quote.rb +3 -3
  90. data/lib/xero-ruby/models/quote_line_amount_types.rb +2 -2
  91. data/lib/xero-ruby/models/quote_status_codes.rb +2 -2
  92. data/lib/xero-ruby/models/quotes.rb +2 -2
  93. data/lib/xero-ruby/models/receipt.rb +2 -2
  94. data/lib/xero-ruby/models/receipts.rb +2 -2
  95. data/lib/xero-ruby/models/repeating_invoice.rb +2 -2
  96. data/lib/xero-ruby/models/repeating_invoices.rb +2 -2
  97. data/lib/xero-ruby/models/report.rb +2 -2
  98. data/lib/xero-ruby/models/report_attribute.rb +2 -2
  99. data/lib/xero-ruby/models/report_cell.rb +2 -2
  100. data/lib/xero-ruby/models/report_fields.rb +2 -2
  101. data/lib/xero-ruby/models/report_row.rb +2 -2
  102. data/lib/xero-ruby/models/report_rows.rb +2 -2
  103. data/lib/xero-ruby/models/report_with_row.rb +2 -2
  104. data/lib/xero-ruby/models/report_with_rows.rb +2 -2
  105. data/lib/xero-ruby/models/reports.rb +2 -2
  106. data/lib/xero-ruby/models/request_empty.rb +2 -2
  107. data/lib/xero-ruby/models/row_type.rb +2 -2
  108. data/lib/xero-ruby/models/sales_tracking_category.rb +2 -2
  109. data/lib/xero-ruby/models/schedule.rb +2 -2
  110. data/lib/xero-ruby/models/tax_component.rb +2 -2
  111. data/lib/xero-ruby/models/tax_rate.rb +2 -2
  112. data/lib/xero-ruby/models/tax_rates.rb +2 -2
  113. data/lib/xero-ruby/models/tax_type.rb +2 -2
  114. data/lib/xero-ruby/models/ten_nintey_nine_contact.rb +2 -2
  115. data/lib/xero-ruby/models/time_zone.rb +2 -2
  116. data/lib/xero-ruby/models/tracking_categories.rb +2 -2
  117. data/lib/xero-ruby/models/tracking_category.rb +2 -2
  118. data/lib/xero-ruby/models/tracking_option.rb +2 -2
  119. data/lib/xero-ruby/models/tracking_options.rb +2 -2
  120. data/lib/xero-ruby/models/user.rb +2 -2
  121. data/lib/xero-ruby/models/users.rb +2 -2
  122. data/lib/xero-ruby/models/validation_error.rb +2 -2
  123. data/lib/xero-ruby/version.rb +3 -3
  124. data/lib/xero-ruby.rb +2 -2
  125. data/spec/api/accounting_api_spec.rb +14 -2
  126. data/spec/api_client_spec.rb +2 -40
  127. data/spec/configuration_spec.rb +2 -2
  128. data/spec/models/account_spec.rb +2 -2
  129. data/spec/models/account_type_spec.rb +2 -2
  130. data/spec/models/accounts_payable_spec.rb +2 -2
  131. data/spec/models/accounts_receivable_spec.rb +2 -2
  132. data/spec/models/accounts_spec.rb +2 -2
  133. data/spec/models/address_spec.rb +2 -2
  134. data/spec/models/allocation_spec.rb +2 -2
  135. data/spec/models/allocations_spec.rb +2 -2
  136. data/spec/models/attachment_spec.rb +2 -2
  137. data/spec/models/attachments_spec.rb +2 -2
  138. data/spec/models/balances_spec.rb +2 -2
  139. data/spec/models/bank_transaction_spec.rb +2 -2
  140. data/spec/models/bank_transactions_spec.rb +2 -2
  141. data/spec/models/bank_transfer_spec.rb +2 -2
  142. data/spec/models/bank_transfers_spec.rb +2 -2
  143. data/spec/models/batch_payment_details_spec.rb +2 -2
  144. data/spec/models/batch_payment_spec.rb +2 -2
  145. data/spec/models/batch_payments_spec.rb +2 -2
  146. data/spec/models/bill_spec.rb +2 -2
  147. data/spec/models/branding_theme_spec.rb +2 -2
  148. data/spec/models/branding_themes_spec.rb +2 -2
  149. data/spec/models/cis_org_setting_spec.rb +2 -2
  150. data/spec/models/cis_setting_spec.rb +2 -2
  151. data/spec/models/cis_settings_spec.rb +2 -2
  152. data/spec/models/contact_group_spec.rb +2 -2
  153. data/spec/models/contact_groups_spec.rb +2 -2
  154. data/spec/models/contact_person_spec.rb +2 -2
  155. data/spec/models/contact_spec.rb +2 -2
  156. data/spec/models/contacts_spec.rb +2 -2
  157. data/spec/models/country_code_spec.rb +2 -2
  158. data/spec/models/credit_note_spec.rb +2 -2
  159. data/spec/models/credit_notes_spec.rb +2 -2
  160. data/spec/models/currencies_spec.rb +2 -2
  161. data/spec/models/currency_code_spec.rb +2 -2
  162. data/spec/models/currency_spec.rb +2 -2
  163. data/spec/models/element_spec.rb +2 -2
  164. data/spec/models/employee_spec.rb +2 -2
  165. data/spec/models/employees_spec.rb +2 -2
  166. data/spec/models/error_spec.rb +2 -2
  167. data/spec/models/expense_claim_spec.rb +2 -2
  168. data/spec/models/expense_claims_spec.rb +2 -2
  169. data/spec/models/external_link_spec.rb +2 -2
  170. data/spec/models/history_record_spec.rb +2 -2
  171. data/spec/models/history_records_spec.rb +2 -2
  172. data/spec/models/invoice_reminder_spec.rb +2 -2
  173. data/spec/models/invoice_reminders_spec.rb +2 -2
  174. data/spec/models/invoice_spec.rb +2 -2
  175. data/spec/models/invoices_spec.rb +2 -2
  176. data/spec/models/item_spec.rb +2 -2
  177. data/spec/models/items_spec.rb +2 -2
  178. data/spec/models/journal_line_spec.rb +2 -2
  179. data/spec/models/journal_spec.rb +2 -2
  180. data/spec/models/journals_spec.rb +2 -2
  181. data/spec/models/line_amount_types_spec.rb +2 -2
  182. data/spec/models/line_item_spec.rb +2 -2
  183. data/spec/models/line_item_tracking_spec.rb +2 -2
  184. data/spec/models/linked_transaction_spec.rb +2 -2
  185. data/spec/models/linked_transactions_spec.rb +2 -2
  186. data/spec/models/manual_journal_line_spec.rb +2 -2
  187. data/spec/models/manual_journal_spec.rb +2 -2
  188. data/spec/models/manual_journals_spec.rb +2 -2
  189. data/spec/models/online_invoice_spec.rb +2 -2
  190. data/spec/models/online_invoices_spec.rb +2 -2
  191. data/spec/models/organisation_spec.rb +2 -2
  192. data/spec/models/organisations_spec.rb +2 -2
  193. data/spec/models/overpayment_spec.rb +2 -2
  194. data/spec/models/overpayments_spec.rb +2 -2
  195. data/spec/models/payment_delete_spec.rb +2 -2
  196. data/spec/models/payment_service_spec.rb +2 -2
  197. data/spec/models/payment_services_spec.rb +2 -2
  198. data/spec/models/payment_spec.rb +2 -2
  199. data/spec/models/payment_term_spec.rb +2 -2
  200. data/spec/models/payment_term_type_spec.rb +2 -2
  201. data/spec/models/payments_spec.rb +2 -2
  202. data/spec/models/phone_spec.rb +2 -2
  203. data/spec/models/prepayment_spec.rb +2 -2
  204. data/spec/models/prepayments_spec.rb +2 -2
  205. data/spec/models/purchase_order_spec.rb +2 -2
  206. data/spec/models/purchase_orders_spec.rb +2 -2
  207. data/spec/models/purchase_spec.rb +2 -2
  208. data/spec/models/quote_line_amount_types_spec.rb +2 -2
  209. data/spec/models/quote_spec.rb +2 -2
  210. data/spec/models/quote_status_codes_spec.rb +2 -2
  211. data/spec/models/quotes_spec.rb +2 -2
  212. data/spec/models/receipt_spec.rb +2 -2
  213. data/spec/models/receipts_spec.rb +2 -2
  214. data/spec/models/repeating_invoice_spec.rb +2 -2
  215. data/spec/models/repeating_invoices_spec.rb +2 -2
  216. data/spec/models/report_attribute_spec.rb +2 -2
  217. data/spec/models/report_cell_spec.rb +2 -2
  218. data/spec/models/report_fields_spec.rb +2 -2
  219. data/spec/models/report_row_spec.rb +2 -2
  220. data/spec/models/report_rows_spec.rb +2 -2
  221. data/spec/models/report_spec.rb +2 -2
  222. data/spec/models/report_with_row_spec.rb +2 -2
  223. data/spec/models/report_with_rows_spec.rb +2 -2
  224. data/spec/models/reports_spec.rb +2 -2
  225. data/spec/models/request_empty_spec.rb +2 -2
  226. data/spec/models/row_type_spec.rb +2 -2
  227. data/spec/models/sales_tracking_category_spec.rb +2 -2
  228. data/spec/models/schedule_spec.rb +2 -2
  229. data/spec/models/tax_component_spec.rb +2 -2
  230. data/spec/models/tax_rate_spec.rb +2 -2
  231. data/spec/models/tax_rates_spec.rb +2 -2
  232. data/spec/models/tax_type_spec.rb +2 -2
  233. data/spec/models/ten_nintey_nine_contact_spec.rb +2 -2
  234. data/spec/models/time_zone_spec.rb +2 -2
  235. data/spec/models/tracking_categories_spec.rb +2 -2
  236. data/spec/models/tracking_category_spec.rb +2 -2
  237. data/spec/models/tracking_option_spec.rb +2 -2
  238. data/spec/models/tracking_options_spec.rb +2 -2
  239. data/spec/models/user_spec.rb +2 -2
  240. data/spec/models/users_spec.rb +2 -2
  241. data/spec/models/validation_error_spec.rb +2 -2
  242. data/spec/spec_helper.rb +2 -2
  243. data/xero-ruby.gemspec +4 -4
  244. metadata +19 -29
  245. data/lib/.DS_Store +0 -0
  246. data/pkg/xero-ruby-0.1.3.gem +0 -0
  247. data/pkg/xero-ruby-0.2.2.gem +0 -0
  248. data/pkg/xero-ruby-0.2.3.gem +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffe680c04cda95a33d7b3aff3dd51b93812203c7527d2658c5b9138b29b17422
4
- data.tar.gz: e0e6af866b753c6fdb3a17a53e61915cac9d545c25548e2bc5cefeeaaa59ad56
3
+ metadata.gz: bbd6d698e93c47ec0c3251ce75cad23fd527e9a09a5e78e6cd51c3146fdbd1fb
4
+ data.tar.gz: 94bf700ada73f13d9728603c468eedb973469743d135891d22bf9240f35117f6
5
5
  SHA512:
6
- metadata.gz: 8ca5fd95b9f049d685556a10198affe124206d5434b8cd56b8f51710f7e57bab3863144561defbe5e8a5805ee1161bab559c70f056df61577cab291efe872a44
7
- data.tar.gz: ee6af30caadca29dc9ace5d8e02d9c964fc52456e78769e1a2047703bee66cfbb02e310cd7f51949a6eed0d27d013eb9863aef3aa0e31e17b79b51bc7f3b2d0b
6
+ metadata.gz: 3bf3e925dce199cd46b6ffbfe43135f1bdd2d27d822509f1120c09d7fc3541ff8e2537731c852852100fc80b60fa0683568c0f7febe44ee6988c081196520cc1
7
+ data.tar.gz: 2dd4340914e4ab9297cd071002e7003790d6a239c7daa4fb01536072bb6a93590927446264f239322fb6f647519db1f259b26b0cb12881510ae124fd88870023
data/README.md CHANGED
@@ -6,8 +6,8 @@ No description provided (generated by Openapi Generator https://github.com/opena
6
6
 
7
7
  This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
8
8
 
9
- - API version: 2.0.7
10
- - Package version: 0.2.4
9
+ - API version: 2.0.9
10
+ - Package version: 0.4.0
11
11
  - Build package: org.openapitools.codegen.languages.RubyClientCodegen
12
12
  For more information, please visit [https://developer.xero.com](https://developer.xero.com)
13
13
 
@@ -24,16 +24,16 @@ gem build xero-ruby.gemspec
24
24
  Then either install the gem locally:
25
25
 
26
26
  ```shell
27
- gem install ./xero-ruby-0.2.4.gem
27
+ gem install ./xero-ruby-0.4.0.gem
28
28
  ```
29
29
 
30
- (for development, run `gem install --dev ./xero-ruby-0.2.4.gem` to install the development dependencies)
30
+ (for development, run `gem install --dev ./xero-ruby-0.4.0.gem` to install the development dependencies)
31
31
 
32
32
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
33
33
 
34
34
  Finally add this to the Gemfile:
35
35
 
36
- gem 'xero-ruby', '~> 0.2.4'
36
+ gem 'xero-ruby', '~> 0.4.0'
37
37
 
38
38
  ### Install from Git
39
39
 
@@ -223,6 +223,7 @@ Class | Method | HTTP request | Description
223
223
  *XeroRuby::AccountingApi* | [**get_prepayment_history**](docs/AccountingApi.md#get_prepayment_history) | **GET** /Prepayments/{PrepaymentID}/History | Allows you to retrieve a history records of an Prepayment
224
224
  *XeroRuby::AccountingApi* | [**get_prepayments**](docs/AccountingApi.md#get_prepayments) | **GET** /Prepayments | Allows you to retrieve prepayments
225
225
  *XeroRuby::AccountingApi* | [**get_purchase_order**](docs/AccountingApi.md#get_purchase_order) | **GET** /PurchaseOrders/{PurchaseOrderID} | Allows you to retrieve a specified purchase orders
226
+ *XeroRuby::AccountingApi* | [**get_purchase_order_as_pdf**](docs/AccountingApi.md#get_purchase_order_as_pdf) | **GET** /PurchaseOrders/{PurchaseOrderID}/pdf | Allows you to retrieve purchase orders as PDF files
226
227
  *XeroRuby::AccountingApi* | [**get_purchase_order_by_number**](docs/AccountingApi.md#get_purchase_order_by_number) | **GET** /PurchaseOrders/{PurchaseOrderNumber} | Allows you to retrieve a specified purchase orders
227
228
  *XeroRuby::AccountingApi* | [**get_purchase_order_history**](docs/AccountingApi.md#get_purchase_order_history) | **GET** /PurchaseOrders/{PurchaseOrderID}/History | Allows you to retrieve history for PurchaseOrder
228
229
  *XeroRuby::AccountingApi* | [**get_purchase_orders**](docs/AccountingApi.md#get_purchase_orders) | **GET** /PurchaseOrders | Allows you to retrieve purchase orders
@@ -144,6 +144,7 @@ Method | HTTP request | Description
144
144
  [**get_prepayment_history**](AccountingApi.md#get_prepayment_history) | **GET** /Prepayments/{PrepaymentID}/History | Allows you to retrieve a history records of an Prepayment
145
145
  [**get_prepayments**](AccountingApi.md#get_prepayments) | **GET** /Prepayments | Allows you to retrieve prepayments
146
146
  [**get_purchase_order**](AccountingApi.md#get_purchase_order) | **GET** /PurchaseOrders/{PurchaseOrderID} | Allows you to retrieve a specified purchase orders
147
+ [**get_purchase_order_as_pdf**](AccountingApi.md#get_purchase_order_as_pdf) | **GET** /PurchaseOrders/{PurchaseOrderID}/pdf | Allows you to retrieve purchase orders as PDF files
147
148
  [**get_purchase_order_by_number**](AccountingApi.md#get_purchase_order_by_number) | **GET** /PurchaseOrders/{PurchaseOrderNumber} | Allows you to retrieve a specified purchase orders
148
149
  [**get_purchase_order_history**](AccountingApi.md#get_purchase_order_history) | **GET** /PurchaseOrders/{PurchaseOrderID}/History | Allows you to retrieve history for PurchaseOrder
149
150
  [**get_purchase_orders**](AccountingApi.md#get_purchase_orders) | **GET** /PurchaseOrders | Allows you to retrieve purchase orders
@@ -7861,6 +7862,58 @@ Name | Type | Description | Notes
7861
7862
  - **Accept**: application/json
7862
7863
 
7863
7864
 
7865
+ ## get_purchase_order_as_pdf
7866
+
7867
+ > File get_purchase_order_as_pdf(xero_tenant_id, purchase_order_id)
7868
+
7869
+ Allows you to retrieve purchase orders as PDF files
7870
+
7871
+ ### Example
7872
+
7873
+ ```ruby
7874
+ # load the gem
7875
+ require 'xero-ruby'
7876
+ # setup authorization
7877
+ XeroRuby.configure do |config|
7878
+ # Configure OAuth2 access token for authorization: OAuth2
7879
+ config.access_token = 'YOUR ACCESS TOKEN'
7880
+ end
7881
+
7882
+ api_instance = XeroRuby::AccountingApi.new
7883
+ xero_tenant_id = 'YOUR_XERO_TENANT_ID' # String | Xero identifier for Tenant
7884
+ purchase_order_id = '00000000-0000-0000-000-000000000000' # String | Unique identifier for an Purchase Order
7885
+
7886
+ begin
7887
+ #Allows you to retrieve purchase orders as PDF files
7888
+ result = api_instance.get_purchase_order_as_pdf(xero_tenant_id, purchase_order_id)
7889
+ p result
7890
+ rescue XeroRuby::ApiError => e
7891
+ puts "Exception when calling AccountingApi->get_purchase_order_as_pdf: #{e}"
7892
+ end
7893
+ ```
7894
+
7895
+ ### Parameters
7896
+
7897
+
7898
+ Name | Type | Description | Notes
7899
+ ------------- | ------------- | ------------- | -------------
7900
+ **xero_tenant_id** | **String**| Xero identifier for Tenant |
7901
+ **purchase_order_id** | [**String**](.md)| Unique identifier for an Purchase Order |
7902
+
7903
+ ### Return type
7904
+
7905
+ **File**
7906
+
7907
+ ### Authorization
7908
+
7909
+ [OAuth2](../README.md#OAuth2)
7910
+
7911
+ ### HTTP request headers
7912
+
7913
+ - **Content-Type**: Not defined
7914
+ - **Accept**: application/pdf
7915
+
7916
+
7864
7917
  ## get_purchase_order_by_number
7865
7918
 
7866
7919
  > PurchaseOrders get_purchase_order_by_number(xero_tenant_id, purchase_order_number)
data/docs/Quote.md CHANGED
@@ -24,7 +24,7 @@ Name | Type | Description | Notes
24
24
  **title** | **String** | Title text for the quote | [optional]
25
25
  **summary** | **String** | Summary text for the quote | [optional]
26
26
  **branding_theme_id** | **String** | See BrandingThemes | [optional]
27
- **updated_date_utc** | **String** | Last modified date UTC format | [optional]
27
+ **updated_date_utc** | **DateTime** | Last modified date UTC format | [optional]
28
28
  **line_amount_types** | [**QuoteLineAmountTypes**](QuoteLineAmountTypes.md) | | [optional]
29
29
 
30
30
  ## Code Sample
@@ -52,7 +52,7 @@ instance = XeroRuby::Quote.new(quote_id: null,
52
52
  title: null,
53
53
  summary: null,
54
54
  branding_theme_id: null,
55
- updated_date_utc: /Date(1573755038314)/,
55
+ updated_date_utc: null,
56
56
  line_amount_types: null)
57
57
  ```
58
58
 
@@ -3,10 +3,10 @@
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.0.7
6
+ The version of the OpenAPI document: 2.0.9
7
7
  Contact: api@xero.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.3.0
10
10
 
11
11
  =end
12
12
 
@@ -10122,6 +10122,73 @@ module XeroRuby
10122
10122
  return data, status_code, headers
10123
10123
  end
10124
10124
 
10125
+ # Allows you to retrieve purchase orders as PDF files
10126
+ # @param xero_tenant_id [String] Xero identifier for Tenant
10127
+ # @param purchase_order_id [String] Unique identifier for an Purchase Order
10128
+ # @param [Hash] opts the optional parameters
10129
+ # @return [File]
10130
+ def get_purchase_order_as_pdf(xero_tenant_id, purchase_order_id, opts = {})
10131
+ data, _status_code, _headers = get_purchase_order_as_pdf_with_http_info(xero_tenant_id, purchase_order_id, opts)
10132
+ data
10133
+ end
10134
+
10135
+ # Allows you to retrieve purchase orders as PDF files
10136
+ # @param xero_tenant_id [String] Xero identifier for Tenant
10137
+ # @param purchase_order_id [String] Unique identifier for an Purchase Order
10138
+ # @param [Hash] opts the optional parameters
10139
+ # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
10140
+ def get_purchase_order_as_pdf_with_http_info(xero_tenant_id, purchase_order_id, opts = {})
10141
+ if @api_client.config.debugging
10142
+ @api_client.config.logger.debug 'Calling API: AccountingApi.get_purchase_order_as_pdf ...'
10143
+ end
10144
+ # verify the required parameter 'xero_tenant_id' is set
10145
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
10146
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling AccountingApi.get_purchase_order_as_pdf"
10147
+ end
10148
+ # verify the required parameter 'purchase_order_id' is set
10149
+ if @api_client.config.client_side_validation && purchase_order_id.nil?
10150
+ fail ArgumentError, "Missing the required parameter 'purchase_order_id' when calling AccountingApi.get_purchase_order_as_pdf"
10151
+ end
10152
+ # resource path
10153
+ local_var_path = '/PurchaseOrders/{PurchaseOrderID}'.sub('{' + 'PurchaseOrderID' + '}', purchase_order_id.to_s)
10154
+
10155
+ # query parameters
10156
+ query_params = opts[:query_params] || {}
10157
+
10158
+ # header parameters
10159
+ header_params = opts[:header_params] || {}
10160
+ # HTTP header 'Accept' (if needed)
10161
+ header_params['Accept'] = @api_client.select_header_accept(['application/pdf'])
10162
+ header_params[:'xero-tenant-id'] = xero_tenant_id
10163
+
10164
+ # form parameters
10165
+ form_params = opts[:form_params] || {}
10166
+
10167
+ # http body (model)
10168
+ post_body = opts[:body]
10169
+
10170
+ # return_type
10171
+ return_type = opts[:return_type] || 'File'
10172
+
10173
+ # auth_names
10174
+ auth_names = opts[:auth_names] || ['OAuth2']
10175
+
10176
+ new_options = opts.merge(
10177
+ :header_params => header_params,
10178
+ :query_params => query_params,
10179
+ :form_params => form_params,
10180
+ :body => post_body,
10181
+ :auth_names => auth_names,
10182
+ :return_type => return_type
10183
+ )
10184
+
10185
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
10186
+ if @api_client.config.debugging
10187
+ @api_client.config.logger.debug "API called: AccountingApi#get_purchase_order_as_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
10188
+ end
10189
+ return data, status_code, headers
10190
+ end
10191
+
10125
10192
  # Allows you to retrieve a specified purchase orders
10126
10193
  # @param xero_tenant_id [String] Xero identifier for Tenant
10127
10194
  # @param purchase_order_number [String] Unique identifier for a PurchaseOrder
@@ -3,10 +3,10 @@
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.0.7
6
+ The version of the OpenAPI document: 2.0.9
7
7
  Contact: api@xero.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.3.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'json'
15
15
  require 'logger'
16
16
  require 'tempfile'
17
- require 'typhoeus'
17
+ require 'faraday'
18
18
 
19
19
  module XeroRuby
20
20
  class ApiClient
@@ -28,7 +28,11 @@ module XeroRuby
28
28
 
29
29
  # Initializes the ApiClient
30
30
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
31
- def initialize(config = Configuration.default)
31
+ def initialize(config: Configuration.default, credentials: {})
32
+ @client_id = credentials[:client_id]
33
+ @client_secret = credentials[:client_secret]
34
+ @redirect_uri = credentials[:redirect_uri]
35
+ @scopes = credentials[:scopes]
32
36
  @config = config
33
37
  @user_agent = "xero-ruby-#{VERSION}"
34
38
  @default_headers = {
@@ -37,8 +41,79 @@ module XeroRuby
37
41
  }
38
42
  end
39
43
 
40
- def self.default
41
- @@default ||= ApiClient.new
44
+ def authorization_url
45
+ url = "#{@config.login_url}?response_type=code&client_id=#{@client_id}&redirect_uri=#{@redirect_uri}&scope=#{@scopes}"
46
+ return url
47
+ end
48
+
49
+ def accounting_client
50
+ XeroRuby::AccountingApi.new(self)
51
+ end
52
+
53
+ # Token Helpers
54
+ def token_set
55
+ XeroRuby.configure.token_set
56
+ end
57
+
58
+ def access_token
59
+ XeroRuby.configure.access_token
60
+ end
61
+
62
+ def set_token_set(token_set)
63
+ # helper to set the token_set on a client once the user has y
64
+ # has a valid token set ( access_token & refresh_token )
65
+ XeroRuby.configure.token_set = token_set
66
+ set_access_token(token_set['access_token'])
67
+ end
68
+
69
+ def set_access_token(access_token)
70
+ XeroRuby.configure.access_token = access_token
71
+ end
72
+
73
+ def get_token_set_from_callback(params)
74
+ data = {
75
+ grant_type: 'authorization_code',
76
+ code: params['code'],
77
+ redirect_uri: @redirect_uri
78
+ }
79
+ return token_request(data)
80
+ end
81
+
82
+ def refresh_token_set(token_set)
83
+ data = {
84
+ grant_type: 'refresh_token',
85
+ refresh_token: token_set['refresh_token']
86
+ }
87
+ return token_request(data)
88
+ end
89
+
90
+ def token_request(data)
91
+ response = Faraday.post(@config.token_url) do |req|
92
+ req.headers['Authorization'] = "Basic " + Base64.strict_encode64("#{@client_id}:#{@client_secret}")
93
+ req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
94
+ req.body = URI.encode_www_form(data)
95
+ end
96
+ body = JSON.parse(response.body)
97
+ set_token_set(body)
98
+ return body
99
+ end
100
+
101
+ # Connection heplers
102
+ def connections
103
+ response = Faraday.get('https://api.xero.com/connections') do |req|
104
+ req.headers['Authorization'] = "Bearer #{access_token}"
105
+ req.headers['Content-Type'] = 'application/json'
106
+ end
107
+ body = JSON.parse(response.body)
108
+ return body
109
+ end
110
+
111
+ def disconnect(connection_id)
112
+ Faraday.delete("https://api.xero.com/connections/#{connection_id}") do |req|
113
+ req.headers['Authorization'] = "Bearer #{access_token}"
114
+ req.headers['Content-Type'] = 'application/json'
115
+ end
116
+ return connections
42
117
  end
43
118
 
44
119
  # Call an API with given options.
@@ -46,26 +121,46 @@ module XeroRuby
46
121
  # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
47
122
  # the data deserialized from response body (could be nil), response status code and response headers.
48
123
  def call_api(http_method, path, opts = {})
49
- request = build_request(http_method, path, opts)
50
- response = request.run
124
+ ssl_options = {
125
+ :ca_file => @config.ssl_ca_file,
126
+ :verify => @config.ssl_verify,
127
+ :verify_mode => @config.ssl_verify_mode,
128
+ :client_cert => @config.ssl_client_cert,
129
+ :client_key => @config.ssl_client_key
130
+ }
51
131
 
52
- if @config.debugging
53
- @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
132
+ connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn|
133
+ conn.basic_auth(config.username, config.password)
134
+ if opts[:header_params]["Content-Type"] == "multipart/form-data"
135
+ conn.request :multipart
136
+ conn.request :url_encoded
137
+ end
138
+ conn.adapter(Faraday.default_adapter)
54
139
  end
55
140
 
56
- unless response.success?
57
- if response.timed_out?
58
- fail ApiError.new('Connection timed out')
59
- elsif response.code == 0
60
- # Errors from libcurl will be made visible here
61
- fail ApiError.new(:code => 0,
62
- :message => response.return_message)
63
- else
64
- fail ApiError.new(:code => response.code,
65
- :response_headers => response.headers,
66
- :response_body => response.body),
67
- response.status_message
141
+ begin
142
+ response = connection.public_send(http_method.to_sym.downcase) do |req|
143
+ build_request(http_method, path, req, opts)
68
144
  end
145
+
146
+ if @config.debugging
147
+ @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
148
+ end
149
+
150
+ unless response.success?
151
+ if response.status == 0
152
+ # Errors from libcurl will be made visible here
153
+ fail ApiError.new(:code => 0,
154
+ :message => response.return_message)
155
+ else
156
+ fail ApiError.new(:code => response.status,
157
+ :response_headers => response.headers,
158
+ :response_body => response.body),
159
+ response.reason_phrase
160
+ end
161
+ end
162
+ rescue Faraday::TimeoutError
163
+ fail ApiError.new('Connection timed out')
69
164
  end
70
165
 
71
166
  if opts[:return_type]
@@ -73,7 +168,7 @@ module XeroRuby
73
168
  else
74
169
  data = nil
75
170
  end
76
- return data, response.code, response.headers
171
+ return data, response.status, response.headers
77
172
  end
78
173
 
79
174
  # Builds the HTTP request
@@ -85,7 +180,7 @@ module XeroRuby
85
180
  # @option opts [Hash] :form_params Query parameters
86
181
  # @option opts [Object] :body HTTP body (JSON/XML)
87
182
  # @return [Typhoeus::Request] A Typhoeus Request
88
- def build_request(http_method, path, opts = {})
183
+ def build_request(http_method, path, request, opts = {})
89
184
  url = build_request_url(path)
90
185
  http_method = http_method.to_sym.downcase
91
186
 
@@ -95,25 +190,15 @@ module XeroRuby
95
190
 
96
191
  update_params_for_auth! header_params, query_params, opts[:auth_names]
97
192
 
98
- # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
99
- _verify_ssl_host = @config.verify_ssl_host ? 2 : 0
100
-
101
193
  req_opts = {
102
194
  :method => http_method,
103
195
  :headers => header_params,
104
196
  :params => query_params,
105
197
  :params_encoding => @config.params_encoding,
106
198
  :timeout => @config.timeout,
107
- :ssl_verifypeer => @config.verify_ssl,
108
- :ssl_verifyhost => _verify_ssl_host,
109
- :sslcert => @config.cert_file,
110
- :sslkey => @config.key_file,
111
199
  :verbose => @config.debugging
112
200
  }
113
201
 
114
- # set custom cert, if provided
115
- req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
116
-
117
202
  if [:post, :patch, :put, :delete].include?(http_method)
118
203
  req_body = build_request_body(header_params, form_params, opts[:body])
119
204
  req_opts.update :body => req_body
@@ -121,8 +206,10 @@ module XeroRuby
121
206
  @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
122
207
  end
123
208
  end
124
-
125
- request = Typhoeus::Request.new(url, req_opts)
209
+ request.headers = header_params
210
+ request.body = req_body
211
+ request.url url
212
+ request.params = query_params
126
213
  download_file(request) if opts[:return_type] == 'File'
127
214
  request
128
215
  end
@@ -135,13 +222,17 @@ module XeroRuby
135
222
  # @return [String] HTTP body data in the form of string
136
223
  def build_request_body(header_params, form_params, body)
137
224
  # http form
138
- if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
139
- header_params['Content-Type'] == 'multipart/form-data'
225
+ if header_params['Content-Type'] == 'application/x-www-form-urlencoded'
226
+ data = URI.encode_www_form(form_params)
227
+ elsif header_params['Content-Type'] == 'multipart/form-data'
140
228
  data = {}
141
229
  form_params.each do |key, value|
142
230
  case value
143
- when ::File, ::Array, nil
144
- # let typhoeus handle File, Array and nil parameters
231
+ when ::File, ::Tempfile
232
+ # TODO hardcode to application/octet-stream, need better way to detect content type
233
+ data[key] = Faraday::UploadIO.new(value.path, 'application/octet-stream', value.path)
234
+ when ::Array, nil
235
+ # let Faraday handle Array and nil parameters
145
236
  data[key] = value
146
237
  else
147
238
  data[key] = value.to_s
@@ -3,10 +3,10 @@
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.0.7
6
+ The version of the OpenAPI document: 2.0.9
7
7
  Contact: api@xero.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.3.0
10
10
 
11
11
  =end
12
12
 
@@ -3,10 +3,10 @@
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.0.7
6
+ The version of the OpenAPI document: 2.0.9
7
7
  Contact: api@xero.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.3.0
10
10
 
11
11
  =end
12
12
 
@@ -21,6 +21,10 @@ module XeroRuby
21
21
  # Defines url base path
22
22
  attr_accessor :base_path
23
23
 
24
+ # Defines url for identity routes
25
+ attr_accessor :login_url
26
+ attr_accessor :token_url
27
+
24
28
  # Defines API keys used with API Key authentications.
25
29
  #
26
30
  # @return [Hash] key: parameter name, value: parameter value (API key)
@@ -50,6 +54,9 @@ module XeroRuby
50
54
  # Defines the access token (Bearer) used with OAuth2.
51
55
  attr_accessor :access_token
52
56
 
57
+ # Defines the token set used with OAuth2. May include id/access/refresh token & other meta info.
58
+ attr_accessor :token_set
59
+
53
60
  # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
54
61
  # details will be logged with `logger.debug` (see the `logger` attribute).
55
62
  # Default to false.
@@ -86,33 +93,28 @@ module XeroRuby
86
93
  # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
87
94
  #
88
95
  # @return [true, false]
89
- attr_accessor :verify_ssl
96
+ attr_accessor :ssl_verify
90
97
 
91
98
  ### TLS/SSL setting
92
- # Set this to false to skip verifying SSL host name
93
- # Default to true.
99
+ # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
94
100
  #
95
101
  # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
96
102
  #
97
- # @return [true, false]
98
- attr_accessor :verify_ssl_host
103
+ attr_accessor :ssl_verify_mode
99
104
 
100
105
  ### TLS/SSL setting
101
106
  # Set this to customize the certificate file to verify the peer.
102
107
  #
103
108
  # @return [String] the path to the certificate file
104
- #
105
- # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
106
- # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
107
- attr_accessor :ssl_ca_cert
109
+ attr_accessor :ssl_ca_file
108
110
 
109
111
  ### TLS/SSL setting
110
112
  # Client certificate file (for client certificate)
111
- attr_accessor :cert_file
113
+ attr_accessor :ssl_client_cert
112
114
 
113
115
  ### TLS/SSL setting
114
116
  # Client private key file (for client certificate)
115
- attr_accessor :key_file
117
+ attr_accessor :ssl_client_key
116
118
 
117
119
  # Set this to customize parameters encoding of array parameter with multi collectionFormat.
118
120
  # Default to nil.
@@ -129,15 +131,17 @@ module XeroRuby
129
131
  @scheme = 'https'
130
132
  @host = 'api.xero.com'
131
133
  @base_path = '/api.xro/2.0'
134
+ @login_url = 'https://login.xero.com/identity/connect/authorize'
135
+ @token_url = 'https://identity.xero.com/connect/token'
132
136
  @api_key = {}
133
137
  @api_key_prefix = {}
134
138
  @timeout = 0
135
139
  @client_side_validation = true
136
- @verify_ssl = true
137
- @verify_ssl_host = true
138
- @params_encoding = nil
139
- @cert_file = nil
140
- @key_file = nil
140
+ @ssl_verify = true
141
+ @ssl_verify_mode = nil
142
+ @ssl_ca_file = nil
143
+ @ssl_client_cert = nil
144
+ @ssl_client_key = nil
141
145
  @debugging = false
142
146
  @inject_format = false
143
147
  @force_ending_format = false
@@ -3,10 +3,10 @@
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.0.7
6
+ The version of the OpenAPI document: 2.0.9
7
7
  Contact: api@xero.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.3.0
10
10
 
11
11
  =end
12
12
 
@@ -3,10 +3,10 @@
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.0.7
6
+ The version of the OpenAPI document: 2.0.9
7
7
  Contact: api@xero.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.3.0
10
10
 
11
11
  =end
12
12
 
@@ -3,10 +3,10 @@
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.0.7
6
+ The version of the OpenAPI document: 2.0.9
7
7
  Contact: api@xero.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.3.0
10
10
 
11
11
  =end
12
12
 
@@ -3,10 +3,10 @@
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.0.7
6
+ The version of the OpenAPI document: 2.0.9
7
7
  Contact: api@xero.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.3.0
10
10
 
11
11
  =end
12
12
 
@@ -3,10 +3,10 @@
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.0.7
6
+ The version of the OpenAPI document: 2.0.9
7
7
  Contact: api@xero.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.3.0
10
10
 
11
11
  =end
12
12
 
@@ -3,10 +3,10 @@
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.0.7
6
+ The version of the OpenAPI document: 2.0.9
7
7
  Contact: api@xero.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.3.0
10
10
 
11
11
  =end
12
12