xero-ruby 0.1.2 → 0.2.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 (269) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +44 -35
  3. data/docs/Account.md +3 -1
  4. data/docs/AccountingApi.md +2667 -2323
  5. data/docs/Attachment.md +2 -2
  6. data/docs/BankTransaction.md +3 -3
  7. data/docs/BrandingTheme.md +4 -0
  8. data/docs/Contact.md +3 -1
  9. data/docs/CreditNote.md +2 -0
  10. data/docs/Element.md +15 -1
  11. data/docs/Employee.md +5 -1
  12. data/docs/Invoice.md +6 -4
  13. data/docs/Item.md +3 -1
  14. data/docs/LineItem.md +4 -4
  15. data/docs/LineItemTracking.md +3 -1
  16. data/docs/LinkedTransaction.md +2 -2
  17. data/docs/ManualJournal.md +3 -1
  18. data/docs/Prepayment.md +2 -0
  19. data/docs/PurchaseOrder.md +3 -3
  20. data/docs/Quote.md +59 -0
  21. data/docs/QuoteLineAmountTypes.md +16 -0
  22. data/docs/QuoteStatusCodes.md +16 -0
  23. data/docs/Quotes.md +17 -0
  24. data/docs/Receipt.md +6 -4
  25. data/docs/ReportWithRow.md +2 -2
  26. data/docs/TaxRate.md +1 -1
  27. data/git_push.sh +1 -1
  28. data/lib/.DS_Store +0 -0
  29. data/lib/xero-ruby/api/accounting_api.rb +1741 -1334
  30. data/lib/xero-ruby/api_client.rb +2 -2
  31. data/lib/xero-ruby/api_error.rb +2 -2
  32. data/lib/xero-ruby/configuration.rb +3 -7
  33. data/lib/xero-ruby/models/account.rb +15 -5
  34. data/lib/xero-ruby/models/account_type.rb +2 -2
  35. data/lib/xero-ruby/models/accounts.rb +2 -2
  36. data/lib/xero-ruby/models/accounts_payable.rb +2 -2
  37. data/lib/xero-ruby/models/accounts_receivable.rb +2 -2
  38. data/lib/xero-ruby/models/address.rb +2 -2
  39. data/lib/xero-ruby/models/allocation.rb +2 -2
  40. data/lib/xero-ruby/models/allocations.rb +2 -2
  41. data/lib/xero-ruby/models/attachment.rb +2 -2
  42. data/lib/xero-ruby/models/attachments.rb +2 -2
  43. data/lib/xero-ruby/models/balances.rb +2 -2
  44. data/lib/xero-ruby/models/bank_transaction.rb +2 -2
  45. data/lib/xero-ruby/models/bank_transactions.rb +2 -2
  46. data/lib/xero-ruby/models/bank_transfer.rb +2 -2
  47. data/lib/xero-ruby/models/bank_transfers.rb +2 -2
  48. data/lib/xero-ruby/models/batch_payment.rb +48 -2
  49. data/lib/xero-ruby/models/batch_payment_details.rb +2 -2
  50. data/lib/xero-ruby/models/batch_payments.rb +2 -2
  51. data/lib/xero-ruby/models/bill.rb +2 -2
  52. data/lib/xero-ruby/models/branding_theme.rb +57 -3
  53. data/lib/xero-ruby/models/branding_themes.rb +2 -2
  54. data/lib/xero-ruby/models/cis_org_setting.rb +2 -2
  55. data/lib/xero-ruby/models/cis_setting.rb +2 -2
  56. data/lib/xero-ruby/models/cis_settings.rb +2 -2
  57. data/lib/xero-ruby/models/contact.rb +16 -6
  58. data/lib/xero-ruby/models/contact_group.rb +2 -2
  59. data/lib/xero-ruby/models/contact_groups.rb +2 -2
  60. data/lib/xero-ruby/models/contact_person.rb +2 -2
  61. data/lib/xero-ruby/models/contacts.rb +2 -2
  62. data/lib/xero-ruby/models/country_code.rb +2 -2
  63. data/lib/xero-ruby/models/credit_note.rb +13 -3
  64. data/lib/xero-ruby/models/credit_notes.rb +2 -2
  65. data/lib/xero-ruby/models/currencies.rb +2 -2
  66. data/lib/xero-ruby/models/currency.rb +2 -2
  67. data/lib/xero-ruby/models/currency_code.rb +2 -2
  68. data/lib/xero-ruby/models/element.rb +70 -6
  69. data/lib/xero-ruby/models/employee.rb +28 -6
  70. data/lib/xero-ruby/models/employees.rb +2 -2
  71. data/lib/xero-ruby/models/error.rb +2 -2
  72. data/lib/xero-ruby/models/expense_claim.rb +4 -4
  73. data/lib/xero-ruby/models/expense_claims.rb +2 -2
  74. data/lib/xero-ruby/models/external_link.rb +2 -2
  75. data/lib/xero-ruby/models/history_record.rb +2 -2
  76. data/lib/xero-ruby/models/history_records.rb +2 -2
  77. data/lib/xero-ruby/models/invoice.rb +20 -23
  78. data/lib/xero-ruby/models/invoice_reminder.rb +2 -2
  79. data/lib/xero-ruby/models/invoice_reminders.rb +2 -2
  80. data/lib/xero-ruby/models/invoices.rb +2 -2
  81. data/lib/xero-ruby/models/item.rb +13 -8
  82. data/lib/xero-ruby/models/items.rb +2 -2
  83. data/lib/xero-ruby/models/journal.rb +2 -2
  84. data/lib/xero-ruby/models/journal_line.rb +2 -2
  85. data/lib/xero-ruby/models/journals.rb +2 -2
  86. data/lib/xero-ruby/models/line_amount_types.rb +2 -2
  87. data/lib/xero-ruby/models/line_item.rb +4 -4
  88. data/lib/xero-ruby/models/line_item_tracking.rb +13 -3
  89. data/lib/xero-ruby/models/linked_transaction.rb +3 -8
  90. data/lib/xero-ruby/models/linked_transactions.rb +2 -2
  91. data/lib/xero-ruby/models/manual_journal.rb +15 -10
  92. data/lib/xero-ruby/models/manual_journal_line.rb +2 -2
  93. data/lib/xero-ruby/models/manual_journals.rb +2 -2
  94. data/lib/xero-ruby/models/online_invoice.rb +2 -2
  95. data/lib/xero-ruby/models/online_invoices.rb +2 -2
  96. data/lib/xero-ruby/models/organisation.rb +8 -8
  97. data/lib/xero-ruby/models/organisations.rb +2 -2
  98. data/lib/xero-ruby/models/overpayment.rb +2 -2
  99. data/lib/xero-ruby/models/overpayments.rb +2 -2
  100. data/lib/xero-ruby/models/payment.rb +2 -2
  101. data/lib/xero-ruby/models/payment_service.rb +2 -2
  102. data/lib/xero-ruby/models/payment_services.rb +2 -2
  103. data/lib/xero-ruby/models/payment_term.rb +2 -2
  104. data/lib/xero-ruby/models/payment_term_type.rb +2 -2
  105. data/lib/xero-ruby/models/payments.rb +2 -2
  106. data/lib/xero-ruby/models/phone.rb +2 -2
  107. data/lib/xero-ruby/models/prepayment.rb +13 -3
  108. data/lib/xero-ruby/models/prepayments.rb +2 -2
  109. data/lib/xero-ruby/models/purchase.rb +2 -2
  110. data/lib/xero-ruby/models/purchase_order.rb +3 -13
  111. data/lib/xero-ruby/models/purchase_orders.rb +2 -2
  112. data/lib/xero-ruby/models/quote.rb +487 -0
  113. data/lib/xero-ruby/models/quote_line_amount_types.rb +38 -0
  114. data/lib/xero-ruby/models/quote_status_codes.rb +40 -0
  115. data/lib/xero-ruby/models/quotes.rb +205 -0
  116. data/lib/xero-ruby/models/receipt.rb +17 -25
  117. data/lib/xero-ruby/models/receipts.rb +2 -2
  118. data/lib/xero-ruby/models/repeating_invoice.rb +4 -4
  119. data/lib/xero-ruby/models/repeating_invoices.rb +2 -2
  120. data/lib/xero-ruby/models/report.rb +2 -2
  121. data/lib/xero-ruby/models/report_attribute.rb +2 -2
  122. data/lib/xero-ruby/models/report_cell.rb +2 -2
  123. data/lib/xero-ruby/models/report_fields.rb +2 -2
  124. data/lib/xero-ruby/models/report_row.rb +2 -2
  125. data/lib/xero-ruby/models/report_rows.rb +2 -2
  126. data/lib/xero-ruby/models/report_with_row.rb +12 -12
  127. data/lib/xero-ruby/models/report_with_rows.rb +2 -2
  128. data/lib/xero-ruby/models/reports.rb +2 -2
  129. data/lib/xero-ruby/models/request_empty.rb +2 -2
  130. data/lib/xero-ruby/models/row_type.rb +2 -2
  131. data/lib/xero-ruby/models/sales_tracking_category.rb +2 -2
  132. data/lib/xero-ruby/models/schedule.rb +2 -2
  133. data/lib/xero-ruby/models/tax_component.rb +2 -2
  134. data/lib/xero-ruby/models/tax_rate.rb +6 -11
  135. data/lib/xero-ruby/models/tax_rates.rb +2 -2
  136. data/lib/xero-ruby/models/tax_type.rb +5 -2
  137. data/lib/xero-ruby/models/ten_nintey_nine_contact.rb +2 -2
  138. data/lib/xero-ruby/models/time_zone.rb +2 -2
  139. data/lib/xero-ruby/models/tracking_categories.rb +2 -2
  140. data/lib/xero-ruby/models/tracking_category.rb +2 -2
  141. data/lib/xero-ruby/models/tracking_option.rb +2 -2
  142. data/lib/xero-ruby/models/tracking_options.rb +2 -2
  143. data/lib/xero-ruby/models/user.rb +2 -2
  144. data/lib/xero-ruby/models/users.rb +2 -2
  145. data/lib/xero-ruby/models/validation_error.rb +2 -2
  146. data/lib/xero-ruby/version.rb +3 -3
  147. data/lib/xero-ruby.rb +6 -2
  148. data/pkg/xero-ruby-0.2.0.gem +0 -0
  149. data/spec/api/accounting_api_spec.rb +304 -209
  150. data/spec/api_client_spec.rb +2 -2
  151. data/spec/configuration_spec.rb +2 -2
  152. data/spec/models/account_spec.rb +9 -3
  153. data/spec/models/account_type_spec.rb +2 -2
  154. data/spec/models/accounts_payable_spec.rb +2 -2
  155. data/spec/models/accounts_receivable_spec.rb +2 -2
  156. data/spec/models/accounts_spec.rb +2 -2
  157. data/spec/models/address_spec.rb +2 -2
  158. data/spec/models/allocation_spec.rb +2 -2
  159. data/spec/models/allocations_spec.rb +2 -2
  160. data/spec/models/attachment_spec.rb +2 -2
  161. data/spec/models/attachments_spec.rb +2 -2
  162. data/spec/models/balances_spec.rb +2 -2
  163. data/spec/models/bank_transaction_spec.rb +2 -2
  164. data/spec/models/bank_transactions_spec.rb +2 -2
  165. data/spec/models/bank_transfer_spec.rb +2 -2
  166. data/spec/models/bank_transfers_spec.rb +2 -2
  167. data/spec/models/batch_payment_details_spec.rb +2 -2
  168. data/spec/models/batch_payment_spec.rb +10 -2
  169. data/spec/models/batch_payments_spec.rb +2 -2
  170. data/spec/models/bill_spec.rb +2 -2
  171. data/spec/models/branding_theme_spec.rb +18 -2
  172. data/spec/models/branding_themes_spec.rb +2 -2
  173. data/spec/models/cis_org_setting_spec.rb +2 -2
  174. data/spec/models/cis_setting_spec.rb +2 -2
  175. data/spec/models/cis_settings_spec.rb +2 -2
  176. data/spec/models/contact_group_spec.rb +2 -2
  177. data/spec/models/contact_groups_spec.rb +2 -2
  178. data/spec/models/contact_person_spec.rb +2 -2
  179. data/spec/models/contact_spec.rb +8 -2
  180. data/spec/models/contacts_spec.rb +2 -2
  181. data/spec/models/country_code_spec.rb +2 -2
  182. data/spec/models/credit_note_spec.rb +8 -2
  183. data/spec/models/credit_notes_spec.rb +2 -2
  184. data/spec/models/currencies_spec.rb +2 -2
  185. data/spec/models/currency_code_spec.rb +2 -2
  186. data/spec/models/currency_spec.rb +2 -2
  187. data/spec/models/element_spec.rb +44 -2
  188. data/spec/models/employee_spec.rb +14 -2
  189. data/spec/models/employees_spec.rb +2 -2
  190. data/spec/models/error_spec.rb +2 -2
  191. data/spec/models/expense_claim_spec.rb +3 -3
  192. data/spec/models/expense_claims_spec.rb +2 -2
  193. data/spec/models/external_link_spec.rb +2 -2
  194. data/spec/models/history_record_spec.rb +2 -2
  195. data/spec/models/history_records_spec.rb +2 -2
  196. data/spec/models/invoice_reminder_spec.rb +2 -2
  197. data/spec/models/invoice_reminders_spec.rb +2 -2
  198. data/spec/models/invoice_spec.rb +9 -3
  199. data/spec/models/invoices_spec.rb +2 -2
  200. data/spec/models/item_spec.rb +8 -2
  201. data/spec/models/items_spec.rb +2 -2
  202. data/spec/models/journal_line_spec.rb +2 -2
  203. data/spec/models/journal_spec.rb +2 -2
  204. data/spec/models/journals_spec.rb +2 -2
  205. data/spec/models/line_amount_types_spec.rb +2 -2
  206. data/spec/models/line_item_spec.rb +2 -2
  207. data/spec/models/line_item_tracking_spec.rb +8 -2
  208. data/spec/models/linked_transaction_spec.rb +2 -2
  209. data/spec/models/linked_transactions_spec.rb +2 -2
  210. data/spec/models/manual_journal_line_spec.rb +2 -2
  211. data/spec/models/manual_journal_spec.rb +9 -3
  212. data/spec/models/manual_journals_spec.rb +2 -2
  213. data/spec/models/online_invoice_spec.rb +2 -2
  214. data/spec/models/online_invoices_spec.rb +2 -2
  215. data/spec/models/organisation_spec.rb +5 -5
  216. data/spec/models/organisations_spec.rb +2 -2
  217. data/spec/models/overpayment_spec.rb +2 -2
  218. data/spec/models/overpayments_spec.rb +2 -2
  219. data/spec/models/payment_service_spec.rb +2 -2
  220. data/spec/models/payment_services_spec.rb +2 -2
  221. data/spec/models/payment_spec.rb +2 -2
  222. data/spec/models/payment_term_spec.rb +2 -2
  223. data/spec/models/payment_term_type_spec.rb +2 -2
  224. data/spec/models/payments_spec.rb +2 -2
  225. data/spec/models/phone_spec.rb +2 -2
  226. data/spec/models/prepayment_spec.rb +8 -2
  227. data/spec/models/prepayments_spec.rb +2 -2
  228. data/spec/models/purchase_order_spec.rb +2 -2
  229. data/spec/models/purchase_orders_spec.rb +2 -2
  230. data/spec/models/purchase_spec.rb +2 -2
  231. data/spec/models/quote_line_amount_types_spec.rb +35 -0
  232. data/spec/models/quote_spec.rb +167 -0
  233. data/spec/models/quote_status_codes_spec.rb +35 -0
  234. data/spec/models/quotes_spec.rb +41 -0
  235. data/spec/models/receipt_spec.rb +9 -3
  236. data/spec/models/receipts_spec.rb +2 -2
  237. data/spec/models/repeating_invoice_spec.rb +3 -3
  238. data/spec/models/repeating_invoices_spec.rb +2 -2
  239. data/spec/models/report_attribute_spec.rb +2 -2
  240. data/spec/models/report_cell_spec.rb +2 -2
  241. data/spec/models/report_fields_spec.rb +2 -2
  242. data/spec/models/report_row_spec.rb +2 -2
  243. data/spec/models/report_rows_spec.rb +2 -2
  244. data/spec/models/report_spec.rb +2 -2
  245. data/spec/models/report_with_row_spec.rb +4 -4
  246. data/spec/models/report_with_rows_spec.rb +2 -2
  247. data/spec/models/reports_spec.rb +2 -2
  248. data/spec/models/request_empty_spec.rb +2 -2
  249. data/spec/models/row_type_spec.rb +2 -2
  250. data/spec/models/sales_tracking_category_spec.rb +2 -2
  251. data/spec/models/schedule_spec.rb +2 -2
  252. data/spec/models/tax_component_spec.rb +2 -2
  253. data/spec/models/tax_rate_spec.rb +4 -4
  254. data/spec/models/tax_rates_spec.rb +2 -2
  255. data/spec/models/tax_type_spec.rb +2 -2
  256. data/spec/models/ten_nintey_nine_contact_spec.rb +2 -2
  257. data/spec/models/time_zone_spec.rb +2 -2
  258. data/spec/models/tracking_categories_spec.rb +2 -2
  259. data/spec/models/tracking_category_spec.rb +2 -2
  260. data/spec/models/tracking_option_spec.rb +2 -2
  261. data/spec/models/tracking_options_spec.rb +2 -2
  262. data/spec/models/user_spec.rb +2 -2
  263. data/spec/models/users_spec.rb +2 -2
  264. data/spec/models/validation_error_spec.rb +2 -2
  265. data/spec/spec_helper.rb +2 -2
  266. data/xero-ruby.gemspec +3 -3
  267. metadata +21 -5
  268. data/Gemfile.lock +0 -79
  269. data/pkg/xero-ruby-0.1.2.gem +0 -0
@@ -0,0 +1,487 @@
1
+ =begin
2
+ #Accounting API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.1
7
+ Contact: api@xero.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.0
10
+
11
+ =end
12
+
13
+ require 'time'
14
+ require 'date'
15
+
16
+ module XeroRuby
17
+ class Quote
18
+ # QuoteID GUID is automatically generated and is returned after create or GET.
19
+ attr_accessor :quote_id
20
+
21
+ # Unique alpha numeric code identifying a quote (Max Length = 255)
22
+ attr_accessor :quote_number
23
+
24
+ # Additional reference number
25
+ attr_accessor :reference
26
+
27
+ # Terms of the quote
28
+ attr_accessor :terms
29
+
30
+ attr_accessor :contact
31
+
32
+ # See LineItems
33
+ attr_accessor :line_items
34
+
35
+ # Date quote was issued – YYYY-MM-DD. If the Date element is not specified it will default to the current date based on the timezone setting of the organisation
36
+ attr_accessor :date
37
+
38
+ # Date the quote was issued (YYYY-MM-DD)
39
+ attr_accessor :date_string
40
+
41
+ # Date the quote expires – YYYY-MM-DD.
42
+ attr_accessor :expiry_date
43
+
44
+ # Date the quote expires – YYYY-MM-DD.
45
+ attr_accessor :expiry_date_string
46
+
47
+ attr_accessor :status
48
+
49
+ attr_accessor :currency_code
50
+
51
+ # The currency rate for a multicurrency quote
52
+ attr_accessor :currency_rate
53
+
54
+ # Total of quote excluding taxes.
55
+ attr_accessor :sub_total
56
+
57
+ # Total tax on quote
58
+ attr_accessor :total_tax
59
+
60
+ # Total of Quote tax inclusive (i.e. SubTotal + TotalTax). This will be ignored if it doesn’t equal the sum of the LineAmounts
61
+ attr_accessor :total
62
+
63
+ # Total of discounts applied on the quote line items
64
+ attr_accessor :total_discount
65
+
66
+ # Title text for the quote
67
+ attr_accessor :title
68
+
69
+ # Summary text for the quote
70
+ attr_accessor :summary
71
+
72
+ # See BrandingThemes
73
+ attr_accessor :branding_theme_id
74
+
75
+ # Last modified date UTC format
76
+ attr_accessor :updated_date_utc
77
+
78
+ attr_accessor :line_amount_types
79
+
80
+ # Attribute mapping from ruby-style variable name to JSON key.
81
+ def self.attribute_map
82
+ {
83
+ :'quote_id' => :'QuoteID',
84
+ :'quote_number' => :'QuoteNumber',
85
+ :'reference' => :'Reference',
86
+ :'terms' => :'Terms',
87
+ :'contact' => :'Contact',
88
+ :'line_items' => :'LineItems',
89
+ :'date' => :'Date',
90
+ :'date_string' => :'DateString',
91
+ :'expiry_date' => :'ExpiryDate',
92
+ :'expiry_date_string' => :'ExpiryDateString',
93
+ :'status' => :'Status',
94
+ :'currency_code' => :'CurrencyCode',
95
+ :'currency_rate' => :'CurrencyRate',
96
+ :'sub_total' => :'SubTotal',
97
+ :'total_tax' => :'TotalTax',
98
+ :'total' => :'Total',
99
+ :'total_discount' => :'TotalDiscount',
100
+ :'title' => :'Title',
101
+ :'summary' => :'Summary',
102
+ :'branding_theme_id' => :'BrandingThemeID',
103
+ :'updated_date_utc' => :'UpdatedDateUTC',
104
+ :'line_amount_types' => :'LineAmountTypes'
105
+ }
106
+ end
107
+
108
+ # Attribute type mapping.
109
+ def self.openapi_types
110
+ {
111
+ :'quote_id' => :'String',
112
+ :'quote_number' => :'String',
113
+ :'reference' => :'String',
114
+ :'terms' => :'String',
115
+ :'contact' => :'Contact',
116
+ :'line_items' => :'Array<LineItem>',
117
+ :'date' => :'Date',
118
+ :'date_string' => :'String',
119
+ :'expiry_date' => :'Date',
120
+ :'expiry_date_string' => :'String',
121
+ :'status' => :'QuoteStatusCodes',
122
+ :'currency_code' => :'CurrencyCode',
123
+ :'currency_rate' => :'Float',
124
+ :'sub_total' => :'Float',
125
+ :'total_tax' => :'Float',
126
+ :'total' => :'Float',
127
+ :'total_discount' => :'Float',
128
+ :'title' => :'String',
129
+ :'summary' => :'String',
130
+ :'branding_theme_id' => :'String',
131
+ :'updated_date_utc' => :'DateTime',
132
+ :'line_amount_types' => :'QuoteLineAmountTypes'
133
+ }
134
+ end
135
+
136
+ # Initializes the object
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ def initialize(attributes = {})
139
+ if (!attributes.is_a?(Hash))
140
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Quote` initialize method"
141
+ end
142
+
143
+ # check to see if the attribute exists and convert string to symbol for hash key
144
+ attributes = attributes.each_with_object({}) { |(k, v), h|
145
+ if (!self.class.attribute_map.key?(k.to_sym))
146
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Quote`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
147
+ end
148
+ h[k.to_sym] = v
149
+ }
150
+
151
+ if attributes.key?(:'quote_id')
152
+ self.quote_id = attributes[:'quote_id']
153
+ end
154
+
155
+ if attributes.key?(:'quote_number')
156
+ self.quote_number = attributes[:'quote_number']
157
+ end
158
+
159
+ if attributes.key?(:'reference')
160
+ self.reference = attributes[:'reference']
161
+ end
162
+
163
+ if attributes.key?(:'terms')
164
+ self.terms = attributes[:'terms']
165
+ end
166
+
167
+ if attributes.key?(:'contact')
168
+ self.contact = attributes[:'contact']
169
+ end
170
+
171
+ if attributes.key?(:'line_items')
172
+ if (value = attributes[:'line_items']).is_a?(Array)
173
+ self.line_items = value
174
+ end
175
+ end
176
+
177
+ if attributes.key?(:'date')
178
+ self.date = attributes[:'date']
179
+ end
180
+
181
+ if attributes.key?(:'date_string')
182
+ self.date_string = attributes[:'date_string']
183
+ end
184
+
185
+ if attributes.key?(:'expiry_date')
186
+ self.expiry_date = attributes[:'expiry_date']
187
+ end
188
+
189
+ if attributes.key?(:'expiry_date_string')
190
+ self.expiry_date_string = attributes[:'expiry_date_string']
191
+ end
192
+
193
+ if attributes.key?(:'status')
194
+ self.status = attributes[:'status']
195
+ end
196
+
197
+ if attributes.key?(:'currency_code')
198
+ self.currency_code = attributes[:'currency_code']
199
+ end
200
+
201
+ if attributes.key?(:'currency_rate')
202
+ self.currency_rate = attributes[:'currency_rate']
203
+ end
204
+
205
+ if attributes.key?(:'sub_total')
206
+ self.sub_total = attributes[:'sub_total']
207
+ end
208
+
209
+ if attributes.key?(:'total_tax')
210
+ self.total_tax = attributes[:'total_tax']
211
+ end
212
+
213
+ if attributes.key?(:'total')
214
+ self.total = attributes[:'total']
215
+ end
216
+
217
+ if attributes.key?(:'total_discount')
218
+ self.total_discount = attributes[:'total_discount']
219
+ end
220
+
221
+ if attributes.key?(:'title')
222
+ self.title = attributes[:'title']
223
+ end
224
+
225
+ if attributes.key?(:'summary')
226
+ self.summary = attributes[:'summary']
227
+ end
228
+
229
+ if attributes.key?(:'branding_theme_id')
230
+ self.branding_theme_id = attributes[:'branding_theme_id']
231
+ end
232
+
233
+ if attributes.key?(:'updated_date_utc')
234
+ self.updated_date_utc = attributes[:'updated_date_utc']
235
+ end
236
+
237
+ if attributes.key?(:'line_amount_types')
238
+ self.line_amount_types = attributes[:'line_amount_types']
239
+ end
240
+ end
241
+
242
+ # Show invalid properties with the reasons. Usually used together with valid?
243
+ # @return Array for valid properties with the reasons
244
+ def list_invalid_properties
245
+ invalid_properties = Array.new
246
+ if !@quote_number.nil? && @quote_number.to_s.length > 255
247
+ invalid_properties.push('invalid value for "quote_number", the character length must be smaller than or equal to 255.')
248
+ end
249
+
250
+ if !@reference.nil? && @reference.to_s.length > 4000
251
+ invalid_properties.push('invalid value for "reference", the character length must be smaller than or equal to 4000.')
252
+ end
253
+
254
+ if !@terms.nil? && @terms.to_s.length > 4000
255
+ invalid_properties.push('invalid value for "terms", the character length must be smaller than or equal to 4000.')
256
+ end
257
+
258
+ if !@title.nil? && @title.to_s.length > 100
259
+ invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 100.')
260
+ end
261
+
262
+ if !@summary.nil? && @summary.to_s.length > 3000
263
+ invalid_properties.push('invalid value for "summary", the character length must be smaller than or equal to 3000.')
264
+ end
265
+
266
+ invalid_properties
267
+ end
268
+
269
+ # Check to see if the all the properties in the model are valid
270
+ # @return true if the model is valid
271
+ def valid?
272
+ return false if !@quote_number.nil? && @quote_number.to_s.length > 255
273
+ return false if !@reference.nil? && @reference.to_s.length > 4000
274
+ return false if !@terms.nil? && @terms.to_s.length > 4000
275
+ return false if !@title.nil? && @title.to_s.length > 100
276
+ return false if !@summary.nil? && @summary.to_s.length > 3000
277
+ true
278
+ end
279
+
280
+ # Custom attribute writer method with validation
281
+ # @param [Object] quote_number Value to be assigned
282
+ def quote_number=(quote_number)
283
+ if !quote_number.nil? && quote_number.to_s.length > 255
284
+ fail ArgumentError, 'invalid value for "quote_number", the character length must be smaller than or equal to 255.'
285
+ end
286
+
287
+ @quote_number = quote_number
288
+ end
289
+
290
+ # Custom attribute writer method with validation
291
+ # @param [Object] reference Value to be assigned
292
+ def reference=(reference)
293
+ if !reference.nil? && reference.to_s.length > 4000
294
+ fail ArgumentError, 'invalid value for "reference", the character length must be smaller than or equal to 4000.'
295
+ end
296
+
297
+ @reference = reference
298
+ end
299
+
300
+ # Custom attribute writer method with validation
301
+ # @param [Object] terms Value to be assigned
302
+ def terms=(terms)
303
+ if !terms.nil? && terms.to_s.length > 4000
304
+ fail ArgumentError, 'invalid value for "terms", the character length must be smaller than or equal to 4000.'
305
+ end
306
+
307
+ @terms = terms
308
+ end
309
+
310
+ # Custom attribute writer method with validation
311
+ # @param [Object] title Value to be assigned
312
+ def title=(title)
313
+ if !title.nil? && title.to_s.length > 100
314
+ fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 100.'
315
+ end
316
+
317
+ @title = title
318
+ end
319
+
320
+ # Custom attribute writer method with validation
321
+ # @param [Object] summary Value to be assigned
322
+ def summary=(summary)
323
+ if !summary.nil? && summary.to_s.length > 3000
324
+ fail ArgumentError, 'invalid value for "summary", the character length must be smaller than or equal to 3000.'
325
+ end
326
+
327
+ @summary = summary
328
+ end
329
+
330
+ # Checks equality by comparing each attribute.
331
+ # @param [Object] Object to be compared
332
+ def ==(o)
333
+ return true if self.equal?(o)
334
+ self.class == o.class &&
335
+ quote_id == o.quote_id &&
336
+ quote_number == o.quote_number &&
337
+ reference == o.reference &&
338
+ terms == o.terms &&
339
+ contact == o.contact &&
340
+ line_items == o.line_items &&
341
+ date == o.date &&
342
+ date_string == o.date_string &&
343
+ expiry_date == o.expiry_date &&
344
+ expiry_date_string == o.expiry_date_string &&
345
+ status == o.status &&
346
+ currency_code == o.currency_code &&
347
+ currency_rate == o.currency_rate &&
348
+ sub_total == o.sub_total &&
349
+ total_tax == o.total_tax &&
350
+ total == o.total &&
351
+ total_discount == o.total_discount &&
352
+ title == o.title &&
353
+ summary == o.summary &&
354
+ branding_theme_id == o.branding_theme_id &&
355
+ updated_date_utc == o.updated_date_utc &&
356
+ line_amount_types == o.line_amount_types
357
+ end
358
+
359
+ # @see the `==` method
360
+ # @param [Object] Object to be compared
361
+ def eql?(o)
362
+ self == o
363
+ end
364
+
365
+ # Calculates hash code according to all attributes.
366
+ # @return [Integer] Hash code
367
+ def hash
368
+ [quote_id, quote_number, reference, terms, contact, line_items, date, date_string, expiry_date, expiry_date_string, status, currency_code, currency_rate, sub_total, total_tax, total, total_discount, title, summary, branding_theme_id, updated_date_utc, line_amount_types].hash
369
+ end
370
+
371
+ # Builds the object from hash
372
+ # @param [Hash] attributes Model attributes in the form of hash
373
+ # @return [Object] Returns the model itself
374
+ def self.build_from_hash(attributes)
375
+ new.build_from_hash(attributes)
376
+ end
377
+
378
+ # Builds the object from hash
379
+ # @param [Hash] attributes Model attributes in the form of hash
380
+ # @return [Object] Returns the model itself
381
+ def build_from_hash(attributes)
382
+ return nil unless attributes.is_a?(Hash)
383
+ self.class.openapi_types.each_pair do |key, type|
384
+ if type =~ /\AArray<(.*)>/i
385
+ # check to ensure the input is an array given that the attribute
386
+ # is documented as an array but the input is not
387
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
388
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
389
+ end
390
+ elsif !attributes[self.class.attribute_map[key]].nil?
391
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
392
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
393
+ end
394
+
395
+ self
396
+ end
397
+
398
+ # Deserializes the data based on type
399
+ # @param string type Data type
400
+ # @param string value Value to be deserialized
401
+ # @return [Object] Deserialized data
402
+ def _deserialize(type, value)
403
+ case type.to_sym
404
+ when :DateTime
405
+ DateTime.parse(parse_date(value))
406
+ when :Date
407
+ Date.parse(parse_date(value))
408
+ when :String
409
+ value.to_s
410
+ when :Integer
411
+ value.to_i
412
+ when :Float
413
+ value.to_f
414
+ when :Boolean
415
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
416
+ true
417
+ else
418
+ false
419
+ end
420
+ when :Object
421
+ # generic object (usually a Hash), return directly
422
+ value
423
+ when /\AArray<(?<inner_type>.+)>\z/
424
+ inner_type = Regexp.last_match[:inner_type]
425
+ value.map { |v| _deserialize(inner_type, v) }
426
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
427
+ k_type = Regexp.last_match[:k_type]
428
+ v_type = Regexp.last_match[:v_type]
429
+ {}.tap do |hash|
430
+ value.each do |k, v|
431
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
432
+ end
433
+ end
434
+ else # model
435
+ XeroRuby.const_get(type).build_from_hash(value)
436
+ end
437
+ end
438
+
439
+ # Returns the string representation of the object
440
+ # @return [String] String presentation of the object
441
+ def to_s
442
+ to_hash.to_s
443
+ end
444
+
445
+ # to_body is an alias to to_hash (backward compatibility)
446
+ # @return [Hash] Returns the object in the form of hash
447
+ def to_body
448
+ to_hash
449
+ end
450
+
451
+ # Returns the object in the form of hash
452
+ # @return [Hash] Returns the object in the form of hash
453
+ def to_hash
454
+ hash = {}
455
+ self.class.attribute_map.each_pair do |attr, param|
456
+ value = self.send(attr)
457
+ next if value.nil?
458
+ hash[param] = _to_hash(value)
459
+ end
460
+ hash
461
+ end
462
+
463
+ # Outputs non-array value in the form of hash
464
+ # For object, use to_hash. Otherwise, just return the value
465
+ # @param [Object] value Any valid value
466
+ # @return [Hash] Returns the value in the form of hash
467
+ def _to_hash(value)
468
+ if value.is_a?(Array)
469
+ value.compact.map { |v| _to_hash(v) }
470
+ elsif value.is_a?(Hash)
471
+ {}.tap do |hash|
472
+ value.each { |k, v| hash[k] = _to_hash(v) }
473
+ end
474
+ elsif value.respond_to? :to_hash
475
+ value.to_hash
476
+ else
477
+ value
478
+ end
479
+ end
480
+
481
+ # customized data_parser
482
+ def parse_date(datestring)
483
+ seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
484
+ return Time.at(seconds_since_epoch).to_s
485
+ end
486
+ end
487
+ end
@@ -0,0 +1,38 @@
1
+ =begin
2
+ #Accounting API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.1
7
+ Contact: api@xero.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.0
10
+
11
+ =end
12
+
13
+ require 'time'
14
+ require 'date'
15
+
16
+ module XeroRuby
17
+ class QuoteLineAmountTypes
18
+ EXCLUSIVE = "EXCLUSIVE".freeze
19
+ INCLUSIVE = "INCLUSIVE".freeze
20
+ NOTAX = "NOTAX".freeze
21
+
22
+ # Builds the enum from string
23
+ # @param [String] The enum value in the form of the string
24
+ # @return [String] The enum value
25
+ def self.build_from_hash(value)
26
+ new.build_from_hash(value)
27
+ end
28
+
29
+ # Builds the enum from string
30
+ # @param [String] The enum value in the form of the string
31
+ # @return [String] The enum value
32
+ def build_from_hash(value)
33
+ constantValues = QuoteLineAmountTypes.constants.select { |c| QuoteLineAmountTypes::const_get(c) == value }
34
+ raise "Invalid ENUM value #{value} for class #QuoteLineAmountTypes" if constantValues.empty?
35
+ value
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+ #Accounting API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.1
7
+ Contact: api@xero.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.0
10
+
11
+ =end
12
+
13
+ require 'time'
14
+ require 'date'
15
+
16
+ module XeroRuby
17
+ class QuoteStatusCodes
18
+ DRAFT = "DRAFT".freeze
19
+ SENT = "SENT".freeze
20
+ DECLINED = "DECLINED".freeze
21
+ ACCEPTED = "ACCEPTED".freeze
22
+ INVOICED = "INVOICED".freeze
23
+
24
+ # Builds the enum from string
25
+ # @param [String] The enum value in the form of the string
26
+ # @return [String] The enum value
27
+ def self.build_from_hash(value)
28
+ new.build_from_hash(value)
29
+ end
30
+
31
+ # Builds the enum from string
32
+ # @param [String] The enum value in the form of the string
33
+ # @return [String] The enum value
34
+ def build_from_hash(value)
35
+ constantValues = QuoteStatusCodes.constants.select { |c| QuoteStatusCodes::const_get(c) == value }
36
+ raise "Invalid ENUM value #{value} for class #QuoteStatusCodes" if constantValues.empty?
37
+ value
38
+ end
39
+ end
40
+ end