xero-ruby 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (212) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +68 -0
  3. data/docs/accounting/AccountingApi.md +1497 -785
  4. data/docs/accounting/Allocation.md +11 -1
  5. data/docs/accounting/BankTransfer.md +1 -1
  6. data/docs/accounting/BatchPayment.md +1 -1
  7. data/docs/accounting/Contact.md +2 -2
  8. data/docs/accounting/CreditNote.md +2 -2
  9. data/docs/accounting/Invoice.md +2 -2
  10. data/docs/accounting/Organisation.md +2 -0
  11. data/docs/accounting/Payment.md +4 -4
  12. data/docs/accounting/Quote.md +5 -1
  13. data/docs/assets/AssetApi.md +40 -16
  14. data/docs/assets/AssetType.md +1 -1
  15. data/docs/projects/Amount.md +19 -0
  16. data/docs/projects/ChargeType.md +16 -0
  17. data/docs/projects/CurrencyCode.md +16 -0
  18. data/docs/projects/Error.md +19 -0
  19. data/docs/projects/Pagination.md +23 -0
  20. data/docs/projects/Project.md +59 -0
  21. data/docs/projects/ProjectApi.md +979 -0
  22. data/docs/projects/ProjectCreateOrUpdate.md +23 -0
  23. data/docs/projects/ProjectPatch.md +17 -0
  24. data/docs/projects/ProjectStatus.md +16 -0
  25. data/docs/projects/ProjectUser.md +21 -0
  26. data/docs/projects/ProjectUsers.md +19 -0
  27. data/docs/projects/Projects.md +19 -0
  28. data/docs/projects/Task.md +45 -0
  29. data/docs/projects/TaskCreateOrUpdate.md +23 -0
  30. data/docs/projects/Tasks.md +19 -0
  31. data/docs/projects/TimeEntries.md +19 -0
  32. data/docs/projects/TimeEntry.md +33 -0
  33. data/docs/projects/TimeEntryCreateOrUpdate.md +25 -0
  34. data/lib/xero-ruby.rb +21 -2
  35. data/lib/xero-ruby/api/accounting_api.rb +77 -85
  36. data/lib/xero-ruby/api/asset_api.rb +3 -3
  37. data/lib/xero-ruby/api/project_api.rb +1035 -0
  38. data/lib/xero-ruby/api_client.rb +33 -7
  39. data/lib/xero-ruby/api_error.rb +2 -2
  40. data/lib/xero-ruby/configuration.rb +4 -2
  41. data/lib/xero-ruby/models/accounting/account.rb +56 -20
  42. data/lib/xero-ruby/models/accounting/account_type.rb +2 -2
  43. data/lib/xero-ruby/models/accounting/accounts.rb +4 -3
  44. data/lib/xero-ruby/models/accounting/accounts_payable.rb +5 -3
  45. data/lib/xero-ruby/models/accounting/accounts_receivable.rb +5 -3
  46. data/lib/xero-ruby/models/accounting/address.rb +15 -12
  47. data/lib/xero-ruby/models/accounting/allocation.rb +61 -8
  48. data/lib/xero-ruby/models/accounting/allocations.rb +4 -3
  49. data/lib/xero-ruby/models/accounting/attachment.rb +8 -8
  50. data/lib/xero-ruby/models/accounting/attachments.rb +4 -3
  51. data/lib/xero-ruby/models/accounting/balances.rb +5 -3
  52. data/lib/xero-ruby/models/accounting/bank_transaction.rb +35 -20
  53. data/lib/xero-ruby/models/accounting/bank_transactions.rb +4 -3
  54. data/lib/xero-ruby/models/accounting/bank_transfer.rb +15 -13
  55. data/lib/xero-ruby/models/accounting/bank_transfers.rb +4 -3
  56. data/lib/xero-ruby/models/accounting/batch_payment.rb +24 -18
  57. data/lib/xero-ruby/models/accounting/batch_payment_details.rb +7 -7
  58. data/lib/xero-ruby/models/accounting/batch_payments.rb +4 -3
  59. data/lib/xero-ruby/models/accounting/bill.rb +4 -3
  60. data/lib/xero-ruby/models/accounting/branding_theme.rb +9 -8
  61. data/lib/xero-ruby/models/accounting/branding_themes.rb +4 -3
  62. data/lib/xero-ruby/models/accounting/cis_org_setting.rb +5 -5
  63. data/lib/xero-ruby/models/accounting/cis_setting.rb +4 -4
  64. data/lib/xero-ruby/models/accounting/cis_settings.rb +4 -3
  65. data/lib/xero-ruby/models/accounting/contact.rb +46 -36
  66. data/lib/xero-ruby/models/accounting/contact_group.rb +8 -6
  67. data/lib/xero-ruby/models/accounting/contact_groups.rb +4 -3
  68. data/lib/xero-ruby/models/accounting/contact_person.rb +6 -6
  69. data/lib/xero-ruby/models/accounting/contacts.rb +4 -3
  70. data/lib/xero-ruby/models/accounting/country_code.rb +2 -2
  71. data/lib/xero-ruby/models/accounting/credit_note.rb +38 -25
  72. data/lib/xero-ruby/models/accounting/credit_notes.rb +4 -3
  73. data/lib/xero-ruby/models/accounting/currencies.rb +4 -3
  74. data/lib/xero-ruby/models/accounting/currency.rb +5 -4
  75. data/lib/xero-ruby/models/accounting/currency_code.rb +2 -2
  76. data/lib/xero-ruby/models/accounting/element.rb +10 -4
  77. data/lib/xero-ruby/models/accounting/employee.rb +13 -8
  78. data/lib/xero-ruby/models/accounting/employees.rb +4 -3
  79. data/lib/xero-ruby/models/accounting/error.rb +6 -6
  80. data/lib/xero-ruby/models/accounting/expense_claim.rb +19 -12
  81. data/lib/xero-ruby/models/accounting/expense_claims.rb +4 -3
  82. data/lib/xero-ruby/models/accounting/external_link.rb +10 -4
  83. data/lib/xero-ruby/models/accounting/history_record.rb +6 -6
  84. data/lib/xero-ruby/models/accounting/history_records.rb +4 -3
  85. data/lib/xero-ruby/models/accounting/invoice.rb +56 -37
  86. data/lib/xero-ruby/models/accounting/invoice_reminder.rb +3 -3
  87. data/lib/xero-ruby/models/accounting/invoice_reminders.rb +4 -3
  88. data/lib/xero-ruby/models/accounting/invoices.rb +4 -3
  89. data/lib/xero-ruby/models/accounting/item.rb +18 -16
  90. data/lib/xero-ruby/models/accounting/items.rb +4 -3
  91. data/lib/xero-ruby/models/accounting/journal.rb +35 -10
  92. data/lib/xero-ruby/models/accounting/journal_line.rb +14 -13
  93. data/lib/xero-ruby/models/accounting/journals.rb +4 -3
  94. data/lib/xero-ruby/models/accounting/line_amount_types.rb +2 -2
  95. data/lib/xero-ruby/models/accounting/line_item.rb +15 -15
  96. data/lib/xero-ruby/models/accounting/line_item_tracking.rb +6 -6
  97. data/lib/xero-ruby/models/accounting/linked_transaction.rb +21 -13
  98. data/lib/xero-ruby/models/accounting/linked_transactions.rb +4 -3
  99. data/lib/xero-ruby/models/accounting/manual_journal.rb +21 -15
  100. data/lib/xero-ruby/models/accounting/manual_journal_line.rb +9 -9
  101. data/lib/xero-ruby/models/accounting/manual_journals.rb +4 -3
  102. data/lib/xero-ruby/models/accounting/online_invoice.rb +3 -3
  103. data/lib/xero-ruby/models/accounting/online_invoices.rb +4 -3
  104. data/lib/xero-ruby/models/accounting/organisation.rb +103 -43
  105. data/lib/xero-ruby/models/accounting/organisations.rb +4 -3
  106. data/lib/xero-ruby/models/accounting/overpayment.rb +27 -18
  107. data/lib/xero-ruby/models/accounting/overpayments.rb +4 -3
  108. data/lib/xero-ruby/models/accounting/payment.rb +41 -22
  109. data/lib/xero-ruby/models/accounting/payment_delete.rb +3 -3
  110. data/lib/xero-ruby/models/accounting/payment_service.rb +8 -8
  111. data/lib/xero-ruby/models/accounting/payment_services.rb +4 -3
  112. data/lib/xero-ruby/models/accounting/payment_term.rb +5 -3
  113. data/lib/xero-ruby/models/accounting/payment_term_type.rb +2 -2
  114. data/lib/xero-ruby/models/accounting/payments.rb +4 -3
  115. data/lib/xero-ruby/models/accounting/phone.rb +12 -6
  116. data/lib/xero-ruby/models/accounting/prepayment.rb +28 -18
  117. data/lib/xero-ruby/models/accounting/prepayments.rb +4 -3
  118. data/lib/xero-ruby/models/accounting/purchase.rb +6 -6
  119. data/lib/xero-ruby/models/accounting/purchase_order.rb +36 -28
  120. data/lib/xero-ruby/models/accounting/purchase_orders.rb +4 -3
  121. data/lib/xero-ruby/models/accounting/quote.rb +50 -24
  122. data/lib/xero-ruby/models/accounting/quote_line_amount_types.rb +2 -2
  123. data/lib/xero-ruby/models/accounting/quote_status_codes.rb +2 -2
  124. data/lib/xero-ruby/models/accounting/quotes.rb +4 -3
  125. data/lib/xero-ruby/models/accounting/receipt.rb +25 -16
  126. data/lib/xero-ruby/models/accounting/receipts.rb +4 -3
  127. data/lib/xero-ruby/models/accounting/repeating_invoice.rb +23 -14
  128. data/lib/xero-ruby/models/accounting/repeating_invoices.rb +4 -3
  129. data/lib/xero-ruby/models/accounting/report.rb +10 -8
  130. data/lib/xero-ruby/models/accounting/report_attribute.rb +5 -3
  131. data/lib/xero-ruby/models/accounting/report_cell.rb +5 -3
  132. data/lib/xero-ruby/models/accounting/report_fields.rb +6 -3
  133. data/lib/xero-ruby/models/accounting/report_row.rb +6 -3
  134. data/lib/xero-ruby/models/accounting/report_rows.rb +7 -3
  135. data/lib/xero-ruby/models/accounting/report_with_row.rb +11 -9
  136. data/lib/xero-ruby/models/accounting/report_with_rows.rb +4 -3
  137. data/lib/xero-ruby/models/accounting/reports.rb +4 -3
  138. data/lib/xero-ruby/models/accounting/request_empty.rb +3 -3
  139. data/lib/xero-ruby/models/accounting/row_type.rb +2 -2
  140. data/lib/xero-ruby/models/accounting/sales_tracking_category.rb +4 -4
  141. data/lib/xero-ruby/models/accounting/schedule.rb +19 -11
  142. data/lib/xero-ruby/models/accounting/tax_component.rb +6 -6
  143. data/lib/xero-ruby/models/accounting/tax_rate.rb +94 -16
  144. data/lib/xero-ruby/models/accounting/tax_rates.rb +4 -3
  145. data/lib/xero-ruby/models/accounting/tax_type.rb +2 -2
  146. data/lib/xero-ruby/models/accounting/ten_nintey_nine_contact.rb +24 -24
  147. data/lib/xero-ruby/models/accounting/time_zone.rb +2 -2
  148. data/lib/xero-ruby/models/accounting/tracking_categories.rb +4 -3
  149. data/lib/xero-ruby/models/accounting/tracking_category.rb +11 -8
  150. data/lib/xero-ruby/models/accounting/tracking_option.rb +9 -6
  151. data/lib/xero-ruby/models/accounting/tracking_options.rb +4 -3
  152. data/lib/xero-ruby/models/accounting/user.rb +16 -9
  153. data/lib/xero-ruby/models/accounting/users.rb +4 -3
  154. data/lib/xero-ruby/models/accounting/validation_error.rb +3 -3
  155. data/lib/xero-ruby/models/assets/asset.rb +17 -14
  156. data/lib/xero-ruby/models/assets/asset_status.rb +2 -2
  157. data/lib/xero-ruby/models/assets/asset_status_query_param.rb +2 -2
  158. data/lib/xero-ruby/models/assets/asset_type.rb +9 -13
  159. data/lib/xero-ruby/models/assets/assets.rb +5 -3
  160. data/lib/xero-ruby/models/assets/book_depreciation_detail.rb +9 -9
  161. data/lib/xero-ruby/models/assets/book_depreciation_setting.rb +21 -10
  162. data/lib/xero-ruby/models/assets/error.rb +7 -7
  163. data/lib/xero-ruby/models/assets/field_validation_errors_element.rb +8 -8
  164. data/lib/xero-ruby/models/assets/pagination.rb +7 -3
  165. data/lib/xero-ruby/models/assets/resource_validation_errors_element.rb +7 -7
  166. data/lib/xero-ruby/models/assets/setting.rb +10 -10
  167. data/lib/xero-ruby/models/projects/amount.rb +214 -0
  168. data/lib/xero-ruby/models/projects/charge_type.rb +38 -0
  169. data/lib/xero-ruby/models/projects/currency_code.rb +199 -0
  170. data/lib/xero-ruby/models/projects/error.rb +214 -0
  171. data/lib/xero-ruby/models/projects/pagination.rb +234 -0
  172. data/lib/xero-ruby/models/projects/project.rb +419 -0
  173. data/lib/xero-ruby/models/projects/project_create_or_update.rb +239 -0
  174. data/lib/xero-ruby/models/projects/project_patch.rb +209 -0
  175. data/lib/xero-ruby/models/projects/project_status.rb +37 -0
  176. data/lib/xero-ruby/models/projects/project_user.rb +224 -0
  177. data/lib/xero-ruby/models/projects/project_users.rb +216 -0
  178. data/lib/xero-ruby/models/projects/projects.rb +216 -0
  179. data/lib/xero-ruby/models/projects/task.rb +381 -0
  180. data/lib/xero-ruby/models/projects/task_create_or_update.rb +249 -0
  181. data/lib/xero-ruby/models/projects/tasks.rb +216 -0
  182. data/lib/xero-ruby/models/projects/time_entries.rb +216 -0
  183. data/lib/xero-ruby/models/projects/time_entry.rb +320 -0
  184. data/lib/xero-ruby/models/projects/time_entry_create_or_update.rb +264 -0
  185. data/lib/xero-ruby/version.rb +3 -3
  186. data/spec/accounting/api/accounting_api_spec.rb +3 -3
  187. data/spec/api_client_spec.rb +23 -23
  188. data/spec/assets/api/asset_api_spec.rb +3 -3
  189. data/spec/configuration_spec.rb +7 -23
  190. data/spec/projects/api/project_api_spec.rb +229 -0
  191. data/spec/projects/models/amount_spec.rb +47 -0
  192. data/spec/projects/models/charge_type_spec.rb +35 -0
  193. data/spec/projects/models/currency_code_spec.rb +35 -0
  194. data/spec/projects/models/error_spec.rb +47 -0
  195. data/spec/projects/models/pagination_spec.rb +59 -0
  196. data/spec/projects/models/project_create_or_update_spec.rb +59 -0
  197. data/spec/projects/models/project_patch_spec.rb +41 -0
  198. data/spec/projects/models/project_spec.rb +167 -0
  199. data/spec/projects/models/project_status_spec.rb +35 -0
  200. data/spec/projects/models/project_user_spec.rb +53 -0
  201. data/spec/projects/models/project_users_spec.rb +47 -0
  202. data/spec/projects/models/projects_spec.rb +47 -0
  203. data/spec/projects/models/task_create_or_update_spec.rb +59 -0
  204. data/spec/projects/models/task_spec.rb +129 -0
  205. data/spec/projects/models/tasks_spec.rb +47 -0
  206. data/spec/projects/models/time_entries_spec.rb +47 -0
  207. data/spec/projects/models/time_entry_create_or_update_spec.rb +65 -0
  208. data/spec/projects/models/time_entry_spec.rb +93 -0
  209. data/xero-ruby.gem +0 -0
  210. data/xero-ruby.gemspec +3 -3
  211. metadata +83 -7
  212. data/xero-ruby-1.0.gem +0 -0
@@ -0,0 +1,199 @@
1
+ =begin
2
+ #Xero Projects API
3
+
4
+ #This is the Xero Projects API
5
+
6
+ The version of the OpenAPI document: 2.2.6
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
+ class CurrencyCode
18
+ AED = "AED".freeze
19
+ AFN = "AFN".freeze
20
+ ALL = "ALL".freeze
21
+ AMD = "AMD".freeze
22
+ ANG = "ANG".freeze
23
+ AOA = "AOA".freeze
24
+ ARS = "ARS".freeze
25
+ AUD = "AUD".freeze
26
+ AWG = "AWG".freeze
27
+ AZN = "AZN".freeze
28
+ BAM = "BAM".freeze
29
+ BBD = "BBD".freeze
30
+ BDT = "BDT".freeze
31
+ BGN = "BGN".freeze
32
+ BHD = "BHD".freeze
33
+ BIF = "BIF".freeze
34
+ BMD = "BMD".freeze
35
+ BND = "BND".freeze
36
+ BOB = "BOB".freeze
37
+ BRL = "BRL".freeze
38
+ BSD = "BSD".freeze
39
+ BTN = "BTN".freeze
40
+ BWP = "BWP".freeze
41
+ BYN = "BYN".freeze
42
+ BZD = "BZD".freeze
43
+ CAD = "CAD".freeze
44
+ CDF = "CDF".freeze
45
+ CHF = "CHF".freeze
46
+ CLP = "CLP".freeze
47
+ CNY = "CNY".freeze
48
+ COP = "COP".freeze
49
+ CRC = "CRC".freeze
50
+ CUC = "CUC".freeze
51
+ CUP = "CUP".freeze
52
+ CVE = "CVE".freeze
53
+ CZK = "CZK".freeze
54
+ DJF = "DJF".freeze
55
+ DKK = "DKK".freeze
56
+ DOP = "DOP".freeze
57
+ DZD = "DZD".freeze
58
+ EGP = "EGP".freeze
59
+ ERN = "ERN".freeze
60
+ ETB = "ETB".freeze
61
+ EUR = "EUR".freeze
62
+ FJD = "FJD".freeze
63
+ FKP = "FKP".freeze
64
+ GBP = "GBP".freeze
65
+ GEL = "GEL".freeze
66
+ GGP = "GGP".freeze
67
+ GHS = "GHS".freeze
68
+ GIP = "GIP".freeze
69
+ GMD = "GMD".freeze
70
+ GNF = "GNF".freeze
71
+ GTQ = "GTQ".freeze
72
+ GYD = "GYD".freeze
73
+ HKD = "HKD".freeze
74
+ HNL = "HNL".freeze
75
+ HRK = "HRK".freeze
76
+ HTG = "HTG".freeze
77
+ HUF = "HUF".freeze
78
+ IDR = "IDR".freeze
79
+ ILS = "ILS".freeze
80
+ IMP = "IMP".freeze
81
+ INR = "INR".freeze
82
+ IQD = "IQD".freeze
83
+ IRR = "IRR".freeze
84
+ ISK = "ISK".freeze
85
+ JEP = "JEP".freeze
86
+ JMD = "JMD".freeze
87
+ JOD = "JOD".freeze
88
+ JPY = "JPY".freeze
89
+ KES = "KES".freeze
90
+ KGS = "KGS".freeze
91
+ KHR = "KHR".freeze
92
+ KMF = "KMF".freeze
93
+ KPW = "KPW".freeze
94
+ KRW = "KRW".freeze
95
+ KWD = "KWD".freeze
96
+ KYD = "KYD".freeze
97
+ KZT = "KZT".freeze
98
+ LAK = "LAK".freeze
99
+ LBP = "LBP".freeze
100
+ LKR = "LKR".freeze
101
+ LRD = "LRD".freeze
102
+ LSL = "LSL".freeze
103
+ LYD = "LYD".freeze
104
+ MAD = "MAD".freeze
105
+ MDL = "MDL".freeze
106
+ MGA = "MGA".freeze
107
+ MKD = "MKD".freeze
108
+ MMK = "MMK".freeze
109
+ MNT = "MNT".freeze
110
+ MOP = "MOP".freeze
111
+ MRU = "MRU".freeze
112
+ MUR = "MUR".freeze
113
+ MVR = "MVR".freeze
114
+ MWK = "MWK".freeze
115
+ MXN = "MXN".freeze
116
+ MYR = "MYR".freeze
117
+ MZN = "MZN".freeze
118
+ NAD = "NAD".freeze
119
+ NGN = "NGN".freeze
120
+ NIO = "NIO".freeze
121
+ NOK = "NOK".freeze
122
+ NPR = "NPR".freeze
123
+ NZD = "NZD".freeze
124
+ OMR = "OMR".freeze
125
+ PAB = "PAB".freeze
126
+ PEN = "PEN".freeze
127
+ PGK = "PGK".freeze
128
+ PHP = "PHP".freeze
129
+ PKR = "PKR".freeze
130
+ PLN = "PLN".freeze
131
+ PYG = "PYG".freeze
132
+ QAR = "QAR".freeze
133
+ RON = "RON".freeze
134
+ RSD = "RSD".freeze
135
+ RUB = "RUB".freeze
136
+ RWF = "RWF".freeze
137
+ SAR = "SAR".freeze
138
+ SBD = "SBD".freeze
139
+ SCR = "SCR".freeze
140
+ SDG = "SDG".freeze
141
+ SEK = "SEK".freeze
142
+ SGD = "SGD".freeze
143
+ SHP = "SHP".freeze
144
+ SLL = "SLL".freeze
145
+ SOS = "SOS".freeze
146
+ SPL = "SPL".freeze
147
+ SRD = "SRD".freeze
148
+ STN = "STN".freeze
149
+ SVC = "SVC".freeze
150
+ SYP = "SYP".freeze
151
+ SZL = "SZL".freeze
152
+ THB = "THB".freeze
153
+ TJS = "TJS".freeze
154
+ TMT = "TMT".freeze
155
+ TND = "TND".freeze
156
+ TOP = "TOP".freeze
157
+ TRY = "TRY".freeze
158
+ TTD = "TTD".freeze
159
+ TVD = "TVD".freeze
160
+ TWD = "TWD".freeze
161
+ TZS = "TZS".freeze
162
+ UAH = "UAH".freeze
163
+ UGX = "UGX".freeze
164
+ USD = "USD".freeze
165
+ UYU = "UYU".freeze
166
+ UZS = "UZS".freeze
167
+ VEF = "VEF".freeze
168
+ VND = "VND".freeze
169
+ VUV = "VUV".freeze
170
+ WST = "WST".freeze
171
+ XAF = "XAF".freeze
172
+ XCD = "XCD".freeze
173
+ XDR = "XDR".freeze
174
+ XOF = "XOF".freeze
175
+ XPF = "XPF".freeze
176
+ YER = "YER".freeze
177
+ ZAR = "ZAR".freeze
178
+ ZMW = "ZMW".freeze
179
+ ZMK = "ZMK".freeze
180
+ ZWD = "ZWD".freeze
181
+ EMPTY = "".freeze
182
+
183
+ # Builds the enum from string
184
+ # @param [String] The enum value in the form of the string
185
+ # @return [String] The enum value
186
+ def self.build_from_hash(value)
187
+ new.build_from_hash(value)
188
+ end
189
+
190
+ # Builds the enum from string
191
+ # @param [String] The enum value in the form of the string
192
+ # @return [String] The enum value
193
+ def build_from_hash(value)
194
+ constantValues = CurrencyCode.constants.select { |c| CurrencyCode::const_get(c) == value }
195
+ raise "Invalid ENUM value #{value} for class #CurrencyCode" if constantValues.empty?
196
+ value
197
+ end
198
+ end
199
+ end
@@ -0,0 +1,214 @@
1
+ =begin
2
+ #Xero Projects API
3
+
4
+ #This is the Xero Projects API
5
+
6
+ The version of the OpenAPI document: 2.2.6
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
+ class Error
18
+ # Exception message
19
+ attr_accessor :message
20
+
21
+ # Array of Elements of validation Errors
22
+ attr_accessor :model_state
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'message' => :'message',
28
+ :'model_state' => :'modelState'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'message' => :'String',
36
+ :'model_state' => :'Object'
37
+ }
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ if (!attributes.is_a?(Hash))
44
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Projects::Error` initialize method"
45
+ end
46
+
47
+ # check to see if the attribute exists and convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}) { |(k, v), h|
49
+ if (!self.class.attribute_map.key?(k.to_sym))
50
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Projects::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
+ end
52
+ h[k.to_sym] = v
53
+ }
54
+
55
+ if attributes.key?(:'message')
56
+ self.message = attributes[:'message']
57
+ end
58
+
59
+ if attributes.key?(:'model_state')
60
+ self.model_state = attributes[:'model_state']
61
+ end
62
+ end
63
+
64
+ # Show invalid properties with the reasons. Usually used together with valid?
65
+ # @return Array for valid properties with the reasons
66
+ def list_invalid_properties
67
+ invalid_properties = Array.new
68
+ invalid_properties
69
+ end
70
+
71
+ # Check to see if the all the properties in the model are valid
72
+ # @return true if the model is valid
73
+ def valid?
74
+ true
75
+ end
76
+
77
+ # Checks equality by comparing each attribute.
78
+ # @param [Object] Object to be compared
79
+ def ==(o)
80
+ return true if self.equal?(o)
81
+ self.class == o.class &&
82
+ message == o.message &&
83
+ model_state == o.model_state
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [message, model_state].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.openapi_types.each_pair do |key, type|
111
+ if type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
115
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
116
+ end
117
+ elsif !attributes[self.class.attribute_map[key]].nil?
118
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
120
+ end
121
+
122
+ self
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def _deserialize(type, value)
130
+ case type.to_sym
131
+ when :DateTime
132
+ DateTime.parse(parse_date(value))
133
+ when :Date
134
+ Date.parse(parse_date(value))
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :Boolean
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ XeroRuby::Projects.const_get(type).build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ next if value.nil?
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ # Outputs non-array value in the form of hash
191
+ # For object, use to_hash. Otherwise, just return the value
192
+ # @param [Object] value Any valid value
193
+ # @return [Hash] Returns the value in the form of hash
194
+ def _to_hash(value)
195
+ if value.is_a?(Array)
196
+ value.compact.map { |v| _to_hash(v) }
197
+ elsif value.is_a?(Hash)
198
+ {}.tap do |hash|
199
+ value.each { |k, v| hash[k] = _to_hash(v) }
200
+ end
201
+ elsif value.respond_to? :to_hash
202
+ value.to_hash
203
+ else
204
+ value
205
+ end
206
+ end
207
+
208
+ # customized data_parser
209
+ def parse_date(datestring)
210
+ seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
211
+ return Time.at(seconds_since_epoch).to_s
212
+ end
213
+ end
214
+ end
@@ -0,0 +1,234 @@
1
+ =begin
2
+ #Xero Projects API
3
+
4
+ #This is the Xero Projects API
5
+
6
+ The version of the OpenAPI document: 2.2.6
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
+ class Pagination
18
+ # Set to 1 by default. The requested number of the page in paged response - Must be a number greater than 0.
19
+ attr_accessor :page
20
+
21
+ # Optional, it is set to 50 by default. The number of items to return per page in a paged response - Must be a number between 1 and 500.
22
+ attr_accessor :page_size
23
+
24
+ # Number of pages available
25
+ attr_accessor :page_count
26
+
27
+ # Number of items returned
28
+ attr_accessor :item_count
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'page' => :'page',
34
+ :'page_size' => :'pageSize',
35
+ :'page_count' => :'pageCount',
36
+ :'item_count' => :'itemCount'
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'page' => :'Integer',
44
+ :'page_size' => :'Integer',
45
+ :'page_count' => :'Integer',
46
+ :'item_count' => :'Integer'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Projects::Pagination` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Projects::Pagination`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'page')
66
+ self.page = attributes[:'page']
67
+ end
68
+
69
+ if attributes.key?(:'page_size')
70
+ self.page_size = attributes[:'page_size']
71
+ end
72
+
73
+ if attributes.key?(:'page_count')
74
+ self.page_count = attributes[:'page_count']
75
+ end
76
+
77
+ if attributes.key?(:'item_count')
78
+ self.item_count = attributes[:'item_count']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ invalid_properties = Array.new
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ page == o.page &&
101
+ page_size == o.page_size &&
102
+ page_count == o.page_count &&
103
+ item_count == o.item_count
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [page, page_size, page_count, item_count].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ self.class.openapi_types.each_pair do |key, type|
131
+ if type =~ /\AArray<(.*)>/i
132
+ # check to ensure the input is an array given that the attribute
133
+ # is documented as an array but the input is not
134
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
135
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
136
+ end
137
+ elsif !attributes[self.class.attribute_map[key]].nil?
138
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
140
+ end
141
+
142
+ self
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def _deserialize(type, value)
150
+ case type.to_sym
151
+ when :DateTime
152
+ DateTime.parse(parse_date(value))
153
+ when :Date
154
+ Date.parse(parse_date(value))
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :Boolean
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+ when :Object
168
+ # generic object (usually a Hash), return directly
169
+ value
170
+ when /\AArray<(?<inner_type>.+)>\z/
171
+ inner_type = Regexp.last_match[:inner_type]
172
+ value.map { |v| _deserialize(inner_type, v) }
173
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
+ k_type = Regexp.last_match[:k_type]
175
+ v_type = Regexp.last_match[:v_type]
176
+ {}.tap do |hash|
177
+ value.each do |k, v|
178
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
+ end
180
+ end
181
+ else # model
182
+ XeroRuby::Projects.const_get(type).build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ next if value.nil?
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+
228
+ # customized data_parser
229
+ def parse_date(datestring)
230
+ seconds_since_epoch = datestring.scan(/[0-9]+/)[0].to_i / 1000.0
231
+ return Time.at(seconds_since_epoch).to_s
232
+ end
233
+ end
234
+ end