merge_hris_client 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -2
- data/docs/AccountToken.md +3 -1
- data/docs/AvailableActions.md +1 -1
- data/docs/BenefitRequest.md +28 -0
- data/docs/BenefitsApi.md +78 -0
- data/docs/DeleteAccountApi.md +77 -0
- data/docs/Employee.md +8 -6
- data/docs/EmployeeRequest.md +62 -0
- data/docs/EmployeesApi.md +83 -1
- data/docs/EmploymentRequest.md +34 -0
- data/docs/EmploymentsApi.md +78 -0
- data/docs/EndUserDetailsRequest.md +1 -1
- data/docs/Issue.md +30 -0
- data/docs/IssueStatusEnum.md +15 -0
- data/docs/IssuesApi.md +167 -0
- data/docs/Location.md +1 -1
- data/docs/ModelOperation.md +3 -1
- data/docs/PaginatedIssueList.md +22 -0
- data/docs/PaginatedSyncStatusList.md +22 -0
- data/docs/PaginatedTimeOffBalanceList.md +22 -0
- data/docs/RemoteDataRequest.md +20 -0
- data/docs/SyncStatus.md +1 -1
- data/docs/SyncStatusApi.md +89 -11
- data/docs/SyncStatusStatusEnum.md +15 -0
- data/docs/Team.md +2 -0
- data/docs/TeamsApi.md +2 -0
- data/docs/TimeOff.md +4 -0
- data/docs/TimeOffBalance.md +28 -0
- data/docs/TimeOffBalanceApi.md +181 -0
- data/lib/merge_hris_client.rb +15 -4
- data/lib/merge_hris_client/api/account_token_api.rb +1 -1
- data/lib/merge_hris_client/api/available_actions_api.rb +1 -1
- data/lib/merge_hris_client/api/benefits_api.rb +70 -1
- data/lib/merge_hris_client/api/companies_api.rb +1 -1
- data/lib/merge_hris_client/api/delete_account_api.rb +82 -0
- data/lib/merge_hris_client/api/employee_payroll_runs_api.rb +1 -1
- data/lib/merge_hris_client/api/employees_api.rb +76 -1
- data/lib/merge_hris_client/api/employments_api.rb +70 -1
- data/lib/merge_hris_client/api/generate_key_api.rb +1 -1
- data/lib/merge_hris_client/api/issues_api.rb +169 -0
- data/lib/merge_hris_client/api/link_token_api.rb +1 -1
- data/lib/merge_hris_client/api/locations_api.rb +1 -1
- data/lib/merge_hris_client/api/passthrough_api.rb +1 -1
- data/lib/merge_hris_client/api/payroll_runs_api.rb +1 -1
- data/lib/merge_hris_client/api/regenerate_key_api.rb +1 -1
- data/lib/merge_hris_client/api/sync_status_api.rb +79 -11
- data/lib/merge_hris_client/api/teams_api.rb +4 -1
- data/lib/merge_hris_client/api/time_off_api.rb +1 -1
- data/lib/merge_hris_client/api/time_off_balance_api.rb +196 -0
- data/lib/merge_hris_client/api_client.rb +2 -2
- data/lib/merge_hris_client/api_error.rb +1 -1
- data/lib/merge_hris_client/configuration.rb +1 -1
- data/lib/merge_hris_client/models/account_integration.rb +1 -1
- data/lib/merge_hris_client/models/account_token.rb +19 -5
- data/lib/merge_hris_client/models/available_actions.rb +1 -1
- data/lib/merge_hris_client/models/benefit.rb +1 -1
- data/lib/merge_hris_client/models/benefit_plan_type_enum.rb +1 -1
- data/lib/merge_hris_client/models/benefit_request.rb +276 -0
- data/lib/merge_hris_client/models/company.rb +1 -1
- data/lib/merge_hris_client/models/country_enum.rb +1 -1
- data/lib/merge_hris_client/models/data_passthrough_request.rb +2 -1
- data/lib/merge_hris_client/models/deduction.rb +1 -1
- data/lib/merge_hris_client/models/earning.rb +1 -1
- data/lib/merge_hris_client/models/employee.rb +32 -20
- data/lib/merge_hris_client/models/employee_payroll_run.rb +1 -1
- data/lib/merge_hris_client/models/employee_request.rb +523 -0
- data/lib/merge_hris_client/models/employment.rb +1 -1
- data/lib/merge_hris_client/models/employment_request.rb +309 -0
- data/lib/merge_hris_client/models/employment_status_enum.rb +1 -1
- data/lib/merge_hris_client/models/employment_type_enum.rb +1 -1
- data/lib/merge_hris_client/models/end_user_details_request.rb +2 -6
- data/lib/merge_hris_client/models/ethnicity_enum.rb +1 -1
- data/lib/merge_hris_client/models/flsa_status_enum.rb +1 -1
- data/lib/merge_hris_client/models/gender_enum.rb +1 -1
- data/lib/merge_hris_client/models/generate_remote_key_request.rb +1 -1
- data/lib/merge_hris_client/models/issue.rb +281 -0
- data/lib/merge_hris_client/models/issue_status_enum.rb +36 -0
- data/lib/merge_hris_client/models/link_token.rb +1 -1
- data/lib/merge_hris_client/models/location.rb +4 -4
- data/lib/merge_hris_client/models/method_enum.rb +1 -1
- data/lib/merge_hris_client/models/model_operation.rb +21 -5
- data/lib/merge_hris_client/models/paginated_benefit_list.rb +1 -1
- data/lib/merge_hris_client/models/paginated_company_list.rb +1 -1
- data/lib/merge_hris_client/models/paginated_employee_list.rb +1 -1
- data/lib/merge_hris_client/models/paginated_employee_payroll_run_list.rb +1 -1
- data/lib/merge_hris_client/models/paginated_employment_list.rb +1 -1
- data/lib/merge_hris_client/models/paginated_issue_list.rb +240 -0
- data/lib/merge_hris_client/models/paginated_location_list.rb +1 -1
- data/lib/merge_hris_client/models/paginated_payroll_run_list.rb +1 -1
- data/lib/merge_hris_client/models/paginated_sync_status_list.rb +240 -0
- data/lib/merge_hris_client/models/paginated_team_list.rb +1 -1
- data/lib/merge_hris_client/models/paginated_time_off_balance_list.rb +240 -0
- data/lib/merge_hris_client/models/paginated_time_off_list.rb +1 -1
- data/lib/merge_hris_client/models/pay_currency_enum.rb +1 -1
- data/lib/merge_hris_client/models/pay_frequency_enum.rb +1 -1
- data/lib/merge_hris_client/models/pay_period_enum.rb +1 -1
- data/lib/merge_hris_client/models/payroll_run.rb +1 -1
- data/lib/merge_hris_client/models/remote_data.rb +1 -1
- data/lib/merge_hris_client/models/remote_data_request.rb +234 -0
- data/lib/merge_hris_client/models/remote_key.rb +1 -1
- data/lib/merge_hris_client/models/remote_key_for_regeneration_request.rb +1 -1
- data/lib/merge_hris_client/models/remote_response.rb +1 -1
- data/lib/merge_hris_client/models/request_type_enum.rb +1 -1
- data/lib/merge_hris_client/models/run_state_enum.rb +1 -1
- data/lib/merge_hris_client/models/run_type_enum.rb +1 -1
- data/lib/merge_hris_client/models/sync_status.rb +2 -2
- data/lib/merge_hris_client/models/sync_status_status_enum.rb +37 -0
- data/lib/merge_hris_client/models/tax.rb +1 -1
- data/lib/merge_hris_client/models/team.rb +13 -2
- data/lib/merge_hris_client/models/time_off.rb +24 -2
- data/lib/merge_hris_client/models/time_off_balance.rb +275 -0
- data/lib/merge_hris_client/models/time_off_status_enum.rb +1 -1
- data/lib/merge_hris_client/models/type_enum.rb +1 -1
- data/lib/merge_hris_client/models/units_enum.rb +1 -1
- data/lib/merge_hris_client/version.rb +2 -2
- data/merge_hris_client-1.0.1.gem +0 -0
- data/merge_hris_client.gemspec +1 -1
- data/spec/api/delete_account_api_spec.rb +46 -0
- data/spec/api/generate_key_api_spec.rb +46 -0
- data/spec/api/issues_api_spec.rb +65 -0
- data/spec/api/sync_status_api_spec.rb +59 -0
- data/spec/api/time_off_balance_api_spec.rb +70 -0
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/benefit_request_spec.rb +64 -0
- data/spec/models/employee_request_spec.rb +160 -0
- data/spec/models/employment_request_spec.rb +82 -0
- data/spec/models/generate_remote_key_request_spec.rb +34 -0
- data/spec/models/issue_spec.rb +70 -0
- data/spec/models/issue_status_enum_spec.rb +28 -0
- data/spec/models/paginated_issue_list_spec.rb +46 -0
- data/spec/models/paginated_sync_status_list_spec.rb +46 -0
- data/spec/models/paginated_time_off_balance_list_spec.rb +46 -0
- data/spec/models/remote_data_request_spec.rb +40 -0
- data/spec/models/sync_status_spec.rb +64 -0
- data/spec/models/sync_status_status_enum_spec.rb +28 -0
- data/spec/models/time_off_balance_spec.rb +64 -0
- data/spec/spec_helper.rb +1 -1
- data/test_ruby.rb +14 -11
- metadata +67 -2
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
Contact: hello@merge.dev
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 5.
|
9
|
+
OpenAPI Generator version: 5.1.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -308,7 +308,7 @@ module MergeHRISClient
|
|
308
308
|
case auth_setting[:in]
|
309
309
|
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
310
310
|
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
311
|
-
else fail ArgumentError, 'Authentication token must be in `query`
|
311
|
+
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
|
312
312
|
end
|
313
313
|
end
|
314
314
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
Contact: hello@merge.dev
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 5.
|
9
|
+
OpenAPI Generator version: 5.1.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -17,10 +17,13 @@ module MergeHRISClient
|
|
17
17
|
class AccountToken
|
18
18
|
attr_accessor :account_token
|
19
19
|
|
20
|
+
attr_accessor :integration
|
21
|
+
|
20
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
21
23
|
def self.attribute_map
|
22
24
|
{
|
23
|
-
:'account_token' => :'account_token'
|
25
|
+
:'account_token' => :'account_token',
|
26
|
+
:'integration' => :'integration'
|
24
27
|
}
|
25
28
|
end
|
26
29
|
|
@@ -32,7 +35,8 @@ module MergeHRISClient
|
|
32
35
|
# Attribute type mapping.
|
33
36
|
def self.openapi_types
|
34
37
|
{
|
35
|
-
:'account_token' => :'String'
|
38
|
+
:'account_token' => :'String',
|
39
|
+
:'integration' => :'AccountIntegration'
|
36
40
|
}
|
37
41
|
end
|
38
42
|
|
@@ -60,6 +64,10 @@ module MergeHRISClient
|
|
60
64
|
if attributes.key?(:'account_token')
|
61
65
|
self.account_token = attributes[:'account_token']
|
62
66
|
end
|
67
|
+
|
68
|
+
if attributes.key?(:'integration')
|
69
|
+
self.integration = attributes[:'integration']
|
70
|
+
end
|
63
71
|
end
|
64
72
|
|
65
73
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -70,6 +78,10 @@ module MergeHRISClient
|
|
70
78
|
invalid_properties.push('invalid value for "account_token", account_token cannot be nil.')
|
71
79
|
end
|
72
80
|
|
81
|
+
if @integration.nil?
|
82
|
+
invalid_properties.push('invalid value for "integration", integration cannot be nil.')
|
83
|
+
end
|
84
|
+
|
73
85
|
invalid_properties
|
74
86
|
end
|
75
87
|
|
@@ -77,6 +89,7 @@ module MergeHRISClient
|
|
77
89
|
# @return true if the model is valid
|
78
90
|
def valid?
|
79
91
|
return false if @account_token.nil?
|
92
|
+
return false if @integration.nil?
|
80
93
|
true
|
81
94
|
end
|
82
95
|
|
@@ -85,7 +98,8 @@ module MergeHRISClient
|
|
85
98
|
def ==(o)
|
86
99
|
return true if self.equal?(o)
|
87
100
|
self.class == o.class &&
|
88
|
-
account_token == o.account_token
|
101
|
+
account_token == o.account_token &&
|
102
|
+
integration == o.integration
|
89
103
|
end
|
90
104
|
|
91
105
|
# @see the `==` method
|
@@ -97,7 +111,7 @@ module MergeHRISClient
|
|
97
111
|
# Calculates hash code according to all attributes.
|
98
112
|
# @return [Integer] Hash code
|
99
113
|
def hash
|
100
|
-
[account_token].hash
|
114
|
+
[account_token, integration].hash
|
101
115
|
end
|
102
116
|
|
103
117
|
# Builds the object from hash
|
@@ -0,0 +1,276 @@
|
|
1
|
+
=begin
|
2
|
+
#Merge HRIS API
|
3
|
+
|
4
|
+
#The unified API for building rich integrations with multiple HR Information System platforms.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
Contact: hello@merge.dev
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.1.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MergeHRISClient
|
17
|
+
# # The Benefit Object ### Description The `Benefit` object is used to represent a Benefit for an employee. ### Usage Example Fetch from the `LIST Benefits` endpoint and filter by `ID` to show all benefits.
|
18
|
+
class BenefitRequest
|
19
|
+
# The third-party API ID of the matching object.
|
20
|
+
attr_accessor :remote_id
|
21
|
+
|
22
|
+
# The employee on the plan.
|
23
|
+
attr_accessor :employee
|
24
|
+
|
25
|
+
# The name of the benefit provider.
|
26
|
+
attr_accessor :provider_name
|
27
|
+
|
28
|
+
# The type of benefit plan
|
29
|
+
attr_accessor :benefit_plan_type
|
30
|
+
|
31
|
+
# The employee's contribution.
|
32
|
+
attr_accessor :employee_contribution
|
33
|
+
|
34
|
+
# The company's contribution.
|
35
|
+
attr_accessor :company_contribution
|
36
|
+
|
37
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
38
|
+
def self.attribute_map
|
39
|
+
{
|
40
|
+
:'remote_id' => :'remote_id',
|
41
|
+
:'employee' => :'employee',
|
42
|
+
:'provider_name' => :'provider_name',
|
43
|
+
:'benefit_plan_type' => :'benefit_plan_type',
|
44
|
+
:'employee_contribution' => :'employee_contribution',
|
45
|
+
:'company_contribution' => :'company_contribution'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Returns all the JSON keys this model knows about
|
50
|
+
def self.acceptable_attributes
|
51
|
+
attribute_map.values
|
52
|
+
end
|
53
|
+
|
54
|
+
# Attribute type mapping.
|
55
|
+
def self.openapi_types
|
56
|
+
{
|
57
|
+
:'remote_id' => :'String',
|
58
|
+
:'employee' => :'String',
|
59
|
+
:'provider_name' => :'String',
|
60
|
+
:'benefit_plan_type' => :'BenefitPlanTypeEnum',
|
61
|
+
:'employee_contribution' => :'Float',
|
62
|
+
:'company_contribution' => :'Float'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# List of attributes with nullable: true
|
67
|
+
def self.openapi_nullable
|
68
|
+
Set.new([
|
69
|
+
:'remote_id',
|
70
|
+
:'employee',
|
71
|
+
:'provider_name',
|
72
|
+
:'benefit_plan_type',
|
73
|
+
:'employee_contribution',
|
74
|
+
:'company_contribution'
|
75
|
+
])
|
76
|
+
end
|
77
|
+
|
78
|
+
# Initializes the object
|
79
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
80
|
+
def initialize(attributes = {})
|
81
|
+
if (!attributes.is_a?(Hash))
|
82
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MergeHRISClient::BenefitRequest` initialize method"
|
83
|
+
end
|
84
|
+
|
85
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
86
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
87
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
88
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MergeHRISClient::BenefitRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
89
|
+
end
|
90
|
+
h[k.to_sym] = v
|
91
|
+
}
|
92
|
+
|
93
|
+
if attributes.key?(:'remote_id')
|
94
|
+
self.remote_id = attributes[:'remote_id']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:'employee')
|
98
|
+
self.employee = attributes[:'employee']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'provider_name')
|
102
|
+
self.provider_name = attributes[:'provider_name']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'benefit_plan_type')
|
106
|
+
self.benefit_plan_type = attributes[:'benefit_plan_type']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'employee_contribution')
|
110
|
+
self.employee_contribution = attributes[:'employee_contribution']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'company_contribution')
|
114
|
+
self.company_contribution = attributes[:'company_contribution']
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
119
|
+
# @return Array for valid properties with the reasons
|
120
|
+
def list_invalid_properties
|
121
|
+
invalid_properties = Array.new
|
122
|
+
invalid_properties
|
123
|
+
end
|
124
|
+
|
125
|
+
# Check to see if the all the properties in the model are valid
|
126
|
+
# @return true if the model is valid
|
127
|
+
def valid?
|
128
|
+
true
|
129
|
+
end
|
130
|
+
|
131
|
+
# Checks equality by comparing each attribute.
|
132
|
+
# @param [Object] Object to be compared
|
133
|
+
def ==(o)
|
134
|
+
return true if self.equal?(o)
|
135
|
+
self.class == o.class &&
|
136
|
+
remote_id == o.remote_id &&
|
137
|
+
employee == o.employee &&
|
138
|
+
provider_name == o.provider_name &&
|
139
|
+
benefit_plan_type == o.benefit_plan_type &&
|
140
|
+
employee_contribution == o.employee_contribution &&
|
141
|
+
company_contribution == o.company_contribution
|
142
|
+
end
|
143
|
+
|
144
|
+
# @see the `==` method
|
145
|
+
# @param [Object] Object to be compared
|
146
|
+
def eql?(o)
|
147
|
+
self == o
|
148
|
+
end
|
149
|
+
|
150
|
+
# Calculates hash code according to all attributes.
|
151
|
+
# @return [Integer] Hash code
|
152
|
+
def hash
|
153
|
+
[remote_id, employee, provider_name, benefit_plan_type, employee_contribution, company_contribution].hash
|
154
|
+
end
|
155
|
+
|
156
|
+
# Builds the object from hash
|
157
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
158
|
+
# @return [Object] Returns the model itself
|
159
|
+
def self.build_from_hash(attributes)
|
160
|
+
new.build_from_hash(attributes)
|
161
|
+
end
|
162
|
+
|
163
|
+
# Builds the object from hash
|
164
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
165
|
+
# @return [Object] Returns the model itself
|
166
|
+
def build_from_hash(attributes)
|
167
|
+
return nil unless attributes.is_a?(Hash)
|
168
|
+
self.class.openapi_types.each_pair do |key, type|
|
169
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
170
|
+
self.send("#{key}=", nil)
|
171
|
+
elsif type =~ /\AArray<(.*)>/i
|
172
|
+
# check to ensure the input is an array given that the attribute
|
173
|
+
# is documented as an array but the input is not
|
174
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
175
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
176
|
+
end
|
177
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
178
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
self
|
183
|
+
end
|
184
|
+
|
185
|
+
# Deserializes the data based on type
|
186
|
+
# @param string type Data type
|
187
|
+
# @param string value Value to be deserialized
|
188
|
+
# @return [Object] Deserialized data
|
189
|
+
def _deserialize(type, value)
|
190
|
+
case type.to_sym
|
191
|
+
when :Time
|
192
|
+
Time.parse(value)
|
193
|
+
when :Date
|
194
|
+
Date.parse(value)
|
195
|
+
when :String
|
196
|
+
value.to_s
|
197
|
+
when :Integer
|
198
|
+
value.to_i
|
199
|
+
when :Float
|
200
|
+
value.to_f
|
201
|
+
when :Boolean
|
202
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
203
|
+
true
|
204
|
+
else
|
205
|
+
false
|
206
|
+
end
|
207
|
+
when :Object
|
208
|
+
# generic object (usually a Hash), return directly
|
209
|
+
value
|
210
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
211
|
+
inner_type = Regexp.last_match[:inner_type]
|
212
|
+
value.map { |v| _deserialize(inner_type, v) }
|
213
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
214
|
+
k_type = Regexp.last_match[:k_type]
|
215
|
+
v_type = Regexp.last_match[:v_type]
|
216
|
+
{}.tap do |hash|
|
217
|
+
value.each do |k, v|
|
218
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
else # model
|
222
|
+
# models (e.g. Pet) or oneOf
|
223
|
+
klass = MergeHRISClient.const_get(type)
|
224
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# Returns the string representation of the object
|
229
|
+
# @return [String] String presentation of the object
|
230
|
+
def to_s
|
231
|
+
to_hash.to_s
|
232
|
+
end
|
233
|
+
|
234
|
+
# to_body is an alias to to_hash (backward compatibility)
|
235
|
+
# @return [Hash] Returns the object in the form of hash
|
236
|
+
def to_body
|
237
|
+
to_hash
|
238
|
+
end
|
239
|
+
|
240
|
+
# Returns the object in the form of hash
|
241
|
+
# @return [Hash] Returns the object in the form of hash
|
242
|
+
def to_hash
|
243
|
+
hash = {}
|
244
|
+
self.class.attribute_map.each_pair do |attr, param|
|
245
|
+
value = self.send(attr)
|
246
|
+
if value.nil?
|
247
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
248
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
249
|
+
end
|
250
|
+
|
251
|
+
hash[param] = _to_hash(value)
|
252
|
+
end
|
253
|
+
hash
|
254
|
+
end
|
255
|
+
|
256
|
+
# Outputs non-array value in the form of hash
|
257
|
+
# For object, use to_hash. Otherwise, just return the value
|
258
|
+
# @param [Object] value Any valid value
|
259
|
+
# @return [Hash] Returns the value in the form of hash
|
260
|
+
def _to_hash(value)
|
261
|
+
if value.is_a?(Array)
|
262
|
+
value.compact.map { |v| _to_hash(v) }
|
263
|
+
elsif value.is_a?(Hash)
|
264
|
+
{}.tap do |hash|
|
265
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
266
|
+
end
|
267
|
+
elsif value.respond_to? :to_hash
|
268
|
+
value.to_hash
|
269
|
+
else
|
270
|
+
value
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
end
|
275
|
+
|
276
|
+
end
|