vericred_client 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +30 -20
- data/docs/Applicant.md +2 -2
- data/docs/{InlineResponse2001.md → Base.md} +2 -2
- data/docs/Carrier.md +1 -1
- data/docs/County.md +3 -3
- data/docs/CountyBulk.md +10 -0
- data/docs/Drug.md +2 -1
- data/docs/DrugCoverage.md +4 -4
- data/docs/DrugCoverageResponse.md +9 -0
- data/docs/DrugPackage.md +9 -0
- data/docs/DrugSearchResponse.md +9 -0
- data/docs/DrugsApi.md +59 -0
- data/docs/Meta.md +8 -0
- data/docs/Plan.md +22 -6
- data/docs/PlanCounty.md +1 -1
- data/docs/PlanCountyBulk.md +10 -0
- data/docs/PlanFindResponse.md +9 -0
- data/docs/PlanSearchResult.md +26 -8
- data/docs/PlansApi.md +11 -11
- data/docs/Pricing.md +7 -1
- data/docs/Provider.md +9 -6
- data/docs/ProviderResponse.md +10 -0
- data/docs/ProvidersApi.md +19 -21
- data/docs/RatingArea.md +2 -2
- data/docs/RequestPlanFind.md +15 -0
- data/docs/State.md +4 -4
- data/docs/ZipCountiesApi.md +7 -8
- data/docs/ZipCountyBulk.md +11 -0
- data/docs/ZipCountyResponse.md +10 -0
- data/lib/vericred_client.rb +14 -6
- data/lib/vericred_client/api/{drug_coverage_api.rb → drugs_api.rb} +25 -19
- data/lib/vericred_client/api/plans_api.rb +14 -16
- data/lib/vericred_client/api/providers_api.rb +29 -29
- data/lib/vericred_client/api/zip_counties_api.rb +12 -12
- data/lib/vericred_client/api_client.rb +1 -1
- data/lib/vericred_client/api_error.rb +1 -1
- data/lib/vericred_client/models/applicant.rb +14 -12
- data/lib/vericred_client/models/{inline_response_200_1.rb → base.rb} +10 -9
- data/lib/vericred_client/models/carrier.rb +15 -15
- data/lib/vericred_client/models/carrier_subsidiary.rb +1 -1
- data/lib/vericred_client/models/county.rb +18 -14
- data/lib/vericred_client/models/county_bulk.rb +318 -0
- data/lib/vericred_client/models/drug.rb +27 -15
- data/lib/vericred_client/models/drug_coverage.rb +38 -32
- data/lib/vericred_client/models/drug_coverage_response.rb +310 -0
- data/lib/vericred_client/models/drug_package.rb +308 -0
- data/lib/vericred_client/models/drug_search_response.rb +310 -0
- data/lib/vericred_client/models/meta.rb +298 -0
- data/lib/vericred_client/models/plan.rb +196 -22
- data/lib/vericred_client/models/plan_county.rb +15 -15
- data/lib/vericred_client/models/plan_county_bulk.rb +318 -0
- data/lib/vericred_client/models/{inline_response_200.rb → plan_find_response.rb} +13 -11
- data/lib/vericred_client/models/plan_search_result.rb +236 -42
- data/lib/vericred_client/models/pricing.rb +63 -3
- data/lib/vericred_client/models/provider.rb +51 -9
- data/lib/vericred_client/models/provider_response.rb +322 -0
- data/lib/vericred_client/models/rating_area.rb +5 -5
- data/lib/vericred_client/models/{query.rb → request_plan_find.rb} +14 -6
- data/lib/vericred_client/models/state.rb +29 -25
- data/lib/vericred_client/models/zip_code.rb +1 -1
- data/lib/vericred_client/models/zip_county.rb +1 -1
- data/lib/vericred_client/models/zip_county_bulk.rb +328 -0
- data/lib/vericred_client/models/{inline_response_200_2.rb → zip_county_response.rb} +20 -17
- data/lib/vericred_client/version.rb +2 -2
- data/spec/api/{drug_coverage_api_spec.rb → drugs_api_spec.rb} +14 -17
- data/spec/api/plans_api_spec.rb +7 -69
- data/spec/api/providers_api_spec.rb +12 -28
- data/spec/api/zip_counties_api_spec.rb +6 -13
- metadata +31 -15
- data/docs/DrugCoverageApi.md +0 -54
- data/docs/InlineResponse200.md +0 -9
- data/docs/InlineResponse2002.md +0 -10
- 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
|
|
@@ -127,10 +127,10 @@ require 'date'
|
|
127
127
|
|
128
128
|
module VericredClient
|
129
129
|
class RatingArea
|
130
|
-
#
|
130
|
+
# Name of the Rating Area
|
131
131
|
attr_accessor :id
|
132
132
|
|
133
|
-
#
|
133
|
+
# State Code
|
134
134
|
attr_accessor :state_id
|
135
135
|
|
136
136
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -144,8 +144,8 @@ module VericredClient
|
|
144
144
|
# Attribute type mapping.
|
145
145
|
def self.swagger_types
|
146
146
|
{
|
147
|
-
:'id' => :'
|
148
|
-
:'state_id' => :'
|
147
|
+
:'id' => :'String',
|
148
|
+
:'state_id' => :'String'
|
149
149
|
}
|
150
150
|
end
|
151
151
|
|
@@ -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
|
|
@@ -126,21 +126,29 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
126
126
|
require 'date'
|
127
127
|
|
128
128
|
module VericredClient
|
129
|
-
class
|
129
|
+
class RequestPlanFind
|
130
|
+
# Applicants for desired plans.
|
130
131
|
attr_accessor :applicants
|
131
132
|
|
133
|
+
# Date of enrollment
|
132
134
|
attr_accessor :enrollment_date
|
133
135
|
|
136
|
+
# County code to determine eligibility
|
134
137
|
attr_accessor :fips_code
|
135
138
|
|
139
|
+
# Total household income.
|
136
140
|
attr_accessor :household_income
|
137
141
|
|
142
|
+
# Number of people living in household.
|
138
143
|
attr_accessor :household_size
|
139
144
|
|
145
|
+
# Type of plan to search for.
|
140
146
|
attr_accessor :market
|
141
147
|
|
148
|
+
# List of providers to search for.
|
142
149
|
attr_accessor :providers
|
143
150
|
|
151
|
+
# 5-digit zip code - this helps determine pricing.
|
144
152
|
attr_accessor :zip_code
|
145
153
|
|
146
154
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -161,12 +169,12 @@ module VericredClient
|
|
161
169
|
def self.swagger_types
|
162
170
|
{
|
163
171
|
:'applicants' => :'Array<Applicant>',
|
164
|
-
:'enrollment_date' => :'
|
172
|
+
:'enrollment_date' => :'String',
|
165
173
|
:'fips_code' => :'String',
|
166
|
-
:'household_income' => :'
|
167
|
-
:'household_size' => :'
|
174
|
+
:'household_income' => :'Integer',
|
175
|
+
:'household_size' => :'Integer',
|
168
176
|
:'market' => :'String',
|
169
|
-
:'providers' => :'Array<
|
177
|
+
:'providers' => :'Array<Provider>',
|
170
178
|
:'zip_code' => :'String'
|
171
179
|
}
|
172
180
|
end
|
@@ -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
|
|
@@ -127,18 +127,15 @@ require 'date'
|
|
127
127
|
|
128
128
|
module VericredClient
|
129
129
|
class State
|
130
|
-
# Primary Key of State
|
131
|
-
attr_accessor :id
|
132
|
-
|
133
|
-
# Name of state
|
134
|
-
attr_accessor :name
|
135
|
-
|
136
130
|
# 2 letter code for state
|
137
131
|
attr_accessor :code
|
138
132
|
|
139
133
|
# National FIPs number
|
140
134
|
attr_accessor :fips_number
|
141
135
|
|
136
|
+
# Primary Key of State
|
137
|
+
attr_accessor :id
|
138
|
+
|
142
139
|
# Last date this state is live for individuals
|
143
140
|
attr_accessor :last_date_for_individual
|
144
141
|
|
@@ -151,31 +148,34 @@ module VericredClient
|
|
151
148
|
# Is this State available for individuals
|
152
149
|
attr_accessor :live_for_consumers
|
153
150
|
|
151
|
+
# Name of state
|
152
|
+
attr_accessor :name
|
153
|
+
|
154
154
|
# Attribute mapping from ruby-style variable name to JSON key.
|
155
155
|
def self.attribute_map
|
156
156
|
{
|
157
|
-
:'id' => :'id',
|
158
|
-
:'name' => :'name',
|
159
157
|
:'code' => :'code',
|
160
158
|
:'fips_number' => :'fips_number',
|
159
|
+
:'id' => :'id',
|
161
160
|
:'last_date_for_individual' => :'last_date_for_individual',
|
162
161
|
:'last_date_for_shop' => :'last_date_for_shop',
|
163
162
|
:'live_for_business' => :'live_for_business',
|
164
|
-
:'live_for_consumers' => :'live_for_consumers'
|
163
|
+
:'live_for_consumers' => :'live_for_consumers',
|
164
|
+
:'name' => :'name'
|
165
165
|
}
|
166
166
|
end
|
167
167
|
|
168
168
|
# Attribute type mapping.
|
169
169
|
def self.swagger_types
|
170
170
|
{
|
171
|
-
:'id' => :'Integer',
|
172
|
-
:'name' => :'String',
|
173
171
|
:'code' => :'String',
|
174
172
|
:'fips_number' => :'String',
|
173
|
+
:'id' => :'Integer',
|
175
174
|
:'last_date_for_individual' => :'Date',
|
176
175
|
:'last_date_for_shop' => :'Date',
|
177
176
|
:'live_for_business' => :'BOOLEAN',
|
178
|
-
:'live_for_consumers' => :'BOOLEAN'
|
177
|
+
:'live_for_consumers' => :'BOOLEAN',
|
178
|
+
:'name' => :'String'
|
179
179
|
}
|
180
180
|
end
|
181
181
|
|
@@ -187,14 +187,6 @@ module VericredClient
|
|
187
187
|
# convert string to symbol for hash key
|
188
188
|
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
189
189
|
|
190
|
-
if attributes.has_key?(:'id')
|
191
|
-
self.id = attributes[:'id']
|
192
|
-
end
|
193
|
-
|
194
|
-
if attributes.has_key?(:'name')
|
195
|
-
self.name = attributes[:'name']
|
196
|
-
end
|
197
|
-
|
198
190
|
if attributes.has_key?(:'code')
|
199
191
|
self.code = attributes[:'code']
|
200
192
|
end
|
@@ -203,6 +195,10 @@ module VericredClient
|
|
203
195
|
self.fips_number = attributes[:'fips_number']
|
204
196
|
end
|
205
197
|
|
198
|
+
if attributes.has_key?(:'id')
|
199
|
+
self.id = attributes[:'id']
|
200
|
+
end
|
201
|
+
|
206
202
|
if attributes.has_key?(:'last_date_for_individual')
|
207
203
|
self.last_date_for_individual = attributes[:'last_date_for_individual']
|
208
204
|
end
|
@@ -213,10 +209,18 @@ module VericredClient
|
|
213
209
|
|
214
210
|
if attributes.has_key?(:'live_for_business')
|
215
211
|
self.live_for_business = attributes[:'live_for_business']
|
212
|
+
else
|
213
|
+
self.live_for_business = false
|
216
214
|
end
|
217
215
|
|
218
216
|
if attributes.has_key?(:'live_for_consumers')
|
219
217
|
self.live_for_consumers = attributes[:'live_for_consumers']
|
218
|
+
else
|
219
|
+
self.live_for_consumers = false
|
220
|
+
end
|
221
|
+
|
222
|
+
if attributes.has_key?(:'name')
|
223
|
+
self.name = attributes[:'name']
|
220
224
|
end
|
221
225
|
|
222
226
|
end
|
@@ -238,14 +242,14 @@ module VericredClient
|
|
238
242
|
def ==(o)
|
239
243
|
return true if self.equal?(o)
|
240
244
|
self.class == o.class &&
|
241
|
-
id == o.id &&
|
242
|
-
name == o.name &&
|
243
245
|
code == o.code &&
|
244
246
|
fips_number == o.fips_number &&
|
247
|
+
id == o.id &&
|
245
248
|
last_date_for_individual == o.last_date_for_individual &&
|
246
249
|
last_date_for_shop == o.last_date_for_shop &&
|
247
250
|
live_for_business == o.live_for_business &&
|
248
|
-
live_for_consumers == o.live_for_consumers
|
251
|
+
live_for_consumers == o.live_for_consumers &&
|
252
|
+
name == o.name
|
249
253
|
end
|
250
254
|
|
251
255
|
# @see the `==` method
|
@@ -257,7 +261,7 @@ module VericredClient
|
|
257
261
|
# Calculates hash code according to all attributes.
|
258
262
|
# @return [Fixnum] Hash code
|
259
263
|
def hash
|
260
|
-
[
|
264
|
+
[code, fips_number, id, last_date_for_individual, last_date_for_shop, live_for_business, live_for_consumers, name].hash
|
261
265
|
end
|
262
266
|
|
263
267
|
# Builds the object from hash
|
@@ -0,0 +1,328 @@
|
|
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 ZipCountyBulk
|
130
|
+
# Foreign key for county (fips code)
|
131
|
+
attr_accessor :county_id
|
132
|
+
|
133
|
+
# Primary key
|
134
|
+
attr_accessor :id
|
135
|
+
|
136
|
+
# Foreign key for rating area
|
137
|
+
attr_accessor :rating_area_id
|
138
|
+
|
139
|
+
# Foreign key for zip code (zip code)
|
140
|
+
attr_accessor :zip_code_id
|
141
|
+
|
142
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
143
|
+
def self.attribute_map
|
144
|
+
{
|
145
|
+
:'county_id' => :'county_id',
|
146
|
+
:'id' => :'id',
|
147
|
+
:'rating_area_id' => :'rating_area_id',
|
148
|
+
:'zip_code_id' => :'zip_code_id'
|
149
|
+
}
|
150
|
+
end
|
151
|
+
|
152
|
+
# Attribute type mapping.
|
153
|
+
def self.swagger_types
|
154
|
+
{
|
155
|
+
:'county_id' => :'String',
|
156
|
+
:'id' => :'Integer',
|
157
|
+
:'rating_area_id' => :'String',
|
158
|
+
:'zip_code_id' => :'String'
|
159
|
+
}
|
160
|
+
end
|
161
|
+
|
162
|
+
# Initializes the object
|
163
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
164
|
+
def initialize(attributes = {})
|
165
|
+
return unless attributes.is_a?(Hash)
|
166
|
+
|
167
|
+
# convert string to symbol for hash key
|
168
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
169
|
+
|
170
|
+
if attributes.has_key?(:'county_id')
|
171
|
+
self.county_id = attributes[:'county_id']
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes.has_key?(:'id')
|
175
|
+
self.id = attributes[:'id']
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes.has_key?(:'rating_area_id')
|
179
|
+
self.rating_area_id = attributes[:'rating_area_id']
|
180
|
+
end
|
181
|
+
|
182
|
+
if attributes.has_key?(:'zip_code_id')
|
183
|
+
self.zip_code_id = attributes[:'zip_code_id']
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
189
|
+
# @return Array for valid properies with the reasons
|
190
|
+
def list_invalid_properties
|
191
|
+
invalid_properties = Array.new
|
192
|
+
return invalid_properties
|
193
|
+
end
|
194
|
+
|
195
|
+
# Check to see if the all the properties in the model are valid
|
196
|
+
# @return true if the model is valid
|
197
|
+
def valid?
|
198
|
+
end
|
199
|
+
|
200
|
+
# Checks equality by comparing each attribute.
|
201
|
+
# @param [Object] Object to be compared
|
202
|
+
def ==(o)
|
203
|
+
return true if self.equal?(o)
|
204
|
+
self.class == o.class &&
|
205
|
+
county_id == o.county_id &&
|
206
|
+
id == o.id &&
|
207
|
+
rating_area_id == o.rating_area_id &&
|
208
|
+
zip_code_id == o.zip_code_id
|
209
|
+
end
|
210
|
+
|
211
|
+
# @see the `==` method
|
212
|
+
# @param [Object] Object to be compared
|
213
|
+
def eql?(o)
|
214
|
+
self == o
|
215
|
+
end
|
216
|
+
|
217
|
+
# Calculates hash code according to all attributes.
|
218
|
+
# @return [Fixnum] Hash code
|
219
|
+
def hash
|
220
|
+
[county_id, id, rating_area_id, zip_code_id].hash
|
221
|
+
end
|
222
|
+
|
223
|
+
# Builds the object from hash
|
224
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
225
|
+
# @return [Object] Returns the model itself
|
226
|
+
def build_from_hash(attributes)
|
227
|
+
return nil unless attributes.is_a?(Hash)
|
228
|
+
self.class.swagger_types.each_pair do |key, type|
|
229
|
+
if type =~ /^Array<(.*)>/i
|
230
|
+
# check to ensure the input is an array given that the the attribute
|
231
|
+
# is documented as an array but the input is not
|
232
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
233
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
234
|
+
end
|
235
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
236
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
237
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
238
|
+
end
|
239
|
+
|
240
|
+
self
|
241
|
+
end
|
242
|
+
|
243
|
+
# Deserializes the data based on type
|
244
|
+
# @param string type Data type
|
245
|
+
# @param string value Value to be deserialized
|
246
|
+
# @return [Object] Deserialized data
|
247
|
+
def _deserialize(type, value)
|
248
|
+
case type.to_sym
|
249
|
+
when :DateTime
|
250
|
+
DateTime.parse(value)
|
251
|
+
when :Date
|
252
|
+
Date.parse(value)
|
253
|
+
when :String
|
254
|
+
value.to_s
|
255
|
+
when :Integer
|
256
|
+
value.to_i
|
257
|
+
when :Float
|
258
|
+
value.to_f
|
259
|
+
when :BOOLEAN
|
260
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
261
|
+
true
|
262
|
+
else
|
263
|
+
false
|
264
|
+
end
|
265
|
+
when :Object
|
266
|
+
# generic object (usually a Hash), return directly
|
267
|
+
value
|
268
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
269
|
+
inner_type = Regexp.last_match[:inner_type]
|
270
|
+
value.map { |v| _deserialize(inner_type, v) }
|
271
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
272
|
+
k_type = Regexp.last_match[:k_type]
|
273
|
+
v_type = Regexp.last_match[:v_type]
|
274
|
+
{}.tap do |hash|
|
275
|
+
value.each do |k, v|
|
276
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
277
|
+
end
|
278
|
+
end
|
279
|
+
else # model
|
280
|
+
temp_model = VericredClient.const_get(type).new
|
281
|
+
temp_model.build_from_hash(value)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
# Returns the string representation of the object
|
286
|
+
# @return [String] String presentation of the object
|
287
|
+
def to_s
|
288
|
+
to_hash.to_s
|
289
|
+
end
|
290
|
+
|
291
|
+
# to_body is an alias to to_hash (backward compatibility)
|
292
|
+
# @return [Hash] Returns the object in the form of hash
|
293
|
+
def to_body
|
294
|
+
to_hash
|
295
|
+
end
|
296
|
+
|
297
|
+
# Returns the object in the form of hash
|
298
|
+
# @return [Hash] Returns the object in the form of hash
|
299
|
+
def to_hash
|
300
|
+
hash = {}
|
301
|
+
self.class.attribute_map.each_pair do |attr, param|
|
302
|
+
value = self.send(attr)
|
303
|
+
next if value.nil?
|
304
|
+
hash[param] = _to_hash(value)
|
305
|
+
end
|
306
|
+
hash
|
307
|
+
end
|
308
|
+
|
309
|
+
# Outputs non-array value in the form of hash
|
310
|
+
# For object, use to_hash. Otherwise, just return the value
|
311
|
+
# @param [Object] value Any valid value
|
312
|
+
# @return [Hash] Returns the value in the form of hash
|
313
|
+
def _to_hash(value)
|
314
|
+
if value.is_a?(Array)
|
315
|
+
value.compact.map{ |v| _to_hash(v) }
|
316
|
+
elsif value.is_a?(Hash)
|
317
|
+
{}.tap do |hash|
|
318
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
319
|
+
end
|
320
|
+
elsif value.respond_to? :to_hash
|
321
|
+
value.to_hash
|
322
|
+
else
|
323
|
+
value
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
end
|
328
|
+
end
|