vericred_client 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/docs/Applicant.md +2 -2
  4. data/docs/{InlineResponse2001.md → Base.md} +2 -2
  5. data/docs/Carrier.md +1 -1
  6. data/docs/County.md +3 -3
  7. data/docs/CountyBulk.md +10 -0
  8. data/docs/Drug.md +2 -1
  9. data/docs/DrugCoverage.md +4 -4
  10. data/docs/DrugCoverageResponse.md +9 -0
  11. data/docs/DrugPackage.md +9 -0
  12. data/docs/DrugSearchResponse.md +9 -0
  13. data/docs/DrugsApi.md +59 -0
  14. data/docs/Meta.md +8 -0
  15. data/docs/Plan.md +22 -6
  16. data/docs/PlanCounty.md +1 -1
  17. data/docs/PlanCountyBulk.md +10 -0
  18. data/docs/PlanFindResponse.md +9 -0
  19. data/docs/PlanSearchResult.md +26 -8
  20. data/docs/PlansApi.md +11 -11
  21. data/docs/Pricing.md +7 -1
  22. data/docs/Provider.md +9 -6
  23. data/docs/ProviderResponse.md +10 -0
  24. data/docs/ProvidersApi.md +19 -21
  25. data/docs/RatingArea.md +2 -2
  26. data/docs/RequestPlanFind.md +15 -0
  27. data/docs/State.md +4 -4
  28. data/docs/ZipCountiesApi.md +7 -8
  29. data/docs/ZipCountyBulk.md +11 -0
  30. data/docs/ZipCountyResponse.md +10 -0
  31. data/lib/vericred_client.rb +14 -6
  32. data/lib/vericred_client/api/{drug_coverage_api.rb → drugs_api.rb} +25 -19
  33. data/lib/vericred_client/api/plans_api.rb +14 -16
  34. data/lib/vericred_client/api/providers_api.rb +29 -29
  35. data/lib/vericred_client/api/zip_counties_api.rb +12 -12
  36. data/lib/vericred_client/api_client.rb +1 -1
  37. data/lib/vericred_client/api_error.rb +1 -1
  38. data/lib/vericred_client/models/applicant.rb +14 -12
  39. data/lib/vericred_client/models/{inline_response_200_1.rb → base.rb} +10 -9
  40. data/lib/vericred_client/models/carrier.rb +15 -15
  41. data/lib/vericred_client/models/carrier_subsidiary.rb +1 -1
  42. data/lib/vericred_client/models/county.rb +18 -14
  43. data/lib/vericred_client/models/county_bulk.rb +318 -0
  44. data/lib/vericred_client/models/drug.rb +27 -15
  45. data/lib/vericred_client/models/drug_coverage.rb +38 -32
  46. data/lib/vericred_client/models/drug_coverage_response.rb +310 -0
  47. data/lib/vericred_client/models/drug_package.rb +308 -0
  48. data/lib/vericred_client/models/drug_search_response.rb +310 -0
  49. data/lib/vericred_client/models/meta.rb +298 -0
  50. data/lib/vericred_client/models/plan.rb +196 -22
  51. data/lib/vericred_client/models/plan_county.rb +15 -15
  52. data/lib/vericred_client/models/plan_county_bulk.rb +318 -0
  53. data/lib/vericred_client/models/{inline_response_200.rb → plan_find_response.rb} +13 -11
  54. data/lib/vericred_client/models/plan_search_result.rb +236 -42
  55. data/lib/vericred_client/models/pricing.rb +63 -3
  56. data/lib/vericred_client/models/provider.rb +51 -9
  57. data/lib/vericred_client/models/provider_response.rb +322 -0
  58. data/lib/vericred_client/models/rating_area.rb +5 -5
  59. data/lib/vericred_client/models/{query.rb → request_plan_find.rb} +14 -6
  60. data/lib/vericred_client/models/state.rb +29 -25
  61. data/lib/vericred_client/models/zip_code.rb +1 -1
  62. data/lib/vericred_client/models/zip_county.rb +1 -1
  63. data/lib/vericred_client/models/zip_county_bulk.rb +328 -0
  64. data/lib/vericred_client/models/{inline_response_200_2.rb → zip_county_response.rb} +20 -17
  65. data/lib/vericred_client/version.rb +2 -2
  66. data/spec/api/{drug_coverage_api_spec.rb → drugs_api_spec.rb} +14 -17
  67. data/spec/api/plans_api_spec.rb +7 -69
  68. data/spec/api/providers_api_spec.rb +12 -28
  69. data/spec/api/zip_counties_api_spec.rb +6 -13
  70. metadata +31 -15
  71. data/docs/DrugCoverageApi.md +0 -54
  72. data/docs/InlineResponse200.md +0 -9
  73. data/docs/InlineResponse2002.md +0 -10
  74. data/docs/Query.md +0 -15
@@ -116,7 +116,7 @@ The response would be
116
116
 
117
117
 
118
118
 
119
- OpenAPI spec version:
119
+ OpenAPI spec version: 1.0.0
120
120
 
121
121
  Generated by: https://github.com/swagger-api/swagger-codegen.git
122
122
 
@@ -139,6 +139,24 @@ module VericredClient
139
139
  # Foreign key to plans
140
140
  attr_accessor :plan_id
141
141
 
142
+ # Child-only premium
143
+ attr_accessor :premium_child_only
144
+
145
+ # Family premium
146
+ attr_accessor :premium_family
147
+
148
+ # Single-person premium
149
+ attr_accessor :premium_single
150
+
151
+ # Single person including children premium
152
+ attr_accessor :premium_single_and_children
153
+
154
+ # Person with spouse premium
155
+ attr_accessor :premium_single_and_spouse
156
+
157
+ # Premium for single smoker
158
+ attr_accessor :premium_single_smoker
159
+
142
160
  # Foreign key to rating areas
143
161
  attr_accessor :rating_area_id
144
162
 
@@ -149,6 +167,12 @@ module VericredClient
149
167
  :'effective_date' => :'effective_date',
150
168
  :'expiration_date' => :'expiration_date',
151
169
  :'plan_id' => :'plan_id',
170
+ :'premium_child_only' => :'premium_child_only',
171
+ :'premium_family' => :'premium_family',
172
+ :'premium_single' => :'premium_single',
173
+ :'premium_single_and_children' => :'premium_single_and_children',
174
+ :'premium_single_and_spouse' => :'premium_single_and_spouse',
175
+ :'premium_single_smoker' => :'premium_single_smoker',
152
176
  :'rating_area_id' => :'rating_area_id'
153
177
  }
154
178
  end
@@ -160,7 +184,13 @@ module VericredClient
160
184
  :'effective_date' => :'Date',
161
185
  :'expiration_date' => :'Date',
162
186
  :'plan_id' => :'Integer',
163
- :'rating_area_id' => :'Integer'
187
+ :'premium_child_only' => :'Float',
188
+ :'premium_family' => :'Float',
189
+ :'premium_single' => :'Float',
190
+ :'premium_single_and_children' => :'Float',
191
+ :'premium_single_and_spouse' => :'Float',
192
+ :'premium_single_smoker' => :'Float',
193
+ :'rating_area_id' => :'String'
164
194
  }
165
195
  end
166
196
 
@@ -188,6 +218,30 @@ module VericredClient
188
218
  self.plan_id = attributes[:'plan_id']
189
219
  end
190
220
 
221
+ if attributes.has_key?(:'premium_child_only')
222
+ self.premium_child_only = attributes[:'premium_child_only']
223
+ end
224
+
225
+ if attributes.has_key?(:'premium_family')
226
+ self.premium_family = attributes[:'premium_family']
227
+ end
228
+
229
+ if attributes.has_key?(:'premium_single')
230
+ self.premium_single = attributes[:'premium_single']
231
+ end
232
+
233
+ if attributes.has_key?(:'premium_single_and_children')
234
+ self.premium_single_and_children = attributes[:'premium_single_and_children']
235
+ end
236
+
237
+ if attributes.has_key?(:'premium_single_and_spouse')
238
+ self.premium_single_and_spouse = attributes[:'premium_single_and_spouse']
239
+ end
240
+
241
+ if attributes.has_key?(:'premium_single_smoker')
242
+ self.premium_single_smoker = attributes[:'premium_single_smoker']
243
+ end
244
+
191
245
  if attributes.has_key?(:'rating_area_id')
192
246
  self.rating_area_id = attributes[:'rating_area_id']
193
247
  end
@@ -215,6 +269,12 @@ module VericredClient
215
269
  effective_date == o.effective_date &&
216
270
  expiration_date == o.expiration_date &&
217
271
  plan_id == o.plan_id &&
272
+ premium_child_only == o.premium_child_only &&
273
+ premium_family == o.premium_family &&
274
+ premium_single == o.premium_single &&
275
+ premium_single_and_children == o.premium_single_and_children &&
276
+ premium_single_and_spouse == o.premium_single_and_spouse &&
277
+ premium_single_smoker == o.premium_single_smoker &&
218
278
  rating_area_id == o.rating_area_id
219
279
  end
220
280
 
@@ -227,7 +287,7 @@ module VericredClient
227
287
  # Calculates hash code according to all attributes.
228
288
  # @return [Fixnum] Hash code
229
289
  def hash
230
- [age, effective_date, expiration_date, plan_id, rating_area_id].hash
290
+ [age, effective_date, expiration_date, plan_id, premium_child_only, premium_family, premium_single, premium_single_and_children, premium_single_and_spouse, premium_single_smoker, rating_area_id].hash
231
291
  end
232
292
 
233
293
  # Builds the object from hash
@@ -116,7 +116,7 @@ The response would be
116
116
 
117
117
 
118
118
 
119
- OpenAPI spec version:
119
+ OpenAPI spec version: 1.0.0
120
120
 
121
121
  Generated by: https://github.com/swagger-api/swagger-codegen.git
122
122
 
@@ -148,11 +148,14 @@ module VericredClient
148
148
  # Primary email address to contact the provider.
149
149
  attr_accessor :email
150
150
 
151
+ # Given name for the provider.
152
+ attr_accessor :first_name
153
+
151
154
  # Provider's gender (M or F)
152
155
  attr_accessor :gender
153
156
 
154
- # Given name for the provider.
155
- attr_accessor :first_name
157
+ # List of HIOS ids for this provider
158
+ attr_accessor :hios_ids
156
159
 
157
160
  # National Provider Index (NPI) number
158
161
  attr_accessor :id
@@ -160,6 +163,12 @@ module VericredClient
160
163
  # Family name for the provider.
161
164
  attr_accessor :last_name
162
165
 
166
+ # Latitude of provider
167
+ attr_accessor :latitude
168
+
169
+ # Longitude of provider
170
+ attr_accessor :longitude
171
+
163
172
  # Middle name for the provider.
164
173
  attr_accessor :middle_name
165
174
 
@@ -209,10 +218,13 @@ module VericredClient
209
218
  :'accepting_referral_patients' => :'accepting_referral_patients',
210
219
  :'city' => :'city',
211
220
  :'email' => :'email',
212
- :'gender' => :'gender',
213
221
  :'first_name' => :'first_name',
222
+ :'gender' => :'gender',
223
+ :'hios_ids' => :'hios_ids',
214
224
  :'id' => :'id',
215
225
  :'last_name' => :'last_name',
226
+ :'latitude' => :'latitude',
227
+ :'longitude' => :'longitude',
216
228
  :'middle_name' => :'middle_name',
217
229
  :'personal_phone' => :'personal_phone',
218
230
  :'phone' => :'phone',
@@ -239,10 +251,13 @@ module VericredClient
239
251
  :'accepting_referral_patients' => :'BOOLEAN',
240
252
  :'city' => :'String',
241
253
  :'email' => :'String',
242
- :'gender' => :'String',
243
254
  :'first_name' => :'String',
255
+ :'gender' => :'String',
256
+ :'hios_ids' => :'Array<String>',
244
257
  :'id' => :'Integer',
245
258
  :'last_name' => :'String',
259
+ :'latitude' => :'Float',
260
+ :'longitude' => :'Float',
246
261
  :'middle_name' => :'String',
247
262
  :'personal_phone' => :'String',
248
263
  :'phone' => :'String',
@@ -269,22 +284,32 @@ module VericredClient
269
284
 
270
285
  if attributes.has_key?(:'accepting_change_of_payor_patients')
271
286
  self.accepting_change_of_payor_patients = attributes[:'accepting_change_of_payor_patients']
287
+ else
288
+ self.accepting_change_of_payor_patients = false
272
289
  end
273
290
 
274
291
  if attributes.has_key?(:'accepting_medicaid_patients')
275
292
  self.accepting_medicaid_patients = attributes[:'accepting_medicaid_patients']
293
+ else
294
+ self.accepting_medicaid_patients = false
276
295
  end
277
296
 
278
297
  if attributes.has_key?(:'accepting_medicare_patients')
279
298
  self.accepting_medicare_patients = attributes[:'accepting_medicare_patients']
299
+ else
300
+ self.accepting_medicare_patients = false
280
301
  end
281
302
 
282
303
  if attributes.has_key?(:'accepting_private_patients')
283
304
  self.accepting_private_patients = attributes[:'accepting_private_patients']
305
+ else
306
+ self.accepting_private_patients = false
284
307
  end
285
308
 
286
309
  if attributes.has_key?(:'accepting_referral_patients')
287
310
  self.accepting_referral_patients = attributes[:'accepting_referral_patients']
311
+ else
312
+ self.accepting_referral_patients = false
288
313
  end
289
314
 
290
315
  if attributes.has_key?(:'city')
@@ -295,12 +320,18 @@ module VericredClient
295
320
  self.email = attributes[:'email']
296
321
  end
297
322
 
323
+ if attributes.has_key?(:'first_name')
324
+ self.first_name = attributes[:'first_name']
325
+ end
326
+
298
327
  if attributes.has_key?(:'gender')
299
328
  self.gender = attributes[:'gender']
300
329
  end
301
330
 
302
- if attributes.has_key?(:'first_name')
303
- self.first_name = attributes[:'first_name']
331
+ if attributes.has_key?(:'hios_ids')
332
+ if (value = attributes[:'hios_ids']).is_a?(Array)
333
+ self.hios_ids = value
334
+ end
304
335
  end
305
336
 
306
337
  if attributes.has_key?(:'id')
@@ -311,6 +342,14 @@ module VericredClient
311
342
  self.last_name = attributes[:'last_name']
312
343
  end
313
344
 
345
+ if attributes.has_key?(:'latitude')
346
+ self.latitude = attributes[:'latitude']
347
+ end
348
+
349
+ if attributes.has_key?(:'longitude')
350
+ self.longitude = attributes[:'longitude']
351
+ end
352
+
314
353
  if attributes.has_key?(:'middle_name')
315
354
  self.middle_name = attributes[:'middle_name']
316
355
  end
@@ -389,10 +428,13 @@ module VericredClient
389
428
  accepting_referral_patients == o.accepting_referral_patients &&
390
429
  city == o.city &&
391
430
  email == o.email &&
392
- gender == o.gender &&
393
431
  first_name == o.first_name &&
432
+ gender == o.gender &&
433
+ hios_ids == o.hios_ids &&
394
434
  id == o.id &&
395
435
  last_name == o.last_name &&
436
+ latitude == o.latitude &&
437
+ longitude == o.longitude &&
396
438
  middle_name == o.middle_name &&
397
439
  personal_phone == o.personal_phone &&
398
440
  phone == o.phone &&
@@ -417,7 +459,7 @@ module VericredClient
417
459
  # Calculates hash code according to all attributes.
418
460
  # @return [Fixnum] Hash code
419
461
  def hash
420
- [accepting_change_of_payor_patients, accepting_medicaid_patients, accepting_medicare_patients, accepting_private_patients, accepting_referral_patients, city, email, gender, first_name, id, last_name, middle_name, personal_phone, phone, presentation_name, specialty, state, state_id, street_line_1, street_line_2, suffix, title, type, zip_code].hash
462
+ [accepting_change_of_payor_patients, accepting_medicaid_patients, accepting_medicare_patients, accepting_private_patients, accepting_referral_patients, city, email, first_name, gender, hios_ids, id, last_name, latitude, longitude, middle_name, personal_phone, phone, presentation_name, specialty, state, state_id, street_line_1, street_line_2, suffix, title, type, zip_code].hash
421
463
  end
422
464
 
423
465
  # Builds the object from hash
@@ -0,0 +1,322 @@
1
+ =begin
2
+ Vericred API
3
+
4
+ Vericred's API allows you to search for Health Plans that a specific doctor
5
+ accepts.
6
+
7
+ ## Getting Started
8
+
9
+ Visit our [Developer Portal](https://vericred.3scale.net/access_code?access_code=vericred&cms_token=3545ca52af07bde85b7c0c3aa9d1985e) to
10
+ create an account.
11
+
12
+ Once you have created an account, you can create one Application for
13
+ Production and another for our Sandbox (select the appropriate Plan when
14
+ you create the Application).
15
+
16
+ ## Authentication
17
+
18
+ To authenticate, pass the API Key you created in the Developer Portal as
19
+ a `Vericred-Api-Key` header.
20
+
21
+ `curl -H 'Vericred-Api-Key: YOUR_KEY' "https://api.vericred.com/providers?search_term=Foo&zip_code=11215"`
22
+
23
+ ## Versioning
24
+
25
+ Vericred's API default to the latest version. However, if you need a specific
26
+ version, you can request it with an `Accept-Version` header.
27
+
28
+ The current version is `v3`. Previous versions are `v1` and `v2`.
29
+
30
+ `curl -H 'Vericred-Api-Key: YOUR_KEY' -H 'Accept-Version: v2' "https://api.vericred.com/providers?search_term=Foo&zip_code=11215"`
31
+
32
+ ## Pagination
33
+
34
+ Most endpoints are not paginated. It will be noted in the documentation if/when
35
+ an endpoint is paginated.
36
+
37
+ When pagination is present, a `meta` stanza will be present in the response
38
+ with the total number of records
39
+
40
+ ```
41
+ {
42
+ things: [{ id: 1 }, { id: 2 }],
43
+ meta: { total: 500 }
44
+ }
45
+ ```
46
+
47
+ ## Sideloading
48
+
49
+ When we return multiple levels of an object graph (e.g. `Provider`s and their `State`s
50
+ we sideload the associated data. In this example, we would provide an Array of
51
+ `State`s and a `state_id` for each provider. This is done primarily to reduce the
52
+ payload size since many of the `Provider`s will share a `State`
53
+
54
+ ```
55
+ {
56
+ providers: [{ id: 1, state_id: 1}, { id: 2, state_id: 1 }],
57
+ states: [{ id: 1, code: 'NY' }]
58
+ }
59
+ ```
60
+
61
+ If you need the second level of the object graph, you can just match the
62
+ corresponding id.
63
+
64
+ ## Selecting specific data
65
+
66
+ All endpoints allow you to specify which fields you would like to return.
67
+ This allows you to limit the response to contain only the data you need.
68
+
69
+ For example, let's take a request that returns the following JSON by default
70
+
71
+ ```
72
+ {
73
+ provider: {
74
+ id: 1,
75
+ name: 'John',
76
+ phone: '1234567890',
77
+ field_we_dont_care_about: 'value_we_dont_care_about'
78
+ },
79
+ states: [{
80
+ id: 1,
81
+ name: 'New York',
82
+ code: 'NY',
83
+ field_we_dont_care_about: 'value_we_dont_care_about'
84
+ }]
85
+ }
86
+ ```
87
+
88
+ To limit our results to only return the fields we care about, we specify the
89
+ `select` query string parameter for the corresponding fields in the JSON
90
+ document.
91
+
92
+ In this case, we want to select `name` and `phone` from the `provider` key,
93
+ so we would add the parameters `select=provider.name,provider.phone`.
94
+ We also want the `name` and `code` from the `states` key, so we would
95
+ add the parameters `select=states.name,staes.code`. The id field of
96
+ each document is always returned whether or not it is requested.
97
+
98
+ Our final request would be `GET /providers/12345?select=provider.name,provider.phone,states.name,states.code`
99
+
100
+ The response would be
101
+
102
+ ```
103
+ {
104
+ provider: {
105
+ id: 1,
106
+ name: 'John',
107
+ phone: '1234567890'
108
+ },
109
+ states: [{
110
+ id: 1,
111
+ name: 'New York',
112
+ code: 'NY'
113
+ }]
114
+ }
115
+ ```
116
+
117
+
118
+
119
+ OpenAPI spec version: 1.0.0
120
+
121
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
122
+
123
+
124
+ =end
125
+
126
+ require 'date'
127
+
128
+ module VericredClient
129
+ class ProviderResponse
130
+ # Metadata for query
131
+ attr_accessor :meta
132
+
133
+ # Providers that fit the requested criterion.
134
+ attr_accessor :providers
135
+
136
+ # States that fit the requested criterion.
137
+ attr_accessor :states
138
+
139
+ # Attribute mapping from ruby-style variable name to JSON key.
140
+ def self.attribute_map
141
+ {
142
+ :'meta' => :'meta',
143
+ :'providers' => :'providers',
144
+ :'states' => :'states'
145
+ }
146
+ end
147
+
148
+ # Attribute type mapping.
149
+ def self.swagger_types
150
+ {
151
+ :'meta' => :'Meta',
152
+ :'providers' => :'Array<Provider>',
153
+ :'states' => :'Array<State>'
154
+ }
155
+ end
156
+
157
+ # Initializes the object
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ def initialize(attributes = {})
160
+ return unless attributes.is_a?(Hash)
161
+
162
+ # convert string to symbol for hash key
163
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
164
+
165
+ if attributes.has_key?(:'meta')
166
+ self.meta = attributes[:'meta']
167
+ end
168
+
169
+ if attributes.has_key?(:'providers')
170
+ if (value = attributes[:'providers']).is_a?(Array)
171
+ self.providers = value
172
+ end
173
+ end
174
+
175
+ if attributes.has_key?(:'states')
176
+ if (value = attributes[:'states']).is_a?(Array)
177
+ self.states = value
178
+ end
179
+ end
180
+
181
+ end
182
+
183
+ # Show invalid properties with the reasons. Usually used together with valid?
184
+ # @return Array for valid properies with the reasons
185
+ def list_invalid_properties
186
+ invalid_properties = Array.new
187
+ return invalid_properties
188
+ end
189
+
190
+ # Check to see if the all the properties in the model are valid
191
+ # @return true if the model is valid
192
+ def valid?
193
+ end
194
+
195
+ # Checks equality by comparing each attribute.
196
+ # @param [Object] Object to be compared
197
+ def ==(o)
198
+ return true if self.equal?(o)
199
+ self.class == o.class &&
200
+ meta == o.meta &&
201
+ providers == o.providers &&
202
+ states == o.states
203
+ end
204
+
205
+ # @see the `==` method
206
+ # @param [Object] Object to be compared
207
+ def eql?(o)
208
+ self == o
209
+ end
210
+
211
+ # Calculates hash code according to all attributes.
212
+ # @return [Fixnum] Hash code
213
+ def hash
214
+ [meta, providers, states].hash
215
+ end
216
+
217
+ # Builds the object from hash
218
+ # @param [Hash] attributes Model attributes in the form of hash
219
+ # @return [Object] Returns the model itself
220
+ def build_from_hash(attributes)
221
+ return nil unless attributes.is_a?(Hash)
222
+ self.class.swagger_types.each_pair do |key, type|
223
+ if type =~ /^Array<(.*)>/i
224
+ # check to ensure the input is an array given that the the attribute
225
+ # is documented as an array but the input is not
226
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
227
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
228
+ end
229
+ elsif !attributes[self.class.attribute_map[key]].nil?
230
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
231
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
232
+ end
233
+
234
+ self
235
+ end
236
+
237
+ # Deserializes the data based on type
238
+ # @param string type Data type
239
+ # @param string value Value to be deserialized
240
+ # @return [Object] Deserialized data
241
+ def _deserialize(type, value)
242
+ case type.to_sym
243
+ when :DateTime
244
+ DateTime.parse(value)
245
+ when :Date
246
+ Date.parse(value)
247
+ when :String
248
+ value.to_s
249
+ when :Integer
250
+ value.to_i
251
+ when :Float
252
+ value.to_f
253
+ when :BOOLEAN
254
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
255
+ true
256
+ else
257
+ false
258
+ end
259
+ when :Object
260
+ # generic object (usually a Hash), return directly
261
+ value
262
+ when /\AArray<(?<inner_type>.+)>\z/
263
+ inner_type = Regexp.last_match[:inner_type]
264
+ value.map { |v| _deserialize(inner_type, v) }
265
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
266
+ k_type = Regexp.last_match[:k_type]
267
+ v_type = Regexp.last_match[:v_type]
268
+ {}.tap do |hash|
269
+ value.each do |k, v|
270
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
271
+ end
272
+ end
273
+ else # model
274
+ temp_model = VericredClient.const_get(type).new
275
+ temp_model.build_from_hash(value)
276
+ end
277
+ end
278
+
279
+ # Returns the string representation of the object
280
+ # @return [String] String presentation of the object
281
+ def to_s
282
+ to_hash.to_s
283
+ end
284
+
285
+ # to_body is an alias to to_hash (backward compatibility)
286
+ # @return [Hash] Returns the object in the form of hash
287
+ def to_body
288
+ to_hash
289
+ end
290
+
291
+ # Returns the object in the form of hash
292
+ # @return [Hash] Returns the object in the form of hash
293
+ def to_hash
294
+ hash = {}
295
+ self.class.attribute_map.each_pair do |attr, param|
296
+ value = self.send(attr)
297
+ next if value.nil?
298
+ hash[param] = _to_hash(value)
299
+ end
300
+ hash
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)
308
+ if value.is_a?(Array)
309
+ value.compact.map{ |v| _to_hash(v) }
310
+ elsif value.is_a?(Hash)
311
+ {}.tap do |hash|
312
+ value.each { |k, v| hash[k] = _to_hash(v) }
313
+ end
314
+ elsif value.respond_to? :to_hash
315
+ value.to_hash
316
+ else
317
+ value
318
+ end
319
+ end
320
+
321
+ end
322
+ end