change_healthcare-professional_claims 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +30 -0
- data/.travis.yml +6 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +0 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +118 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +8 -0
- data/TODO.md +8 -0
- data/bin/console +15 -0
- data/bin/rspec +29 -0
- data/bin/setup +8 -0
- data/change_healthcare-professional_claims.gemspec +43 -0
- data/lib/change_healthcare/professional_claims.rb +16 -0
- data/lib/change_healthcare/professional_claims/swagger_client.rb +106 -0
- data/lib/change_healthcare/professional_claims/swagger_client/api_client.rb +390 -0
- data/lib/change_healthcare/professional_claims/swagger_client/api_error.rb +42 -0
- data/lib/change_healthcare/professional_claims/swagger_client/configuration.rb +204 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/address.rb +219 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/ambulance_certification.rb +247 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/ambulance_transport_information.rb +259 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/clai_request.rb +283 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/claim_adjustment.rb +244 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/claim_adjustment_details.rb +199 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/claim_contract_information.rb +265 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/claim_date_information.rb +298 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/claim_information.rb +579 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/claim_note.rb +216 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/claim_pricing_repricing_information.rb +363 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/claim_reference.rb +231 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/claim_submission_request.rb +278 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/claim_supplemental_information.rb +315 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/composite_diagnosis_code_pointers.rb +191 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/condition_indicator_durable_medical_equipment.rb +281 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/condition_information.rb +190 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/contact_information.rb +209 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/contract_information.rb +255 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/dependent.rb +294 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/drug_identification.rb +278 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/durable_medical_equipment_certificate_of_medical_necessity.rb +226 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/durable_medical_equipment_certification.rb +233 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/durable_medical_equipment_service.rb +243 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/edit_response.rb +251 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/epsdt_referral.rb +236 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/error.rb +214 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/failure.rb +194 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/form_identification.rb +240 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/health_care_information.rb +233 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/line_adjudication_information.rb +284 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/measurements.rb +256 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/medicare_outpatient_adjudication.rb +213 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/other_payer_billing_provider.rb +236 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/other_payer_name.rb +285 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/other_payer_referring_provider.rb +192 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/other_payer_rendering_provider.rb +236 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/other_payer_service_facility_location.rb +192 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/other_payer_supervising_provider.rb +192 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/other_subscriber_information.rb +430 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/other_subscriber_name.rb +288 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/patient_condition_information_vision.rb +259 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/pay_to_plan.rb +278 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/payer.rb +194 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/prior_authorization.rb +194 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/professional_service.rb +290 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/provider.rb +281 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/purchased_service_information.rb +194 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/raw_x12_request.rb +194 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/receiver.rb +189 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/reference_identification.rb +199 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/report_information.rb +261 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/response.rb +240 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/service_facility_location.rb +224 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/service_line.rb +388 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/service_line_date_information.rb +236 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/service_line_provider.rb +293 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/service_line_reference_information.rb +230 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/spinal_manipulation_service_information.rb +238 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/submitter.rb +209 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/subscriber.rb +309 -0
- data/lib/change_healthcare/professional_claims/swagger_client/models/supporting_documentation.rb +249 -0
- data/lib/change_healthcare/professional_claims/swagger_client/professional_claims_api.rb +361 -0
- data/lib/change_healthcare/professional_claims/swagger_client/version.rb +19 -0
- data/lib/change_healthcare/professional_claims/version.rb +7 -0
- data/lib/change_healthcare/professional_claims/wrapper.rb +141 -0
- metadata +274 -0
@@ -0,0 +1,278 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# #Medical Network Professional Claims v3
|
4
|
+
#
|
5
|
+
# Reference for developers
|
6
|
+
#
|
7
|
+
# OpenAPI spec version: v3
|
8
|
+
#
|
9
|
+
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
10
|
+
# Swagger Codegen version: 2.4.19
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module ChangeHealthcare
|
16
|
+
module ProfessionalClaims
|
17
|
+
module SwaggerClient
|
18
|
+
class PayToPlan
|
19
|
+
attr_accessor :address, :organization_name, :primary_identifier, :secondary_identifier,
|
20
|
+
:tax_identification_number
|
21
|
+
|
22
|
+
# Allowed Values are: 'PI' Payer Identification, 'XV' Health Plan ID (HPID) or Other Entity Identifier (OEID)
|
23
|
+
attr_accessor :primary_identifier_type_code
|
24
|
+
|
25
|
+
# Allowed Values are: '2U' Payer Identification Number, 'FY' Claim Office Number, 'NF' National Association of Insurance Commissioners (NAIC) Code
|
26
|
+
attr_accessor :secondary_identifier_type_code
|
27
|
+
|
28
|
+
class EnumAttributeValidator
|
29
|
+
attr_reader :datatype, :allowable_values
|
30
|
+
|
31
|
+
def initialize(datatype, allowable_values)
|
32
|
+
@allowable_values = allowable_values.map do |value|
|
33
|
+
case datatype.to_s
|
34
|
+
when /Integer/i
|
35
|
+
value.to_i
|
36
|
+
when /Float/i
|
37
|
+
value.to_f
|
38
|
+
else
|
39
|
+
value
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def valid?(value)
|
45
|
+
!value || allowable_values.include?(value)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
address: :address,
|
53
|
+
organization_name: :organizationName,
|
54
|
+
primary_identifier: :primaryIdentifier,
|
55
|
+
primary_identifier_type_code: :primaryIdentifierTypeCode,
|
56
|
+
secondary_identifier: :secondaryIdentifier,
|
57
|
+
secondary_identifier_type_code: :secondaryIdentifierTypeCode,
|
58
|
+
tax_identification_number: :taxIdentificationNumber
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
# Attribute type mapping.
|
63
|
+
def self.swagger_types
|
64
|
+
{
|
65
|
+
address: :Address,
|
66
|
+
organization_name: :String,
|
67
|
+
primary_identifier: :String,
|
68
|
+
primary_identifier_type_code: :String,
|
69
|
+
secondary_identifier: :String,
|
70
|
+
secondary_identifier_type_code: :String,
|
71
|
+
tax_identification_number: :String
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
# Initializes the object
|
76
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
77
|
+
def initialize(attributes = {})
|
78
|
+
return unless attributes.is_a?(Hash)
|
79
|
+
|
80
|
+
# convert string to symbol for hash key
|
81
|
+
attributes = attributes.transform_keys(&:to_sym)
|
82
|
+
|
83
|
+
self.address = attributes[:address] if attributes.key?(:address)
|
84
|
+
|
85
|
+
self.organization_name = attributes[:organizationName] if attributes.key?(:organizationName)
|
86
|
+
|
87
|
+
self.primary_identifier = attributes[:primaryIdentifier] if attributes.key?(:primaryIdentifier)
|
88
|
+
|
89
|
+
self.primary_identifier_type_code = attributes[:primaryIdentifierTypeCode] if attributes.key?(:primaryIdentifierTypeCode)
|
90
|
+
|
91
|
+
self.secondary_identifier = attributes[:secondaryIdentifier] if attributes.key?(:secondaryIdentifier)
|
92
|
+
|
93
|
+
self.secondary_identifier_type_code = attributes[:secondaryIdentifierTypeCode] if attributes.key?(:secondaryIdentifierTypeCode)
|
94
|
+
|
95
|
+
self.tax_identification_number = attributes[:taxIdentificationNumber] if attributes.key?(:taxIdentificationNumber)
|
96
|
+
end
|
97
|
+
|
98
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
99
|
+
# @return Array for valid properties with the reasons
|
100
|
+
def list_invalid_properties
|
101
|
+
[]
|
102
|
+
end
|
103
|
+
|
104
|
+
# Check to see if the all the properties in the model are valid
|
105
|
+
# @return true if the model is valid
|
106
|
+
def valid?
|
107
|
+
primary_identifier_type_code_validator = EnumAttributeValidator.new('String', %w[PI XV])
|
108
|
+
return false unless primary_identifier_type_code_validator.valid?(@primary_identifier_type_code)
|
109
|
+
|
110
|
+
secondary_identifier_type_code_validator = EnumAttributeValidator.new('String', %w[2U FY NF])
|
111
|
+
return false unless secondary_identifier_type_code_validator.valid?(@secondary_identifier_type_code)
|
112
|
+
|
113
|
+
true
|
114
|
+
end
|
115
|
+
|
116
|
+
# Custom attribute writer method checking allowed values (enum).
|
117
|
+
# @param [Object] primary_identifier_type_code Object to be assigned
|
118
|
+
def primary_identifier_type_code=(primary_identifier_type_code)
|
119
|
+
validator = EnumAttributeValidator.new('String', %w[PI XV])
|
120
|
+
unless validator.valid?(primary_identifier_type_code)
|
121
|
+
raise ArgumentError,
|
122
|
+
%(invalid value for "primary_identifier_type_code", must be one of #{validator.allowable_values}.)
|
123
|
+
end
|
124
|
+
|
125
|
+
@primary_identifier_type_code = primary_identifier_type_code
|
126
|
+
end
|
127
|
+
|
128
|
+
# Custom attribute writer method checking allowed values (enum).
|
129
|
+
# @param [Object] secondary_identifier_type_code Object to be assigned
|
130
|
+
def secondary_identifier_type_code=(secondary_identifier_type_code)
|
131
|
+
validator = EnumAttributeValidator.new('String', %w[2U FY NF])
|
132
|
+
unless validator.valid?(secondary_identifier_type_code)
|
133
|
+
raise ArgumentError,
|
134
|
+
%(invalid value for "secondary_identifier_type_code", must be one of #{validator.allowable_values}.)
|
135
|
+
end
|
136
|
+
|
137
|
+
@secondary_identifier_type_code = secondary_identifier_type_code
|
138
|
+
end
|
139
|
+
|
140
|
+
# Checks equality by comparing each attribute.
|
141
|
+
# @param [Object] Object to be compared
|
142
|
+
def ==(other)
|
143
|
+
return true if equal?(other)
|
144
|
+
|
145
|
+
self.class == other.class &&
|
146
|
+
address == other.address &&
|
147
|
+
organization_name == other.organization_name &&
|
148
|
+
primary_identifier == other.primary_identifier &&
|
149
|
+
primary_identifier_type_code == other.primary_identifier_type_code &&
|
150
|
+
secondary_identifier == other.secondary_identifier &&
|
151
|
+
secondary_identifier_type_code == other.secondary_identifier_type_code &&
|
152
|
+
tax_identification_number == other.tax_identification_number
|
153
|
+
end
|
154
|
+
|
155
|
+
# @see the `==` method
|
156
|
+
# @param [Object] Object to be compared
|
157
|
+
def eql?(other)
|
158
|
+
self == other
|
159
|
+
end
|
160
|
+
|
161
|
+
# Calculates hash code according to all attributes.
|
162
|
+
# @return [Fixnum] Hash code
|
163
|
+
def hash
|
164
|
+
[address, organization_name, primary_identifier, primary_identifier_type_code, secondary_identifier,
|
165
|
+
secondary_identifier_type_code, tax_identification_number].hash
|
166
|
+
end
|
167
|
+
|
168
|
+
# Builds the object from hash
|
169
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
170
|
+
# @return [Object] Returns the model itself
|
171
|
+
def build_from_hash(attributes)
|
172
|
+
return nil unless attributes.is_a?(Hash)
|
173
|
+
|
174
|
+
self.class.swagger_types.each_pair do |key, type|
|
175
|
+
if type =~ /\AArray<(.*)>/i
|
176
|
+
# check to ensure the input is an array given that the attribute
|
177
|
+
# is documented as an array but the input is not
|
178
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
179
|
+
send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
|
180
|
+
_deserialize(Regexp.last_match(1), v)
|
181
|
+
end)
|
182
|
+
end
|
183
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
184
|
+
send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
self
|
189
|
+
end
|
190
|
+
|
191
|
+
# Deserializes the data based on type
|
192
|
+
# @param string type Data type
|
193
|
+
# @param string value Value to be deserialized
|
194
|
+
# @return [Object] Deserialized data
|
195
|
+
def _deserialize(type, value)
|
196
|
+
case type.to_sym
|
197
|
+
when :DateTime
|
198
|
+
DateTime.parse(value)
|
199
|
+
when :Date
|
200
|
+
Date.parse(value)
|
201
|
+
when :String
|
202
|
+
value.to_s
|
203
|
+
when :Integer
|
204
|
+
value.to_i
|
205
|
+
when :Float
|
206
|
+
value.to_f
|
207
|
+
when :BOOLEAN
|
208
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
209
|
+
true
|
210
|
+
else
|
211
|
+
false
|
212
|
+
end
|
213
|
+
when :Object
|
214
|
+
# generic object (usually a Hash), return directly
|
215
|
+
value
|
216
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
217
|
+
inner_type = Regexp.last_match[:inner_type]
|
218
|
+
value.map { |v| _deserialize(inner_type, v) }
|
219
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
220
|
+
k_type = Regexp.last_match[:k_type]
|
221
|
+
v_type = Regexp.last_match[:v_type]
|
222
|
+
{}.tap do |hash|
|
223
|
+
value.each do |k, v|
|
224
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
else # model
|
228
|
+
temp_model = SwaggerClient.const_get(type).new
|
229
|
+
temp_model.build_from_hash(value)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
# Returns the string representation of the object
|
234
|
+
# @return [String] String presentation of the object
|
235
|
+
def to_s
|
236
|
+
to_hash.to_s
|
237
|
+
end
|
238
|
+
|
239
|
+
# to_body is an alias to to_hash (backward compatibility)
|
240
|
+
# @return [Hash] Returns the object in the form of hash
|
241
|
+
def to_body
|
242
|
+
to_hash
|
243
|
+
end
|
244
|
+
|
245
|
+
# Returns the object in the form of hash
|
246
|
+
# @return [Hash] Returns the object in the form of hash
|
247
|
+
def to_hash
|
248
|
+
hash = {}
|
249
|
+
self.class.attribute_map.each_pair do |attr, param|
|
250
|
+
value = send(attr)
|
251
|
+
next if value.nil?
|
252
|
+
|
253
|
+
hash[param] = _to_hash(value)
|
254
|
+
end
|
255
|
+
hash
|
256
|
+
end
|
257
|
+
|
258
|
+
# Outputs non-array value in the form of hash
|
259
|
+
# For object, use to_hash. Otherwise, just return the value
|
260
|
+
# @param [Object] value Any valid value
|
261
|
+
# @return [Hash] Returns the value in the form of hash
|
262
|
+
def _to_hash(value)
|
263
|
+
if value.is_a?(Array)
|
264
|
+
value.compact.map { |v| _to_hash(v) }
|
265
|
+
elsif value.is_a?(Hash)
|
266
|
+
{}.tap do |hash|
|
267
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
268
|
+
end
|
269
|
+
elsif value.respond_to? :to_hash
|
270
|
+
value.to_hash
|
271
|
+
else
|
272
|
+
value
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
@@ -0,0 +1,194 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# #Medical Network Professional Claims v3
|
4
|
+
#
|
5
|
+
# Reference for developers
|
6
|
+
#
|
7
|
+
# OpenAPI spec version: v3
|
8
|
+
#
|
9
|
+
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
10
|
+
# Swagger Codegen version: 2.4.19
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module ChangeHealthcare
|
16
|
+
module ProfessionalClaims
|
17
|
+
module SwaggerClient
|
18
|
+
class Payer
|
19
|
+
attr_accessor :payer_id, :payer_name
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
payer_id: :payerID,
|
25
|
+
payer_name: :payerName
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.swagger_types
|
31
|
+
{
|
32
|
+
payer_id: :String,
|
33
|
+
payer_name: :String
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Initializes the object
|
38
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
39
|
+
def initialize(attributes = {})
|
40
|
+
return unless attributes.is_a?(Hash)
|
41
|
+
|
42
|
+
# convert string to symbol for hash key
|
43
|
+
attributes = attributes.transform_keys(&:to_sym)
|
44
|
+
|
45
|
+
self.payer_id = attributes[:payerID] if attributes.key?(:payerID)
|
46
|
+
|
47
|
+
self.payer_name = attributes[:payerName] if attributes.key?(:payerName)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
51
|
+
# @return Array for valid properties with the reasons
|
52
|
+
def list_invalid_properties
|
53
|
+
[]
|
54
|
+
end
|
55
|
+
|
56
|
+
# Check to see if the all the properties in the model are valid
|
57
|
+
# @return true if the model is valid
|
58
|
+
def valid?
|
59
|
+
true
|
60
|
+
end
|
61
|
+
|
62
|
+
# Checks equality by comparing each attribute.
|
63
|
+
# @param [Object] Object to be compared
|
64
|
+
def ==(other)
|
65
|
+
return true if equal?(other)
|
66
|
+
|
67
|
+
self.class == other.class &&
|
68
|
+
payer_id == other.payer_id &&
|
69
|
+
payer_name == other.payer_name
|
70
|
+
end
|
71
|
+
|
72
|
+
# @see the `==` method
|
73
|
+
# @param [Object] Object to be compared
|
74
|
+
def eql?(other)
|
75
|
+
self == other
|
76
|
+
end
|
77
|
+
|
78
|
+
# Calculates hash code according to all attributes.
|
79
|
+
# @return [Fixnum] Hash code
|
80
|
+
def hash
|
81
|
+
[payer_id, payer_name].hash
|
82
|
+
end
|
83
|
+
|
84
|
+
# Builds the object from hash
|
85
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
86
|
+
# @return [Object] Returns the model itself
|
87
|
+
def build_from_hash(attributes)
|
88
|
+
return nil unless attributes.is_a?(Hash)
|
89
|
+
|
90
|
+
self.class.swagger_types.each_pair do |key, type|
|
91
|
+
if type =~ /\AArray<(.*)>/i
|
92
|
+
# check to ensure the input is an array given that the attribute
|
93
|
+
# is documented as an array but the input is not
|
94
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
95
|
+
send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
|
96
|
+
_deserialize(Regexp.last_match(1), v)
|
97
|
+
end)
|
98
|
+
end
|
99
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
100
|
+
send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
self
|
105
|
+
end
|
106
|
+
|
107
|
+
# Deserializes the data based on type
|
108
|
+
# @param string type Data type
|
109
|
+
# @param string value Value to be deserialized
|
110
|
+
# @return [Object] Deserialized data
|
111
|
+
def _deserialize(type, value)
|
112
|
+
case type.to_sym
|
113
|
+
when :DateTime
|
114
|
+
DateTime.parse(value)
|
115
|
+
when :Date
|
116
|
+
Date.parse(value)
|
117
|
+
when :String
|
118
|
+
value.to_s
|
119
|
+
when :Integer
|
120
|
+
value.to_i
|
121
|
+
when :Float
|
122
|
+
value.to_f
|
123
|
+
when :BOOLEAN
|
124
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
125
|
+
true
|
126
|
+
else
|
127
|
+
false
|
128
|
+
end
|
129
|
+
when :Object
|
130
|
+
# generic object (usually a Hash), return directly
|
131
|
+
value
|
132
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
133
|
+
inner_type = Regexp.last_match[:inner_type]
|
134
|
+
value.map { |v| _deserialize(inner_type, v) }
|
135
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
136
|
+
k_type = Regexp.last_match[:k_type]
|
137
|
+
v_type = Regexp.last_match[:v_type]
|
138
|
+
{}.tap do |hash|
|
139
|
+
value.each do |k, v|
|
140
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
else # model
|
144
|
+
temp_model = SwaggerClient.const_get(type).new
|
145
|
+
temp_model.build_from_hash(value)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
# Returns the string representation of the object
|
150
|
+
# @return [String] String presentation of the object
|
151
|
+
def to_s
|
152
|
+
to_hash.to_s
|
153
|
+
end
|
154
|
+
|
155
|
+
# to_body is an alias to to_hash (backward compatibility)
|
156
|
+
# @return [Hash] Returns the object in the form of hash
|
157
|
+
def to_body
|
158
|
+
to_hash
|
159
|
+
end
|
160
|
+
|
161
|
+
# Returns the object in the form of hash
|
162
|
+
# @return [Hash] Returns the object in the form of hash
|
163
|
+
def to_hash
|
164
|
+
hash = {}
|
165
|
+
self.class.attribute_map.each_pair do |attr, param|
|
166
|
+
value = send(attr)
|
167
|
+
next if value.nil?
|
168
|
+
|
169
|
+
hash[param] = _to_hash(value)
|
170
|
+
end
|
171
|
+
hash
|
172
|
+
end
|
173
|
+
|
174
|
+
# Outputs non-array value in the form of hash
|
175
|
+
# For object, use to_hash. Otherwise, just return the value
|
176
|
+
# @param [Object] value Any valid value
|
177
|
+
# @return [Hash] Returns the value in the form of hash
|
178
|
+
def _to_hash(value)
|
179
|
+
if value.is_a?(Array)
|
180
|
+
value.compact.map { |v| _to_hash(v) }
|
181
|
+
elsif value.is_a?(Hash)
|
182
|
+
{}.tap do |hash|
|
183
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
184
|
+
end
|
185
|
+
elsif value.respond_to? :to_hash
|
186
|
+
value.to_hash
|
187
|
+
else
|
188
|
+
value
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|