xero-ruby 1.1.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +181 -72
  3. data/build_notes.md +43 -0
  4. data/docs/accounting/AccountingApi.md +1503 -779
  5. data/docs/accounting/Allocation.md +11 -1
  6. data/docs/accounting/Attachment.md +1 -1
  7. data/docs/accounting/BankTransfer.md +1 -1
  8. data/docs/accounting/BatchPayment.md +1 -1
  9. data/docs/accounting/Contact.md +2 -2
  10. data/docs/accounting/CreditNote.md +2 -2
  11. data/docs/accounting/Invoice.md +2 -2
  12. data/docs/accounting/ManualJournalLine.md +2 -0
  13. data/docs/accounting/Organisation.md +3 -1
  14. data/docs/accounting/Payment.md +4 -4
  15. data/docs/accounting/Quote.md +5 -1
  16. data/docs/accounting/Report.md +1 -1
  17. data/docs/accounting/{TenNinteyNineContact.md → TenNinetyNineContact.md} +2 -2
  18. data/docs/assets/AssetApi.md +40 -16
  19. data/docs/assets/AssetType.md +1 -1
  20. data/docs/projects/Amount.md +19 -0
  21. data/docs/projects/ChargeType.md +16 -0
  22. data/docs/projects/CurrencyCode.md +16 -0
  23. data/docs/projects/Error.md +19 -0
  24. data/docs/projects/Pagination.md +23 -0
  25. data/docs/projects/Project.md +59 -0
  26. data/docs/projects/ProjectApi.md +979 -0
  27. data/docs/projects/ProjectCreateOrUpdate.md +23 -0
  28. data/docs/projects/ProjectPatch.md +17 -0
  29. data/docs/projects/ProjectStatus.md +16 -0
  30. data/docs/projects/ProjectUser.md +21 -0
  31. data/docs/projects/ProjectUsers.md +19 -0
  32. data/docs/projects/Projects.md +19 -0
  33. data/docs/projects/Task.md +45 -0
  34. data/docs/projects/TaskCreateOrUpdate.md +23 -0
  35. data/docs/projects/Tasks.md +19 -0
  36. data/docs/projects/TimeEntries.md +19 -0
  37. data/docs/projects/TimeEntry.md +33 -0
  38. data/docs/projects/TimeEntryCreateOrUpdate.md +25 -0
  39. data/lib/xero-ruby.rb +22 -3
  40. data/lib/xero-ruby/api/accounting_api.rb +1368 -72
  41. data/lib/xero-ruby/api/asset_api.rb +39 -3
  42. data/lib/xero-ruby/api/project_api.rb +1113 -0
  43. data/lib/xero-ruby/api_client.rb +104 -38
  44. data/lib/xero-ruby/api_error.rb +2 -2
  45. data/lib/xero-ruby/configuration.rb +4 -5
  46. data/lib/xero-ruby/models/accounting/account.rb +61 -20
  47. data/lib/xero-ruby/models/accounting/account_type.rb +2 -2
  48. data/lib/xero-ruby/models/accounting/accounts.rb +8 -3
  49. data/lib/xero-ruby/models/accounting/accounts_payable.rb +11 -5
  50. data/lib/xero-ruby/models/accounting/accounts_receivable.rb +11 -5
  51. data/lib/xero-ruby/models/accounting/address.rb +19 -12
  52. data/lib/xero-ruby/models/accounting/allocation.rb +66 -9
  53. data/lib/xero-ruby/models/accounting/allocations.rb +8 -3
  54. data/lib/xero-ruby/models/accounting/attachment.rb +13 -9
  55. data/lib/xero-ruby/models/accounting/attachments.rb +8 -3
  56. data/lib/xero-ruby/models/accounting/balances.rb +9 -3
  57. data/lib/xero-ruby/models/accounting/bank_transaction.rb +43 -24
  58. data/lib/xero-ruby/models/accounting/bank_transactions.rb +8 -3
  59. data/lib/xero-ruby/models/accounting/bank_transfer.rb +20 -14
  60. data/lib/xero-ruby/models/accounting/bank_transfers.rb +8 -3
  61. data/lib/xero-ruby/models/accounting/batch_payment.rb +29 -19
  62. data/lib/xero-ruby/models/accounting/batch_payment_details.rb +11 -7
  63. data/lib/xero-ruby/models/accounting/batch_payments.rb +8 -3
  64. data/lib/xero-ruby/models/accounting/bill.rb +8 -3
  65. data/lib/xero-ruby/models/accounting/branding_theme.rb +13 -8
  66. data/lib/xero-ruby/models/accounting/branding_themes.rb +8 -3
  67. data/lib/xero-ruby/models/accounting/cis_org_setting.rb +9 -5
  68. data/lib/xero-ruby/models/accounting/cis_setting.rb +8 -4
  69. data/lib/xero-ruby/models/accounting/cis_settings.rb +8 -3
  70. data/lib/xero-ruby/models/accounting/contact.rb +51 -37
  71. data/lib/xero-ruby/models/accounting/contact_group.rb +12 -6
  72. data/lib/xero-ruby/models/accounting/contact_groups.rb +8 -3
  73. data/lib/xero-ruby/models/accounting/contact_person.rb +10 -6
  74. data/lib/xero-ruby/models/accounting/contacts.rb +8 -3
  75. data/lib/xero-ruby/models/accounting/country_code.rb +2 -2
  76. data/lib/xero-ruby/models/accounting/credit_note.rb +47 -30
  77. data/lib/xero-ruby/models/accounting/credit_notes.rb +8 -3
  78. data/lib/xero-ruby/models/accounting/currencies.rb +8 -3
  79. data/lib/xero-ruby/models/accounting/currency.rb +9 -4
  80. data/lib/xero-ruby/models/accounting/currency_code.rb +2 -2
  81. data/lib/xero-ruby/models/accounting/element.rb +14 -4
  82. data/lib/xero-ruby/models/accounting/employee.rb +17 -8
  83. data/lib/xero-ruby/models/accounting/employees.rb +8 -3
  84. data/lib/xero-ruby/models/accounting/error.rb +10 -6
  85. data/lib/xero-ruby/models/accounting/expense_claim.rb +26 -15
  86. data/lib/xero-ruby/models/accounting/expense_claims.rb +8 -3
  87. data/lib/xero-ruby/models/accounting/external_link.rb +14 -4
  88. data/lib/xero-ruby/models/accounting/history_record.rb +10 -6
  89. data/lib/xero-ruby/models/accounting/history_records.rb +8 -3
  90. data/lib/xero-ruby/models/accounting/invoice.rb +69 -46
  91. data/lib/xero-ruby/models/accounting/invoice_reminder.rb +7 -3
  92. data/lib/xero-ruby/models/accounting/invoice_reminders.rb +8 -3
  93. data/lib/xero-ruby/models/accounting/invoices.rb +8 -3
  94. data/lib/xero-ruby/models/accounting/item.rb +24 -18
  95. data/lib/xero-ruby/models/accounting/items.rb +8 -3
  96. data/lib/xero-ruby/models/accounting/journal.rb +39 -10
  97. data/lib/xero-ruby/models/accounting/journal_line.rb +21 -16
  98. data/lib/xero-ruby/models/accounting/journals.rb +8 -3
  99. data/lib/xero-ruby/models/accounting/line_amount_types.rb +2 -2
  100. data/lib/xero-ruby/models/accounting/line_item.rb +25 -21
  101. data/lib/xero-ruby/models/accounting/line_item_tracking.rb +10 -6
  102. data/lib/xero-ruby/models/accounting/linked_transaction.rb +25 -13
  103. data/lib/xero-ruby/models/accounting/linked_transactions.rb +8 -3
  104. data/lib/xero-ruby/models/accounting/manual_journal.rb +25 -15
  105. data/lib/xero-ruby/models/accounting/manual_journal_line.rb +26 -12
  106. data/lib/xero-ruby/models/accounting/manual_journals.rb +8 -3
  107. data/lib/xero-ruby/models/accounting/online_invoice.rb +7 -3
  108. data/lib/xero-ruby/models/accounting/online_invoices.rb +8 -3
  109. data/lib/xero-ruby/models/accounting/organisation.rb +122 -32
  110. data/lib/xero-ruby/models/accounting/organisations.rb +8 -3
  111. data/lib/xero-ruby/models/accounting/overpayment.rb +36 -23
  112. data/lib/xero-ruby/models/accounting/overpayments.rb +8 -3
  113. data/lib/xero-ruby/models/accounting/payment.rb +47 -24
  114. data/lib/xero-ruby/models/accounting/payment_delete.rb +7 -3
  115. data/lib/xero-ruby/models/accounting/payment_service.rb +12 -8
  116. data/lib/xero-ruby/models/accounting/payment_services.rb +8 -3
  117. data/lib/xero-ruby/models/accounting/payment_term.rb +9 -3
  118. data/lib/xero-ruby/models/accounting/payment_term_type.rb +2 -2
  119. data/lib/xero-ruby/models/accounting/payments.rb +8 -3
  120. data/lib/xero-ruby/models/accounting/phone.rb +16 -6
  121. data/lib/xero-ruby/models/accounting/prepayment.rb +37 -23
  122. data/lib/xero-ruby/models/accounting/prepayments.rb +8 -3
  123. data/lib/xero-ruby/models/accounting/purchase.rb +11 -7
  124. data/lib/xero-ruby/models/accounting/purchase_order.rb +45 -33
  125. data/lib/xero-ruby/models/accounting/purchase_orders.rb +8 -3
  126. data/lib/xero-ruby/models/accounting/quote.rb +58 -28
  127. data/lib/xero-ruby/models/accounting/quote_line_amount_types.rb +2 -2
  128. data/lib/xero-ruby/models/accounting/quote_status_codes.rb +3 -2
  129. data/lib/xero-ruby/models/accounting/quotes.rb +8 -3
  130. data/lib/xero-ruby/models/accounting/receipt.rb +32 -19
  131. data/lib/xero-ruby/models/accounting/receipts.rb +8 -3
  132. data/lib/xero-ruby/models/accounting/repeating_invoice.rb +30 -17
  133. data/lib/xero-ruby/models/accounting/repeating_invoices.rb +8 -3
  134. data/lib/xero-ruby/models/accounting/report.rb +15 -9
  135. data/lib/xero-ruby/models/accounting/report_attribute.rb +9 -3
  136. data/lib/xero-ruby/models/accounting/report_cell.rb +9 -3
  137. data/lib/xero-ruby/models/accounting/report_fields.rb +10 -3
  138. data/lib/xero-ruby/models/accounting/report_row.rb +10 -3
  139. data/lib/xero-ruby/models/accounting/report_rows.rb +11 -3
  140. data/lib/xero-ruby/models/accounting/report_with_row.rb +15 -9
  141. data/lib/xero-ruby/models/accounting/report_with_rows.rb +8 -3
  142. data/lib/xero-ruby/models/accounting/reports.rb +8 -3
  143. data/lib/xero-ruby/models/accounting/request_empty.rb +7 -3
  144. data/lib/xero-ruby/models/accounting/row_type.rb +2 -2
  145. data/lib/xero-ruby/models/accounting/sales_tracking_category.rb +8 -4
  146. data/lib/xero-ruby/models/accounting/schedule.rb +23 -11
  147. data/lib/xero-ruby/models/accounting/tax_component.rb +11 -7
  148. data/lib/xero-ruby/models/accounting/tax_rate.rb +100 -18
  149. data/lib/xero-ruby/models/accounting/tax_rates.rb +8 -3
  150. data/lib/xero-ruby/models/accounting/tax_type.rb +2 -2
  151. data/lib/xero-ruby/models/accounting/{ten_nintey_nine_contact.rb → ten_ninety_nine_contact.rb} +44 -40
  152. data/lib/xero-ruby/models/accounting/time_zone.rb +2 -2
  153. data/lib/xero-ruby/models/accounting/tracking_categories.rb +8 -3
  154. data/lib/xero-ruby/models/accounting/tracking_category.rb +15 -8
  155. data/lib/xero-ruby/models/accounting/tracking_option.rb +13 -6
  156. data/lib/xero-ruby/models/accounting/tracking_options.rb +8 -3
  157. data/lib/xero-ruby/models/accounting/user.rb +20 -9
  158. data/lib/xero-ruby/models/accounting/users.rb +8 -3
  159. data/lib/xero-ruby/models/accounting/validation_error.rb +7 -3
  160. data/lib/xero-ruby/models/assets/asset.rb +24 -17
  161. data/lib/xero-ruby/models/assets/asset_status.rb +2 -2
  162. data/lib/xero-ruby/models/assets/asset_status_query_param.rb +2 -2
  163. data/lib/xero-ruby/models/assets/asset_type.rb +13 -13
  164. data/lib/xero-ruby/models/assets/assets.rb +9 -3
  165. data/lib/xero-ruby/models/assets/book_depreciation_detail.rb +19 -15
  166. data/lib/xero-ruby/models/assets/book_depreciation_setting.rb +26 -11
  167. data/lib/xero-ruby/models/assets/error.rb +11 -7
  168. data/lib/xero-ruby/models/assets/field_validation_errors_element.rb +12 -8
  169. data/lib/xero-ruby/models/assets/pagination.rb +11 -3
  170. data/lib/xero-ruby/models/assets/resource_validation_errors_element.rb +11 -7
  171. data/lib/xero-ruby/models/assets/setting.rb +14 -10
  172. data/lib/xero-ruby/models/projects/amount.rb +218 -0
  173. data/lib/xero-ruby/models/projects/charge_type.rb +38 -0
  174. data/lib/xero-ruby/models/projects/currency_code.rb +199 -0
  175. data/lib/xero-ruby/models/projects/error.rb +218 -0
  176. data/lib/xero-ruby/models/projects/pagination.rb +238 -0
  177. data/lib/xero-ruby/models/projects/project.rb +423 -0
  178. data/lib/xero-ruby/models/projects/project_create_or_update.rb +243 -0
  179. data/lib/xero-ruby/models/projects/project_patch.rb +213 -0
  180. data/lib/xero-ruby/models/projects/project_status.rb +37 -0
  181. data/lib/xero-ruby/models/projects/project_user.rb +228 -0
  182. data/lib/xero-ruby/models/projects/project_users.rb +220 -0
  183. data/lib/xero-ruby/models/projects/projects.rb +220 -0
  184. data/lib/xero-ruby/models/projects/task.rb +385 -0
  185. data/lib/xero-ruby/models/projects/task_create_or_update.rb +253 -0
  186. data/lib/xero-ruby/models/projects/tasks.rb +220 -0
  187. data/lib/xero-ruby/models/projects/time_entries.rb +220 -0
  188. data/lib/xero-ruby/models/projects/time_entry.rb +324 -0
  189. data/lib/xero-ruby/models/projects/time_entry_create_or_update.rb +268 -0
  190. data/lib/xero-ruby/version.rb +3 -3
  191. data/spec/accounting/api/accounting_api_spec.rb +3 -3
  192. data/spec/accounting/models/ten_nintey_nine_contact_spec.rb +6 -6
  193. data/spec/api_client_spec.rb +125 -38
  194. data/spec/assets/api/asset_api_spec.rb +3 -3
  195. data/spec/configuration_spec.rb +7 -23
  196. data/spec/projects/api/project_api_spec.rb +229 -0
  197. data/spec/projects/models/amount_spec.rb +47 -0
  198. data/spec/projects/models/charge_type_spec.rb +35 -0
  199. data/spec/projects/models/currency_code_spec.rb +35 -0
  200. data/spec/projects/models/error_spec.rb +47 -0
  201. data/spec/projects/models/pagination_spec.rb +59 -0
  202. data/spec/projects/models/project_create_or_update_spec.rb +59 -0
  203. data/spec/projects/models/project_patch_spec.rb +41 -0
  204. data/spec/projects/models/project_spec.rb +167 -0
  205. data/spec/projects/models/project_status_spec.rb +35 -0
  206. data/spec/projects/models/project_user_spec.rb +53 -0
  207. data/spec/projects/models/project_users_spec.rb +47 -0
  208. data/spec/projects/models/projects_spec.rb +47 -0
  209. data/spec/projects/models/task_create_or_update_spec.rb +59 -0
  210. data/spec/projects/models/task_spec.rb +129 -0
  211. data/spec/projects/models/tasks_spec.rb +47 -0
  212. data/spec/projects/models/time_entries_spec.rb +47 -0
  213. data/spec/projects/models/time_entry_create_or_update_spec.rb +65 -0
  214. data/spec/projects/models/time_entry_spec.rb +93 -0
  215. data/xero-ruby.gemspec +3 -4
  216. metadata +85 -10
  217. data/xero-ruby-1.0.gem +0 -0
  218. data/xero-ruby.gem +0 -0
@@ -0,0 +1,423 @@
1
+ =begin
2
+ #Xero Projects API
3
+
4
+ #This is the Xero Projects API
5
+
6
+ The version of the OpenAPI document: 2.2.12
7
+ Contact: api@xero.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'time'
14
+ require 'date'
15
+
16
+ module XeroRuby::Projects
17
+ require 'bigdecimal'
18
+
19
+ class Project
20
+ # Identifier of the project.
21
+ attr_accessor :project_id
22
+
23
+ # Identifier of the contact this project was created for.
24
+ attr_accessor :contact_id
25
+
26
+ # Name of the project.
27
+ attr_accessor :name
28
+
29
+
30
+ attr_accessor :currency_code
31
+
32
+ # A total of minutes logged against all tasks on the Project.
33
+ attr_accessor :minutes_logged
34
+
35
+
36
+ attr_accessor :total_task_amount
37
+
38
+
39
+ attr_accessor :total_expense_amount
40
+
41
+
42
+ attr_accessor :estimate_amount
43
+
44
+ # Minutes which have not been invoiced across all chargeable tasks in the project.
45
+ attr_accessor :minutes_to_be_invoiced
46
+
47
+
48
+ attr_accessor :task_amount_to_be_invoiced
49
+
50
+
51
+ attr_accessor :task_amount_invoiced
52
+
53
+
54
+ attr_accessor :expense_amount_to_be_invoiced
55
+
56
+
57
+ attr_accessor :expense_amount_invoiced
58
+
59
+
60
+ attr_accessor :project_amount_invoiced
61
+
62
+
63
+ attr_accessor :deposit
64
+
65
+
66
+ attr_accessor :deposit_applied
67
+
68
+
69
+ attr_accessor :credit_note_amount
70
+
71
+ # Deadline for the project. UTC Date Time in ISO-8601 format.
72
+ attr_accessor :deadline_utc
73
+
74
+
75
+ attr_accessor :total_invoiced
76
+
77
+
78
+ attr_accessor :total_to_be_invoiced
79
+
80
+
81
+ attr_accessor :estimate
82
+
83
+
84
+ attr_accessor :status
85
+
86
+ # Attribute mapping from ruby-style variable name to JSON key.
87
+ def self.attribute_map
88
+ {
89
+ :'project_id' => :'projectId',
90
+ :'contact_id' => :'contactId',
91
+ :'name' => :'name',
92
+ :'currency_code' => :'currencyCode',
93
+ :'minutes_logged' => :'minutesLogged',
94
+ :'total_task_amount' => :'totalTaskAmount',
95
+ :'total_expense_amount' => :'totalExpenseAmount',
96
+ :'estimate_amount' => :'estimateAmount',
97
+ :'minutes_to_be_invoiced' => :'minutesToBeInvoiced',
98
+ :'task_amount_to_be_invoiced' => :'taskAmountToBeInvoiced',
99
+ :'task_amount_invoiced' => :'taskAmountInvoiced',
100
+ :'expense_amount_to_be_invoiced' => :'expenseAmountToBeInvoiced',
101
+ :'expense_amount_invoiced' => :'expenseAmountInvoiced',
102
+ :'project_amount_invoiced' => :'projectAmountInvoiced',
103
+ :'deposit' => :'deposit',
104
+ :'deposit_applied' => :'depositApplied',
105
+ :'credit_note_amount' => :'creditNoteAmount',
106
+ :'deadline_utc' => :'deadlineUtc',
107
+ :'total_invoiced' => :'totalInvoiced',
108
+ :'total_to_be_invoiced' => :'totalToBeInvoiced',
109
+ :'estimate' => :'estimate',
110
+ :'status' => :'status'
111
+ }
112
+ end
113
+
114
+ # Attribute type mapping.
115
+ def self.openapi_types
116
+ {
117
+ :'project_id' => :'String',
118
+ :'contact_id' => :'String',
119
+ :'name' => :'String',
120
+ :'currency_code' => :'CurrencyCode',
121
+ :'minutes_logged' => :'Integer',
122
+ :'total_task_amount' => :'Amount',
123
+ :'total_expense_amount' => :'Amount',
124
+ :'estimate_amount' => :'Amount',
125
+ :'minutes_to_be_invoiced' => :'Integer',
126
+ :'task_amount_to_be_invoiced' => :'Amount',
127
+ :'task_amount_invoiced' => :'Amount',
128
+ :'expense_amount_to_be_invoiced' => :'Amount',
129
+ :'expense_amount_invoiced' => :'Amount',
130
+ :'project_amount_invoiced' => :'Amount',
131
+ :'deposit' => :'Amount',
132
+ :'deposit_applied' => :'Amount',
133
+ :'credit_note_amount' => :'Amount',
134
+ :'deadline_utc' => :'DateTime',
135
+ :'total_invoiced' => :'Amount',
136
+ :'total_to_be_invoiced' => :'Amount',
137
+ :'estimate' => :'Amount',
138
+ :'status' => :'ProjectStatus'
139
+ }
140
+ end
141
+
142
+ # Initializes the object
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ def initialize(attributes = {})
145
+ if (!attributes.is_a?(Hash))
146
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Projects::Project` initialize method"
147
+ end
148
+
149
+ # check to see if the attribute exists and convert string to symbol for hash key
150
+ attributes = attributes.each_with_object({}) { |(k, v), h|
151
+ if (!self.class.attribute_map.key?(k.to_sym))
152
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Projects::Project`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
153
+ end
154
+ h[k.to_sym] = v
155
+ }
156
+
157
+ if attributes.key?(:'project_id')
158
+ self.project_id = attributes[:'project_id']
159
+ end
160
+
161
+ if attributes.key?(:'contact_id')
162
+ self.contact_id = attributes[:'contact_id']
163
+ end
164
+
165
+ if attributes.key?(:'name')
166
+ self.name = attributes[:'name']
167
+ end
168
+
169
+ if attributes.key?(:'currency_code')
170
+ self.currency_code = attributes[:'currency_code']
171
+ end
172
+
173
+ if attributes.key?(:'minutes_logged')
174
+ self.minutes_logged = attributes[:'minutes_logged']
175
+ end
176
+
177
+ if attributes.key?(:'total_task_amount')
178
+ self.total_task_amount = attributes[:'total_task_amount']
179
+ end
180
+
181
+ if attributes.key?(:'total_expense_amount')
182
+ self.total_expense_amount = attributes[:'total_expense_amount']
183
+ end
184
+
185
+ if attributes.key?(:'estimate_amount')
186
+ self.estimate_amount = attributes[:'estimate_amount']
187
+ end
188
+
189
+ if attributes.key?(:'minutes_to_be_invoiced')
190
+ self.minutes_to_be_invoiced = attributes[:'minutes_to_be_invoiced']
191
+ end
192
+
193
+ if attributes.key?(:'task_amount_to_be_invoiced')
194
+ self.task_amount_to_be_invoiced = attributes[:'task_amount_to_be_invoiced']
195
+ end
196
+
197
+ if attributes.key?(:'task_amount_invoiced')
198
+ self.task_amount_invoiced = attributes[:'task_amount_invoiced']
199
+ end
200
+
201
+ if attributes.key?(:'expense_amount_to_be_invoiced')
202
+ self.expense_amount_to_be_invoiced = attributes[:'expense_amount_to_be_invoiced']
203
+ end
204
+
205
+ if attributes.key?(:'expense_amount_invoiced')
206
+ self.expense_amount_invoiced = attributes[:'expense_amount_invoiced']
207
+ end
208
+
209
+ if attributes.key?(:'project_amount_invoiced')
210
+ self.project_amount_invoiced = attributes[:'project_amount_invoiced']
211
+ end
212
+
213
+ if attributes.key?(:'deposit')
214
+ self.deposit = attributes[:'deposit']
215
+ end
216
+
217
+ if attributes.key?(:'deposit_applied')
218
+ self.deposit_applied = attributes[:'deposit_applied']
219
+ end
220
+
221
+ if attributes.key?(:'credit_note_amount')
222
+ self.credit_note_amount = attributes[:'credit_note_amount']
223
+ end
224
+
225
+ if attributes.key?(:'deadline_utc')
226
+ self.deadline_utc = attributes[:'deadline_utc']
227
+ end
228
+
229
+ if attributes.key?(:'total_invoiced')
230
+ self.total_invoiced = attributes[:'total_invoiced']
231
+ end
232
+
233
+ if attributes.key?(:'total_to_be_invoiced')
234
+ self.total_to_be_invoiced = attributes[:'total_to_be_invoiced']
235
+ end
236
+
237
+ if attributes.key?(:'estimate')
238
+ self.estimate = attributes[:'estimate']
239
+ end
240
+
241
+ if attributes.key?(:'status')
242
+ self.status = attributes[:'status']
243
+ end
244
+ end
245
+
246
+ # Show invalid properties with the reasons. Usually used together with valid?
247
+ # @return Array for valid properties with the reasons
248
+ def list_invalid_properties
249
+ invalid_properties = Array.new
250
+ if @name.nil?
251
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
252
+ end
253
+
254
+ invalid_properties
255
+ end
256
+
257
+ # Check to see if the all the properties in the model are valid
258
+ # @return true if the model is valid
259
+ def valid?
260
+ return false if @name.nil?
261
+ true
262
+ end
263
+
264
+ # Checks equality by comparing each attribute.
265
+ # @param [Object] Object to be compared
266
+ def ==(o)
267
+ return true if self.equal?(o)
268
+ self.class == o.class &&
269
+ project_id == o.project_id &&
270
+ contact_id == o.contact_id &&
271
+ name == o.name &&
272
+ currency_code == o.currency_code &&
273
+ minutes_logged == o.minutes_logged &&
274
+ total_task_amount == o.total_task_amount &&
275
+ total_expense_amount == o.total_expense_amount &&
276
+ estimate_amount == o.estimate_amount &&
277
+ minutes_to_be_invoiced == o.minutes_to_be_invoiced &&
278
+ task_amount_to_be_invoiced == o.task_amount_to_be_invoiced &&
279
+ task_amount_invoiced == o.task_amount_invoiced &&
280
+ expense_amount_to_be_invoiced == o.expense_amount_to_be_invoiced &&
281
+ expense_amount_invoiced == o.expense_amount_invoiced &&
282
+ project_amount_invoiced == o.project_amount_invoiced &&
283
+ deposit == o.deposit &&
284
+ deposit_applied == o.deposit_applied &&
285
+ credit_note_amount == o.credit_note_amount &&
286
+ deadline_utc == o.deadline_utc &&
287
+ total_invoiced == o.total_invoiced &&
288
+ total_to_be_invoiced == o.total_to_be_invoiced &&
289
+ estimate == o.estimate &&
290
+ status == o.status
291
+ end
292
+
293
+ # @see the `==` method
294
+ # @param [Object] Object to be compared
295
+ def eql?(o)
296
+ self == o
297
+ end
298
+
299
+ # Calculates hash code according to all attributes.
300
+ # @return [Integer] Hash code
301
+ def hash
302
+ [project_id, contact_id, name, currency_code, minutes_logged, total_task_amount, total_expense_amount, estimate_amount, minutes_to_be_invoiced, task_amount_to_be_invoiced, task_amount_invoiced, expense_amount_to_be_invoiced, expense_amount_invoiced, project_amount_invoiced, deposit, deposit_applied, credit_note_amount, deadline_utc, total_invoiced, total_to_be_invoiced, estimate, status].hash
303
+ end
304
+
305
+ # Builds the object from hash
306
+ # @param [Hash] attributes Model attributes in the form of hash
307
+ # @return [Object] Returns the model itself
308
+ def self.build_from_hash(attributes)
309
+ new.build_from_hash(attributes)
310
+ end
311
+
312
+ # Builds the object from hash
313
+ # @param [Hash] attributes Model attributes in the form of hash
314
+ # @return [Object] Returns the model itself
315
+ def build_from_hash(attributes)
316
+ return nil unless attributes.is_a?(Hash)
317
+ self.class.openapi_types.each_pair do |key, type|
318
+ if type =~ /\AArray<(.*)>/i
319
+ # check to ensure the input is an array given that the attribute
320
+ # is documented as an array but the input is not
321
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
322
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
323
+ end
324
+ elsif !attributes[self.class.attribute_map[key]].nil?
325
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
326
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
327
+ end
328
+
329
+ self
330
+ end
331
+
332
+ # Deserializes the data based on type
333
+ # @param string type Data type
334
+ # @param string value Value to be deserialized
335
+ # @return [Object] Deserialized data
336
+ def _deserialize(type, value)
337
+ case type.to_sym
338
+ when :DateTime
339
+ DateTime.parse(parse_date(value))
340
+ when :Date
341
+ Date.parse(parse_date(value))
342
+ when :String
343
+ value.to_s
344
+ when :Integer
345
+ value.to_i
346
+ when :Float
347
+ value.to_f
348
+ when :BigDecimal
349
+ BigDecimal(value.to_s)
350
+ when :Boolean
351
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
352
+ true
353
+ else
354
+ false
355
+ end
356
+ when :Object
357
+ # generic object (usually a Hash), return directly
358
+ value
359
+ when /\AArray<(?<inner_type>.+)>\z/
360
+ inner_type = Regexp.last_match[:inner_type]
361
+ value.map { |v| _deserialize(inner_type, v) }
362
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
363
+ k_type = Regexp.last_match[:k_type]
364
+ v_type = Regexp.last_match[:v_type]
365
+ {}.tap do |hash|
366
+ value.each do |k, v|
367
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
368
+ end
369
+ end
370
+ else # model
371
+ XeroRuby::Projects.const_get(type).build_from_hash(value)
372
+ end
373
+ end
374
+
375
+ # Returns the string representation of the object
376
+ # @return [String] String presentation of the object
377
+ def to_s
378
+ to_hash.to_s
379
+ end
380
+
381
+ # to_body is an alias to to_hash (backward compatibility)
382
+ # @return [Hash] Returns the object in the form of hash
383
+ def to_body
384
+ to_hash
385
+ end
386
+
387
+ # Returns the object in the form of hash
388
+ # @return [Hash] Returns the object in the form of hash
389
+ def to_hash
390
+ hash = {}
391
+ self.class.attribute_map.each_pair do |attr, param|
392
+ value = self.send(attr)
393
+ next if value.nil?
394
+ hash[param] = _to_hash(value)
395
+ end
396
+ hash
397
+ end
398
+
399
+ # Outputs non-array value in the form of hash
400
+ # For object, use to_hash. Otherwise, just return the value
401
+ # @param [Object] value Any valid value
402
+ # @return [Hash] Returns the value in the form of hash
403
+ def _to_hash(value)
404
+ if value.is_a?(Array)
405
+ value.compact.map { |v| _to_hash(v) }
406
+ elsif value.is_a?(Hash)
407
+ {}.tap do |hash|
408
+ value.each { |k, v| hash[k] = _to_hash(v) }
409
+ end
410
+ elsif value.respond_to? :to_hash
411
+ value.to_hash
412
+ else
413
+ value
414
+ end
415
+ end
416
+
417
+ # customized data_parser
418
+ def parse_date(datestring)
419
+ seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
420
+ return Time.at(seconds_since_epoch).to_s
421
+ end
422
+ end
423
+ end
@@ -0,0 +1,243 @@
1
+ =begin
2
+ #Xero Projects API
3
+
4
+ #This is the Xero Projects API
5
+
6
+ The version of the OpenAPI document: 2.2.12
7
+ Contact: api@xero.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'time'
14
+ require 'date'
15
+
16
+ module XeroRuby::Projects
17
+ require 'bigdecimal'
18
+
19
+ class ProjectCreateOrUpdate
20
+ # Identifier of the contact this project was created for.
21
+ attr_accessor :contact_id
22
+
23
+ # Name of the project.
24
+ attr_accessor :name
25
+
26
+
27
+ attr_accessor :estimate_amount
28
+
29
+ # Deadline for the project. UTC Date Time in ISO-8601 format.
30
+ attr_accessor :deadline_utc
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'contact_id' => :'contactId',
36
+ :'name' => :'name',
37
+ :'estimate_amount' => :'estimateAmount',
38
+ :'deadline_utc' => :'deadlineUtc'
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'contact_id' => :'String',
46
+ :'name' => :'String',
47
+ :'estimate_amount' => :'BigDecimal',
48
+ :'deadline_utc' => :'DateTime'
49
+ }
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Projects::ProjectCreateOrUpdate` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Projects::ProjectCreateOrUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'contact_id')
68
+ self.contact_id = attributes[:'contact_id']
69
+ end
70
+
71
+ if attributes.key?(:'name')
72
+ self.name = attributes[:'name']
73
+ end
74
+
75
+ if attributes.key?(:'estimate_amount')
76
+ self.estimate_amount = attributes[:'estimate_amount']
77
+ end
78
+
79
+ if attributes.key?(:'deadline_utc')
80
+ self.deadline_utc = attributes[:'deadline_utc']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ if @name.nil?
89
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ return false if @name.nil?
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ contact_id == o.contact_id &&
108
+ name == o.name &&
109
+ estimate_amount == o.estimate_amount &&
110
+ deadline_utc == o.deadline_utc
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [contact_id, name, estimate_amount, deadline_utc].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :DateTime
159
+ DateTime.parse(parse_date(value))
160
+ when :Date
161
+ Date.parse(parse_date(value))
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :BigDecimal
169
+ BigDecimal(value.to_s)
170
+ when :Boolean
171
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ XeroRuby::Projects.const_get(type).build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ next if value.nil?
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ # customized data_parser
238
+ def parse_date(datestring)
239
+ seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
240
+ return Time.at(seconds_since_epoch).to_s
241
+ end
242
+ end
243
+ end