xero-ruby 3.2.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +71 -2
  3. data/lib/xero-ruby/api/accounting_api.rb +11 -2
  4. data/lib/xero-ruby/api/app_store_api.rb +87 -0
  5. data/lib/xero-ruby/api/finance_api.rb +866 -0
  6. data/lib/xero-ruby/api/payroll_au_api.rb +14 -14
  7. data/lib/xero-ruby/api/payroll_nz_api.rb +18 -12
  8. data/lib/xero-ruby/api/payroll_uk_api.rb +14 -2
  9. data/lib/xero-ruby/api_client.rb +30 -4
  10. data/lib/xero-ruby/configuration.rb +4 -0
  11. data/lib/xero-ruby/models/accounting/bank_transfer.rb +35 -1
  12. data/lib/xero-ruby/models/accounting/budget_balance.rb +2 -2
  13. data/lib/xero-ruby/models/accounting/contact.rb +86 -1
  14. data/lib/xero-ruby/models/accounting/payment.rb +11 -1
  15. data/lib/xero-ruby/models/accounting/time_zone.rb +1 -0
  16. data/lib/xero-ruby/models/app_store/plan.rb +310 -0
  17. data/lib/xero-ruby/models/app_store/price.rb +257 -0
  18. data/lib/xero-ruby/models/app_store/problem_details.rb +272 -0
  19. data/lib/xero-ruby/models/app_store/product.rb +288 -0
  20. data/lib/xero-ruby/models/app_store/subscription.rb +324 -0
  21. data/lib/xero-ruby/models/app_store/subscription_item.rb +292 -0
  22. data/lib/xero-ruby/models/finance/account_usage.rb +342 -0
  23. data/lib/xero-ruby/models/finance/account_usage_response.rb +254 -0
  24. data/lib/xero-ruby/models/finance/balance_sheet_account_detail.rb +262 -0
  25. data/lib/xero-ruby/models/finance/balance_sheet_account_group.rb +234 -0
  26. data/lib/xero-ruby/models/finance/balance_sheet_account_type.rb +244 -0
  27. data/lib/xero-ruby/models/finance/balance_sheet_response.rb +252 -0
  28. data/lib/xero-ruby/models/finance/bank_statement_response.rb +232 -0
  29. data/lib/xero-ruby/models/finance/cash_account_response.rb +262 -0
  30. data/lib/xero-ruby/models/finance/cash_balance.rb +242 -0
  31. data/lib/xero-ruby/models/finance/cash_validation_response.rb +262 -0
  32. data/lib/xero-ruby/models/finance/cashflow_account.rb +282 -0
  33. data/lib/xero-ruby/models/finance/cashflow_activity.rb +244 -0
  34. data/lib/xero-ruby/models/finance/cashflow_response.rb +254 -0
  35. data/lib/xero-ruby/models/finance/cashflow_type.rb +244 -0
  36. data/lib/xero-ruby/models/finance/contact_detail.rb +274 -0
  37. data/lib/xero-ruby/models/finance/contact_total_detail.rb +242 -0
  38. data/lib/xero-ruby/models/finance/contact_total_other.rb +252 -0
  39. data/lib/xero-ruby/models/finance/current_statement_response.rb +272 -0
  40. data/lib/xero-ruby/models/finance/data_source_response.rb +362 -0
  41. data/lib/xero-ruby/models/finance/history_record_response.rb +262 -0
  42. data/lib/xero-ruby/models/finance/income_by_contact_response.rb +284 -0
  43. data/lib/xero-ruby/models/finance/lock_history_model.rb +242 -0
  44. data/lib/xero-ruby/models/finance/lock_history_response.rb +244 -0
  45. data/lib/xero-ruby/models/finance/manual_journal_total.rb +222 -0
  46. data/lib/xero-ruby/models/finance/pnl_account.rb +272 -0
  47. data/lib/xero-ruby/models/finance/pnl_account_class.rb +234 -0
  48. data/lib/xero-ruby/models/finance/pnl_account_type.rb +244 -0
  49. data/lib/xero-ruby/models/finance/practice_response.rb +262 -0
  50. data/lib/xero-ruby/models/finance/problem.rb +252 -0
  51. data/lib/xero-ruby/models/finance/problem_type.rb +39 -0
  52. data/lib/xero-ruby/models/finance/profit_and_loss_response.rb +262 -0
  53. data/lib/xero-ruby/models/finance/report_history_model.rb +242 -0
  54. data/lib/xero-ruby/models/finance/report_history_response.rb +244 -0
  55. data/lib/xero-ruby/models/finance/statement_balance_response.rb +232 -0
  56. data/lib/xero-ruby/models/finance/statement_lines_response.rb +382 -0
  57. data/lib/xero-ruby/models/finance/total_detail.rb +242 -0
  58. data/lib/xero-ruby/models/finance/total_other.rb +242 -0
  59. data/lib/xero-ruby/models/finance/trial_balance_account.rb +312 -0
  60. data/lib/xero-ruby/models/finance/trial_balance_entry.rb +232 -0
  61. data/lib/xero-ruby/models/finance/trial_balance_movement.rb +252 -0
  62. data/lib/xero-ruby/models/finance/trial_balance_response.rb +244 -0
  63. data/lib/xero-ruby/models/finance/user_activities_response.rb +244 -0
  64. data/lib/xero-ruby/models/finance/user_response.rb +336 -0
  65. data/lib/xero-ruby/models/payroll_au/earnings_type.rb +2 -0
  66. data/lib/xero-ruby/models/payroll_au/employee.rb +30 -1
  67. data/lib/xero-ruby/models/payroll_au/manual_tax_type.rb +1 -0
  68. data/lib/xero-ruby/models/payroll_au/payroll_calendar.rb +11 -1
  69. data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +4 -4
  70. data/lib/xero-ruby/version.rb +6 -6
  71. data/lib/xero-ruby.rb +51 -0
  72. data/spec/api_client_spec.rb +5 -2
  73. data/spec/app_store/api/app_store_api_spec.rb +45 -0
  74. data/spec/app_store/models/plan_spec.rb +62 -0
  75. data/spec/app_store/models/price_spec.rb +52 -0
  76. data/spec/app_store/models/problem_details_spec.rb +70 -0
  77. data/spec/app_store/models/product_spec.rb +56 -0
  78. data/spec/app_store/models/subscription_item_spec.rb +70 -0
  79. data/spec/app_store/models/subscription_spec.rb +82 -0
  80. data/spec/configuration_spec.rb +1 -0
  81. data/spec/finance/api/finance_api_spec.rb +156 -0
  82. data/spec/finance/models/account_usage_response_spec.rb +58 -0
  83. data/spec/finance/models/account_usage_spec.rb +112 -0
  84. data/spec/finance/models/balance_sheet_account_detail_spec.rb +64 -0
  85. data/spec/finance/models/balance_sheet_account_group_spec.rb +46 -0
  86. data/spec/finance/models/balance_sheet_account_type_spec.rb +52 -0
  87. data/spec/finance/models/balance_sheet_response_spec.rb +58 -0
  88. data/spec/finance/models/bank_statement_response_spec.rb +46 -0
  89. data/spec/finance/models/cash_account_response_spec.rb +64 -0
  90. data/spec/finance/models/cash_balance_spec.rb +52 -0
  91. data/spec/finance/models/cash_validation_response_spec.rb +64 -0
  92. data/spec/finance/models/cashflow_account_spec.rb +76 -0
  93. data/spec/finance/models/cashflow_activity_spec.rb +52 -0
  94. data/spec/finance/models/cashflow_response_spec.rb +58 -0
  95. data/spec/finance/models/cashflow_type_spec.rb +52 -0
  96. data/spec/finance/models/current_statement_response_spec.rb +70 -0
  97. data/spec/finance/models/data_source_response_spec.rb +124 -0
  98. data/spec/finance/models/history_record_response_spec.rb +64 -0
  99. data/spec/finance/models/lock_history_model_spec.rb +52 -0
  100. data/spec/finance/models/lock_history_response_spec.rb +52 -0
  101. data/spec/finance/models/pnl_account_class_spec.rb +46 -0
  102. data/spec/finance/models/pnl_account_spec.rb +70 -0
  103. data/spec/finance/models/pnl_account_type_spec.rb +52 -0
  104. data/spec/finance/models/practice_response_spec.rb +64 -0
  105. data/spec/finance/models/problem_spec.rb +58 -0
  106. data/spec/finance/models/problem_type_spec.rb +34 -0
  107. data/spec/finance/models/profit_and_loss_response_spec.rb +64 -0
  108. data/spec/finance/models/report_history_model_spec.rb +52 -0
  109. data/spec/finance/models/report_history_response_spec.rb +52 -0
  110. data/spec/finance/models/statement_balance_response_spec.rb +46 -0
  111. data/spec/finance/models/statement_lines_response_spec.rb +136 -0
  112. data/spec/finance/models/trial_balance_account_spec.rb +94 -0
  113. data/spec/finance/models/trial_balance_entry_spec.rb +46 -0
  114. data/spec/finance/models/trial_balance_movement_spec.rb +58 -0
  115. data/spec/finance/models/trial_balance_response_spec.rb +52 -0
  116. data/spec/finance/models/user_activities_response_spec.rb +52 -0
  117. data/spec/finance/models/user_response_spec.rb +106 -0
  118. metadata +142 -3
@@ -0,0 +1,244 @@
1
+ =begin
2
+ #Xero Finance API
3
+
4
+ #The Finance API is a collection of endpoints which customers can use in the course of a loan application, which may assist lenders to gain the confidence they need to provide capital.
5
+
6
+ Contact: api@xero.com
7
+ Generated by: https://openapi-generator.tech
8
+ OpenAPI Generator version: 4.3.1
9
+
10
+ =end
11
+
12
+ require 'time'
13
+ require 'date'
14
+
15
+ module XeroRuby::Finance
16
+ require 'bigdecimal'
17
+
18
+ class UserActivitiesResponse
19
+ # The requested Organisation to which the data pertains
20
+ attr_accessor :organisation_id
21
+
22
+ # The month of the report
23
+ attr_accessor :data_month
24
+
25
+
26
+ attr_accessor :users
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'organisation_id' => :'organisationId',
32
+ :'data_month' => :'dataMonth',
33
+ :'users' => :'users'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'organisation_id' => :'String',
41
+ :'data_month' => :'String',
42
+ :'users' => :'Array<UserResponse>'
43
+ }
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Finance::UserActivitiesResponse` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Finance::UserActivitiesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'organisation_id')
62
+ self.organisation_id = attributes[:'organisation_id']
63
+ end
64
+
65
+ if attributes.key?(:'data_month')
66
+ self.data_month = attributes[:'data_month']
67
+ end
68
+
69
+ if attributes.key?(:'users')
70
+ if (value = attributes[:'users']).is_a?(Array)
71
+ self.users = value
72
+ end
73
+ end
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properties with the reasons
78
+ def list_invalid_properties
79
+ invalid_properties = Array.new
80
+ invalid_properties
81
+ end
82
+
83
+ # Check to see if the all the properties in the model are valid
84
+ # @return true if the model is valid
85
+ def valid?
86
+ true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(o)
92
+ return true if self.equal?(o)
93
+ self.class == o.class &&
94
+ organisation_id == o.organisation_id &&
95
+ data_month == o.data_month &&
96
+ users == o.users
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Integer] Hash code
107
+ def hash
108
+ [organisation_id, data_month, users].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def self.build_from_hash(attributes)
115
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.openapi_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ DateTime.parse(parse_date(value))
146
+ when :Date
147
+ Date.parse(parse_date(value))
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :BigDecimal
155
+ BigDecimal(value.to_s)
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ XeroRuby::Finance.const_get(type).build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash(downcase: false)
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ next if value.nil?
200
+ key = downcase ? attr : param
201
+ hash[key] = _to_hash(value, downcase: downcase)
202
+ end
203
+ hash
204
+ end
205
+
206
+ # Returns the object in the form of hash with snake_case
207
+ def to_attributes
208
+ to_hash(downcase: true)
209
+ end
210
+
211
+ # Outputs non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
215
+ def _to_hash(value, downcase: false)
216
+ if value.is_a?(Array)
217
+ value.map do |v|
218
+ v.to_hash(downcase: downcase)
219
+ end
220
+ elsif value.is_a?(Hash)
221
+ {}.tap do |hash|
222
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
223
+ end
224
+ elsif value.respond_to? :to_hash
225
+ value.to_hash(downcase: downcase)
226
+ else
227
+ value
228
+ end
229
+ end
230
+
231
+ def parse_date(datestring)
232
+ if datestring.include?('Date')
233
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
234
+ original, date, timezone = *date_pattern.match(datestring)
235
+ date = (date.to_i / 1000)
236
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
237
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
238
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
239
+ else # handle date 'types' for small subset of payroll API's
240
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
241
+ end
242
+ end
243
+ end
244
+ end
@@ -0,0 +1,336 @@
1
+ =begin
2
+ #Xero Finance API
3
+
4
+ #The Finance API is a collection of endpoints which customers can use in the course of a loan application, which may assist lenders to gain the confidence they need to provide capital.
5
+
6
+ Contact: api@xero.com
7
+ Generated by: https://openapi-generator.tech
8
+ OpenAPI Generator version: 4.3.1
9
+
10
+ =end
11
+
12
+ require 'time'
13
+ require 'date'
14
+
15
+ module XeroRuby::Finance
16
+ require 'bigdecimal'
17
+
18
+ class UserResponse
19
+ # The Xero identifier for the user
20
+ attr_accessor :user_id
21
+
22
+ # Timestamp of user creation.
23
+ attr_accessor :user_created_date_utc
24
+
25
+ # Timestamp of user last login
26
+ attr_accessor :last_login_date_utc
27
+
28
+ # User is external partner.
29
+ attr_accessor :is_external_partner
30
+
31
+ # User has Accountant role.
32
+ attr_accessor :has_accountant_role
33
+
34
+ # Month period in format yyyy-MM.
35
+ attr_accessor :month_period
36
+
37
+ # Number of times the user has logged in.
38
+ attr_accessor :number_of_logins
39
+
40
+ # Number of documents created.
41
+ attr_accessor :number_of_documents_created
42
+
43
+ # Net value of documents created.
44
+ attr_accessor :net_value_documents_created
45
+
46
+ # Absolute value of documents created.
47
+ attr_accessor :absolute_value_documents_created
48
+
49
+
50
+ attr_accessor :attached_practices
51
+
52
+
53
+ attr_accessor :history_records
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'user_id' => :'userId',
59
+ :'user_created_date_utc' => :'userCreatedDateUtc',
60
+ :'last_login_date_utc' => :'lastLoginDateUtc',
61
+ :'is_external_partner' => :'isExternalPartner',
62
+ :'has_accountant_role' => :'hasAccountantRole',
63
+ :'month_period' => :'monthPeriod',
64
+ :'number_of_logins' => :'numberOfLogins',
65
+ :'number_of_documents_created' => :'numberOfDocumentsCreated',
66
+ :'net_value_documents_created' => :'netValueDocumentsCreated',
67
+ :'absolute_value_documents_created' => :'absoluteValueDocumentsCreated',
68
+ :'attached_practices' => :'attachedPractices',
69
+ :'history_records' => :'historyRecords'
70
+ }
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'user_id' => :'String',
77
+ :'user_created_date_utc' => :'DateTime',
78
+ :'last_login_date_utc' => :'DateTime',
79
+ :'is_external_partner' => :'Boolean',
80
+ :'has_accountant_role' => :'Boolean',
81
+ :'month_period' => :'String',
82
+ :'number_of_logins' => :'Integer',
83
+ :'number_of_documents_created' => :'Integer',
84
+ :'net_value_documents_created' => :'BigDecimal',
85
+ :'absolute_value_documents_created' => :'BigDecimal',
86
+ :'attached_practices' => :'Array<PracticeResponse>',
87
+ :'history_records' => :'Array<HistoryRecordResponse>'
88
+ }
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ if (!attributes.is_a?(Hash))
95
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Finance::UserResponse` initialize method"
96
+ end
97
+
98
+ # check to see if the attribute exists and convert string to symbol for hash key
99
+ attributes = attributes.each_with_object({}) { |(k, v), h|
100
+ if (!self.class.attribute_map.key?(k.to_sym))
101
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Finance::UserResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
102
+ end
103
+ h[k.to_sym] = v
104
+ }
105
+
106
+ if attributes.key?(:'user_id')
107
+ self.user_id = attributes[:'user_id']
108
+ end
109
+
110
+ if attributes.key?(:'user_created_date_utc')
111
+ self.user_created_date_utc = attributes[:'user_created_date_utc']
112
+ end
113
+
114
+ if attributes.key?(:'last_login_date_utc')
115
+ self.last_login_date_utc = attributes[:'last_login_date_utc']
116
+ end
117
+
118
+ if attributes.key?(:'is_external_partner')
119
+ self.is_external_partner = attributes[:'is_external_partner']
120
+ end
121
+
122
+ if attributes.key?(:'has_accountant_role')
123
+ self.has_accountant_role = attributes[:'has_accountant_role']
124
+ end
125
+
126
+ if attributes.key?(:'month_period')
127
+ self.month_period = attributes[:'month_period']
128
+ end
129
+
130
+ if attributes.key?(:'number_of_logins')
131
+ self.number_of_logins = attributes[:'number_of_logins']
132
+ end
133
+
134
+ if attributes.key?(:'number_of_documents_created')
135
+ self.number_of_documents_created = attributes[:'number_of_documents_created']
136
+ end
137
+
138
+ if attributes.key?(:'net_value_documents_created')
139
+ self.net_value_documents_created = attributes[:'net_value_documents_created']
140
+ end
141
+
142
+ if attributes.key?(:'absolute_value_documents_created')
143
+ self.absolute_value_documents_created = attributes[:'absolute_value_documents_created']
144
+ end
145
+
146
+ if attributes.key?(:'attached_practices')
147
+ if (value = attributes[:'attached_practices']).is_a?(Array)
148
+ self.attached_practices = value
149
+ end
150
+ end
151
+
152
+ if attributes.key?(:'history_records')
153
+ if (value = attributes[:'history_records']).is_a?(Array)
154
+ self.history_records = value
155
+ end
156
+ end
157
+ end
158
+
159
+ # Show invalid properties with the reasons. Usually used together with valid?
160
+ # @return Array for valid properties with the reasons
161
+ def list_invalid_properties
162
+ invalid_properties = Array.new
163
+ invalid_properties
164
+ end
165
+
166
+ # Check to see if the all the properties in the model are valid
167
+ # @return true if the model is valid
168
+ def valid?
169
+ true
170
+ end
171
+
172
+ # Checks equality by comparing each attribute.
173
+ # @param [Object] Object to be compared
174
+ def ==(o)
175
+ return true if self.equal?(o)
176
+ self.class == o.class &&
177
+ user_id == o.user_id &&
178
+ user_created_date_utc == o.user_created_date_utc &&
179
+ last_login_date_utc == o.last_login_date_utc &&
180
+ is_external_partner == o.is_external_partner &&
181
+ has_accountant_role == o.has_accountant_role &&
182
+ month_period == o.month_period &&
183
+ number_of_logins == o.number_of_logins &&
184
+ number_of_documents_created == o.number_of_documents_created &&
185
+ net_value_documents_created == o.net_value_documents_created &&
186
+ absolute_value_documents_created == o.absolute_value_documents_created &&
187
+ attached_practices == o.attached_practices &&
188
+ history_records == o.history_records
189
+ end
190
+
191
+ # @see the `==` method
192
+ # @param [Object] Object to be compared
193
+ def eql?(o)
194
+ self == o
195
+ end
196
+
197
+ # Calculates hash code according to all attributes.
198
+ # @return [Integer] Hash code
199
+ def hash
200
+ [user_id, user_created_date_utc, last_login_date_utc, is_external_partner, has_accountant_role, month_period, number_of_logins, number_of_documents_created, net_value_documents_created, absolute_value_documents_created, attached_practices, history_records].hash
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def self.build_from_hash(attributes)
207
+ new.build_from_hash(attributes)
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def build_from_hash(attributes)
214
+ return nil unless attributes.is_a?(Hash)
215
+ self.class.openapi_types.each_pair do |key, type|
216
+ if type =~ /\AArray<(.*)>/i
217
+ # check to ensure the input is an array given that the attribute
218
+ # is documented as an array but the input is not
219
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
220
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
221
+ end
222
+ elsif !attributes[self.class.attribute_map[key]].nil?
223
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
224
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
225
+ end
226
+
227
+ self
228
+ end
229
+
230
+ # Deserializes the data based on type
231
+ # @param string type Data type
232
+ # @param string value Value to be deserialized
233
+ # @return [Object] Deserialized data
234
+ def _deserialize(type, value)
235
+ case type.to_sym
236
+ when :DateTime
237
+ DateTime.parse(parse_date(value))
238
+ when :Date
239
+ Date.parse(parse_date(value))
240
+ when :String
241
+ value.to_s
242
+ when :Integer
243
+ value.to_i
244
+ when :Float
245
+ value.to_f
246
+ when :BigDecimal
247
+ BigDecimal(value.to_s)
248
+ when :Boolean
249
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
250
+ true
251
+ else
252
+ false
253
+ end
254
+ when :Object
255
+ # generic object (usually a Hash), return directly
256
+ value
257
+ when /\AArray<(?<inner_type>.+)>\z/
258
+ inner_type = Regexp.last_match[:inner_type]
259
+ value.map { |v| _deserialize(inner_type, v) }
260
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
261
+ k_type = Regexp.last_match[:k_type]
262
+ v_type = Regexp.last_match[:v_type]
263
+ {}.tap do |hash|
264
+ value.each do |k, v|
265
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
266
+ end
267
+ end
268
+ else # model
269
+ XeroRuby::Finance.const_get(type).build_from_hash(value)
270
+ end
271
+ end
272
+
273
+ # Returns the string representation of the object
274
+ # @return [String] String presentation of the object
275
+ def to_s
276
+ to_hash.to_s
277
+ end
278
+
279
+ # to_body is an alias to to_hash (backward compatibility)
280
+ # @return [Hash] Returns the object in the form of hash
281
+ def to_body
282
+ to_hash
283
+ end
284
+
285
+ # Returns the object in the form of hash
286
+ # @return [Hash] Returns the object in the form of hash
287
+ def to_hash(downcase: false)
288
+ hash = {}
289
+ self.class.attribute_map.each_pair do |attr, param|
290
+ value = self.send(attr)
291
+ next if value.nil?
292
+ key = downcase ? attr : param
293
+ hash[key] = _to_hash(value, downcase: downcase)
294
+ end
295
+ hash
296
+ end
297
+
298
+ # Returns the object in the form of hash with snake_case
299
+ def to_attributes
300
+ to_hash(downcase: true)
301
+ end
302
+
303
+ # Outputs non-array value in the form of hash
304
+ # For object, use to_hash. Otherwise, just return the value
305
+ # @param [Object] value Any valid value
306
+ # @return [Hash] Returns the value in the form of hash
307
+ def _to_hash(value, downcase: false)
308
+ if value.is_a?(Array)
309
+ value.map do |v|
310
+ v.to_hash(downcase: downcase)
311
+ end
312
+ elsif value.is_a?(Hash)
313
+ {}.tap do |hash|
314
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
315
+ end
316
+ elsif value.respond_to? :to_hash
317
+ value.to_hash(downcase: downcase)
318
+ else
319
+ value
320
+ end
321
+ end
322
+
323
+ def parse_date(datestring)
324
+ if datestring.include?('Date')
325
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
326
+ original, date, timezone = *date_pattern.match(datestring)
327
+ date = (date.to_i / 1000)
328
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
329
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
330
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
331
+ else # handle date 'types' for small subset of payroll API's
332
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
333
+ end
334
+ end
335
+ end
336
+ end
@@ -24,6 +24,8 @@ module XeroRuby::PayrollAu
24
24
  LUMPSUMB = "LUMPSUMB".freeze
25
25
  BONUSESANDCOMMISSIONS = "BONUSESANDCOMMISSIONS".freeze
26
26
  LUMPSUME = "LUMPSUME".freeze
27
+ LUMPSUMW = "LUMPSUMW".freeze
28
+ DIRECTORSFEES = "DIRECTORSFEES".freeze
27
29
 
28
30
  # Builds the enum from string
29
31
  # @param [String] The enum value in the form of the string
@@ -83,6 +83,16 @@ module XeroRuby::PayrollAu
83
83
  # Employee Termination Date (YYYY-MM-DD)
84
84
  attr_accessor :termination_date
85
85
 
86
+ # * `V` Voluntary cessation - An employee resignation, retirement, domestic or pressing necessity or abandonment of employment * `I` Ill health - An employee resignation due to medical condition that prevents the continuation of employment, such as for illness, ill-health, medical unfitness or total permanent disability * `D` Deceased - The death of an employee * `R` Redundancy - An employer-initiated termination of employment due to a genuine redundancy or approved early retirement scheme * `F` Dismissal - An employer-initiated termination of employment due to dismissal, inability to perform the required work, misconduct or inefficiency * `C` Contract cessation - The natural conclusion of a limited employment relationship due to contract/engagement duration or task completion, seasonal work completion, or to cease casuals that are no longer required * `T` Transfer - The administrative arrangements performed to transfer employees across payroll systems, move them temporarily to another employer (machinery of government for public servants), transfer of business, move them to outsourcing arrangements or other such technical activities.
87
+ attr_accessor :termination_reason
88
+ V = "V".freeze
89
+ # I = "I".freeze
90
+ D = "D".freeze
91
+ R = "R".freeze
92
+ # F = "F".freeze
93
+ C = "C".freeze
94
+ T = "T".freeze
95
+
86
96
 
87
97
  attr_accessor :bank_accounts
88
98
 
@@ -159,6 +169,7 @@ module XeroRuby::PayrollAu
159
169
  :'employee_group_name' => :'EmployeeGroupName',
160
170
  :'employee_id' => :'EmployeeID',
161
171
  :'termination_date' => :'TerminationDate',
172
+ :'termination_reason' => :'TerminationReason',
162
173
  :'bank_accounts' => :'BankAccounts',
163
174
  :'pay_template' => :'PayTemplate',
164
175
  :'opening_balances' => :'OpeningBalances',
@@ -196,6 +207,7 @@ module XeroRuby::PayrollAu
196
207
  :'employee_group_name' => :'String',
197
208
  :'employee_id' => :'String',
198
209
  :'termination_date' => :'Date',
210
+ :'termination_reason' => :'String',
199
211
  :'bank_accounts' => :'Array<BankAccount>',
200
212
  :'pay_template' => :'PayTemplate',
201
213
  :'opening_balances' => :'OpeningBalances',
@@ -308,6 +320,10 @@ module XeroRuby::PayrollAu
308
320
  self.termination_date = attributes[:'termination_date']
309
321
  end
310
322
 
323
+ if attributes.key?(:'termination_reason')
324
+ self.termination_reason = attributes[:'termination_reason']
325
+ end
326
+
311
327
  if attributes.key?(:'bank_accounts')
312
328
  if (value = attributes[:'bank_accounts']).is_a?(Array)
313
329
  self.bank_accounts = value
@@ -386,6 +402,8 @@ module XeroRuby::PayrollAu
386
402
  return false if @date_of_birth.nil?
387
403
  gender_validator = EnumAttributeValidator.new('String', ["N", "M", "F", "I"])
388
404
  return false unless gender_validator.valid?(@gender)
405
+ termination_reason_validator = EnumAttributeValidator.new('String', ["V", "I", "D", "R", "F", "C", "T"])
406
+ return false unless termination_reason_validator.valid?(@termination_reason)
389
407
  true
390
408
  end
391
409
 
@@ -399,6 +417,16 @@ module XeroRuby::PayrollAu
399
417
  @gender = gender
400
418
  end
401
419
 
420
+ # Custom attribute writer method checking allowed values (enum).
421
+ # @param [Object] termination_reason Object to be assigned
422
+ def termination_reason=(termination_reason)
423
+ validator = EnumAttributeValidator.new('String', ["V", "I", "D", "R", "F", "C", "T"])
424
+ unless validator.valid?(termination_reason)
425
+ fail ArgumentError, "invalid value for \"termination_reason\", must be one of #{validator.allowable_values}."
426
+ end
427
+ @termination_reason = termination_reason
428
+ end
429
+
402
430
  # Checks equality by comparing each attribute.
403
431
  # @param [Object] Object to be compared
404
432
  def ==(o)
@@ -425,6 +453,7 @@ module XeroRuby::PayrollAu
425
453
  employee_group_name == o.employee_group_name &&
426
454
  employee_id == o.employee_id &&
427
455
  termination_date == o.termination_date &&
456
+ termination_reason == o.termination_reason &&
428
457
  bank_accounts == o.bank_accounts &&
429
458
  pay_template == o.pay_template &&
430
459
  opening_balances == o.opening_balances &&
@@ -446,7 +475,7 @@ module XeroRuby::PayrollAu
446
475
  # Calculates hash code according to all attributes.
447
476
  # @return [Integer] Hash code
448
477
  def hash
449
- [first_name, last_name, date_of_birth, home_address, start_date, title, middle_names, email, gender, phone, mobile, twitter_user_name, is_authorised_to_approve_leave, is_authorised_to_approve_timesheets, job_title, classification, ordinary_earnings_rate_id, payroll_calendar_id, employee_group_name, employee_id, termination_date, bank_accounts, pay_template, opening_balances, tax_declaration, leave_balances, leave_lines, super_memberships, status, updated_date_utc, validation_errors].hash
478
+ [first_name, last_name, date_of_birth, home_address, start_date, title, middle_names, email, gender, phone, mobile, twitter_user_name, is_authorised_to_approve_leave, is_authorised_to_approve_timesheets, job_title, classification, ordinary_earnings_rate_id, payroll_calendar_id, employee_group_name, employee_id, termination_date, termination_reason, bank_accounts, pay_template, opening_balances, tax_declaration, leave_balances, leave_lines, super_memberships, status, updated_date_utc, validation_errors].hash
450
479
  end
451
480
 
452
481
  # Builds the object from hash
@@ -19,6 +19,7 @@ module XeroRuby::PayrollAu
19
19
  ETPRMANUAL = "ETPRMANUAL".freeze
20
20
  SCHEDULE5_MANUAL = "SCHEDULE5MANUAL".freeze
21
21
  SCHEDULE5_STSLMANUAL = "SCHEDULE5STSLMANUAL".freeze
22
+ SCHEDULE4_MANUAL = "SCHEDULE4MANUAL".freeze
22
23
 
23
24
  # Builds the enum from string
24
25
  # @param [String] The enum value in the form of the string