vericred_client 0.0.8 → 0.0.9
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 +10 -6
- data/docs/CountyBulk.md +2 -0
- data/docs/Plan.md +3 -0
- data/docs/PlanSearchResult.md +3 -0
- data/docs/PlanShowResponse.md +8 -0
- data/docs/PlansApi.md +56 -0
- data/docs/ProvidersApi.md +8 -2
- data/docs/RequestPlanFind.md +2 -1
- data/docs/RequestPlanFindDrugPackage.md +8 -0
- data/docs/RequestProvidersSearch.md +1 -0
- data/docs/ServiceArea.md +10 -0
- data/docs/ServiceAreaZipCounty.md +10 -0
- data/lib/vericred_client/api/plans_api.rb +56 -0
- data/lib/vericred_client/api/providers_api.rb +6 -0
- data/lib/vericred_client/api_client.rb +9 -3
- data/lib/vericred_client/configuration.rb +22 -1
- data/lib/vericred_client/models/county_bulk.rb +24 -4
- data/lib/vericred_client/models/plan.rb +31 -1
- data/lib/vericred_client/models/plan_search_result.rb +31 -1
- data/lib/vericred_client/models/plan_show_response.rb +307 -0
- data/lib/vericred_client/models/request_plan_find.rb +14 -2
- data/lib/vericred_client/models/request_plan_find_drug_package.rb +307 -0
- data/lib/vericred_client/models/request_providers_search.rb +11 -1
- data/lib/vericred_client/models/service_area.rb +327 -0
- data/lib/vericred_client/models/{plan_zip_county.rb → service_area_zip_county.rb} +14 -14
- data/lib/vericred_client/version.rb +1 -1
- data/lib/vericred_client.rb +4 -1
- data/spec/api/plans_api_spec.rb +12 -0
- data/spec/api/providers_api_spec.rb +2 -0
- data/spec/api_client_spec.rb +20 -79
- data/spec/configuration_spec.rb +11 -6
- data/spec/models/county_bulk_spec.rb +12 -0
- data/spec/models/plan_search_result_spec.rb +18 -0
- data/spec/models/plan_show_response_spec.rb +160 -0
- data/spec/models/plan_spec.rb +18 -0
- data/spec/models/request_plan_find_drug_package_spec.rb +160 -0
- data/spec/models/request_plan_find_spec.rb +6 -0
- data/spec/models/request_providers_search_spec.rb +6 -0
- data/spec/models/service_area_spec.rb +172 -0
- data/spec/models/{plan_zip_county_spec.rb → service_area_zip_county_spec.rb} +8 -8
- metadata +18 -6
- data/docs/PlanZipCounty.md +0 -10
@@ -0,0 +1,307 @@
|
|
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) 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
|
+
Endpoints that accept `page` and `per_page` parameters are paginated. They expose
|
35
|
+
four additional fields that contain data about your position in the response,
|
36
|
+
namely `Total`, `Per-Page`, `Link`, and `Page` as described in [RFC-5988](https://tools.ietf.org/html/rfc5988).
|
37
|
+
|
38
|
+
For example, to display 5 results per page and view the second page of a
|
39
|
+
`GET` to `/networks`, your final request would be `GET /networks?....page=2&per_page=5`.
|
40
|
+
|
41
|
+
## Sideloading
|
42
|
+
|
43
|
+
When we return multiple levels of an object graph (e.g. `Provider`s and their `State`s
|
44
|
+
we sideload the associated data. In this example, we would provide an Array of
|
45
|
+
`State`s and a `state_id` for each provider. This is done primarily to reduce the
|
46
|
+
payload size since many of the `Provider`s will share a `State`
|
47
|
+
|
48
|
+
```
|
49
|
+
{
|
50
|
+
providers: [{ id: 1, state_id: 1}, { id: 2, state_id: 1 }],
|
51
|
+
states: [{ id: 1, code: 'NY' }]
|
52
|
+
}
|
53
|
+
```
|
54
|
+
|
55
|
+
If you need the second level of the object graph, you can just match the
|
56
|
+
corresponding id.
|
57
|
+
|
58
|
+
## Selecting specific data
|
59
|
+
|
60
|
+
All endpoints allow you to specify which fields you would like to return.
|
61
|
+
This allows you to limit the response to contain only the data you need.
|
62
|
+
|
63
|
+
For example, let's take a request that returns the following JSON by default
|
64
|
+
|
65
|
+
```
|
66
|
+
{
|
67
|
+
provider: {
|
68
|
+
id: 1,
|
69
|
+
name: 'John',
|
70
|
+
phone: '1234567890',
|
71
|
+
field_we_dont_care_about: 'value_we_dont_care_about'
|
72
|
+
},
|
73
|
+
states: [{
|
74
|
+
id: 1,
|
75
|
+
name: 'New York',
|
76
|
+
code: 'NY',
|
77
|
+
field_we_dont_care_about: 'value_we_dont_care_about'
|
78
|
+
}]
|
79
|
+
}
|
80
|
+
```
|
81
|
+
|
82
|
+
To limit our results to only return the fields we care about, we specify the
|
83
|
+
`select` query string parameter for the corresponding fields in the JSON
|
84
|
+
document.
|
85
|
+
|
86
|
+
In this case, we want to select `name` and `phone` from the `provider` key,
|
87
|
+
so we would add the parameters `select=provider.name,provider.phone`.
|
88
|
+
We also want the `name` and `code` from the `states` key, so we would
|
89
|
+
add the parameters `select=states.name,staes.code`. The id field of
|
90
|
+
each document is always returned whether or not it is requested.
|
91
|
+
|
92
|
+
Our final request would be `GET /providers/12345?select=provider.name,provider.phone,states.name,states.code`
|
93
|
+
|
94
|
+
The response would be
|
95
|
+
|
96
|
+
```
|
97
|
+
{
|
98
|
+
provider: {
|
99
|
+
id: 1,
|
100
|
+
name: 'John',
|
101
|
+
phone: '1234567890'
|
102
|
+
},
|
103
|
+
states: [{
|
104
|
+
id: 1,
|
105
|
+
name: 'New York',
|
106
|
+
code: 'NY'
|
107
|
+
}]
|
108
|
+
}
|
109
|
+
```
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
OpenAPI spec version: 1.0.0
|
114
|
+
|
115
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
116
|
+
|
117
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
118
|
+
you may not use this file except in compliance with the License.
|
119
|
+
You may obtain a copy of the License at
|
120
|
+
|
121
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
122
|
+
|
123
|
+
Unless required by applicable law or agreed to in writing, software
|
124
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
125
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
126
|
+
See the License for the specific language governing permissions and
|
127
|
+
limitations under the License.
|
128
|
+
|
129
|
+
=end
|
130
|
+
|
131
|
+
require 'date'
|
132
|
+
|
133
|
+
module VericredClient
|
134
|
+
|
135
|
+
class RequestPlanFindDrugPackage
|
136
|
+
# National Drug Code ID (Package)
|
137
|
+
attr_accessor :id
|
138
|
+
|
139
|
+
|
140
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
141
|
+
def self.attribute_map
|
142
|
+
{
|
143
|
+
:'id' => :'id'
|
144
|
+
}
|
145
|
+
end
|
146
|
+
|
147
|
+
# Attribute type mapping.
|
148
|
+
def self.swagger_types
|
149
|
+
{
|
150
|
+
:'id' => :'String'
|
151
|
+
}
|
152
|
+
end
|
153
|
+
|
154
|
+
# Initializes the object
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
156
|
+
def initialize(attributes = {})
|
157
|
+
return unless attributes.is_a?(Hash)
|
158
|
+
|
159
|
+
# convert string to symbol for hash key
|
160
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
161
|
+
|
162
|
+
if attributes.has_key?(:'id')
|
163
|
+
self.id = attributes[:'id']
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
|
168
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
169
|
+
# @return Array for valid properies with the reasons
|
170
|
+
def list_invalid_properties
|
171
|
+
invalid_properties = Array.new
|
172
|
+
return invalid_properties
|
173
|
+
end
|
174
|
+
|
175
|
+
# Check to see if the all the properties in the model are valid
|
176
|
+
# @return true if the model is valid
|
177
|
+
def valid?
|
178
|
+
return true
|
179
|
+
end
|
180
|
+
|
181
|
+
# Checks equality by comparing each attribute.
|
182
|
+
# @param [Object] Object to be compared
|
183
|
+
def ==(o)
|
184
|
+
return true if self.equal?(o)
|
185
|
+
self.class == o.class &&
|
186
|
+
id == o.id
|
187
|
+
end
|
188
|
+
|
189
|
+
# @see the `==` method
|
190
|
+
# @param [Object] Object to be compared
|
191
|
+
def eql?(o)
|
192
|
+
self == o
|
193
|
+
end
|
194
|
+
|
195
|
+
# Calculates hash code according to all attributes.
|
196
|
+
# @return [Fixnum] Hash code
|
197
|
+
def hash
|
198
|
+
[id].hash
|
199
|
+
end
|
200
|
+
|
201
|
+
# Builds the object from hash
|
202
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
203
|
+
# @return [Object] Returns the model itself
|
204
|
+
def build_from_hash(attributes)
|
205
|
+
return nil unless attributes.is_a?(Hash)
|
206
|
+
self.class.swagger_types.each_pair do |key, type|
|
207
|
+
if type =~ /^Array<(.*)>/i
|
208
|
+
# check to ensure the input is an array given that the the attribute
|
209
|
+
# is documented as an array but the input is not
|
210
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
211
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
212
|
+
end
|
213
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
214
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
215
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
216
|
+
end
|
217
|
+
|
218
|
+
self
|
219
|
+
end
|
220
|
+
|
221
|
+
# Deserializes the data based on type
|
222
|
+
# @param string type Data type
|
223
|
+
# @param string value Value to be deserialized
|
224
|
+
# @return [Object] Deserialized data
|
225
|
+
def _deserialize(type, value)
|
226
|
+
case type.to_sym
|
227
|
+
when :DateTime
|
228
|
+
DateTime.parse(value)
|
229
|
+
when :Date
|
230
|
+
Date.parse(value)
|
231
|
+
when :String
|
232
|
+
value.to_s
|
233
|
+
when :Integer
|
234
|
+
value.to_i
|
235
|
+
when :Float
|
236
|
+
value.to_f
|
237
|
+
when :BOOLEAN
|
238
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
239
|
+
true
|
240
|
+
else
|
241
|
+
false
|
242
|
+
end
|
243
|
+
when :Object
|
244
|
+
# generic object (usually a Hash), return directly
|
245
|
+
value
|
246
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
247
|
+
inner_type = Regexp.last_match[:inner_type]
|
248
|
+
value.map { |v| _deserialize(inner_type, v) }
|
249
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
250
|
+
k_type = Regexp.last_match[:k_type]
|
251
|
+
v_type = Regexp.last_match[:v_type]
|
252
|
+
{}.tap do |hash|
|
253
|
+
value.each do |k, v|
|
254
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
255
|
+
end
|
256
|
+
end
|
257
|
+
else # model
|
258
|
+
temp_model = VericredClient.const_get(type).new
|
259
|
+
temp_model.build_from_hash(value)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
# Returns the string representation of the object
|
264
|
+
# @return [String] String presentation of the object
|
265
|
+
def to_s
|
266
|
+
to_hash.to_s
|
267
|
+
end
|
268
|
+
|
269
|
+
# to_body is an alias to to_hash (backward compatibility)
|
270
|
+
# @return [Hash] Returns the object in the form of hash
|
271
|
+
def to_body
|
272
|
+
to_hash
|
273
|
+
end
|
274
|
+
|
275
|
+
# Returns the object in the form of hash
|
276
|
+
# @return [Hash] Returns the object in the form of hash
|
277
|
+
def to_hash
|
278
|
+
hash = {}
|
279
|
+
self.class.attribute_map.each_pair do |attr, param|
|
280
|
+
value = self.send(attr)
|
281
|
+
next if value.nil?
|
282
|
+
hash[param] = _to_hash(value)
|
283
|
+
end
|
284
|
+
hash
|
285
|
+
end
|
286
|
+
|
287
|
+
# Outputs non-array value in the form of hash
|
288
|
+
# For object, use to_hash. Otherwise, just return the value
|
289
|
+
# @param [Object] value Any valid value
|
290
|
+
# @return [Hash] Returns the value in the form of hash
|
291
|
+
def _to_hash(value)
|
292
|
+
if value.is_a?(Array)
|
293
|
+
value.compact.map{ |v| _to_hash(v) }
|
294
|
+
elsif value.is_a?(Hash)
|
295
|
+
{}.tap do |hash|
|
296
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
297
|
+
end
|
298
|
+
elsif value.respond_to? :to_hash
|
299
|
+
value.to_hash
|
300
|
+
else
|
301
|
+
value
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
end
|
306
|
+
|
307
|
+
end
|
@@ -139,6 +139,9 @@ module VericredClient
|
|
139
139
|
# List of HIOS ids
|
140
140
|
attr_accessor :hios_ids
|
141
141
|
|
142
|
+
# Minimum search threshold to be included in the results
|
143
|
+
attr_accessor :min_score
|
144
|
+
|
142
145
|
# Page number
|
143
146
|
attr_accessor :page
|
144
147
|
|
@@ -163,6 +166,7 @@ module VericredClient
|
|
163
166
|
{
|
164
167
|
:'accepts_insurance' => :'accepts_insurance',
|
165
168
|
:'hios_ids' => :'hios_ids',
|
169
|
+
:'min_score' => :'min_score',
|
166
170
|
:'page' => :'page',
|
167
171
|
:'per_page' => :'per_page',
|
168
172
|
:'radius' => :'radius',
|
@@ -177,6 +181,7 @@ module VericredClient
|
|
177
181
|
{
|
178
182
|
:'accepts_insurance' => :'BOOLEAN',
|
179
183
|
:'hios_ids' => :'Array<String>',
|
184
|
+
:'min_score' => :'Float',
|
180
185
|
:'page' => :'Integer',
|
181
186
|
:'per_page' => :'Integer',
|
182
187
|
:'radius' => :'Integer',
|
@@ -204,6 +209,10 @@ module VericredClient
|
|
204
209
|
end
|
205
210
|
end
|
206
211
|
|
212
|
+
if attributes.has_key?(:'min_score')
|
213
|
+
self.min_score = attributes[:'min_score']
|
214
|
+
end
|
215
|
+
|
207
216
|
if attributes.has_key?(:'page')
|
208
217
|
self.page = attributes[:'page']
|
209
218
|
end
|
@@ -250,6 +259,7 @@ module VericredClient
|
|
250
259
|
self.class == o.class &&
|
251
260
|
accepts_insurance == o.accepts_insurance &&
|
252
261
|
hios_ids == o.hios_ids &&
|
262
|
+
min_score == o.min_score &&
|
253
263
|
page == o.page &&
|
254
264
|
per_page == o.per_page &&
|
255
265
|
radius == o.radius &&
|
@@ -267,7 +277,7 @@ module VericredClient
|
|
267
277
|
# Calculates hash code according to all attributes.
|
268
278
|
# @return [Fixnum] Hash code
|
269
279
|
def hash
|
270
|
-
[accepts_insurance, hios_ids, page, per_page, radius, search_term, zip_code, type].hash
|
280
|
+
[accepts_insurance, hios_ids, min_score, page, per_page, radius, search_term, zip_code, type].hash
|
271
281
|
end
|
272
282
|
|
273
283
|
# Builds the object from hash
|
@@ -0,0 +1,327 @@
|
|
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) 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
|
+
Endpoints that accept `page` and `per_page` parameters are paginated. They expose
|
35
|
+
four additional fields that contain data about your position in the response,
|
36
|
+
namely `Total`, `Per-Page`, `Link`, and `Page` as described in [RFC-5988](https://tools.ietf.org/html/rfc5988).
|
37
|
+
|
38
|
+
For example, to display 5 results per page and view the second page of a
|
39
|
+
`GET` to `/networks`, your final request would be `GET /networks?....page=2&per_page=5`.
|
40
|
+
|
41
|
+
## Sideloading
|
42
|
+
|
43
|
+
When we return multiple levels of an object graph (e.g. `Provider`s and their `State`s
|
44
|
+
we sideload the associated data. In this example, we would provide an Array of
|
45
|
+
`State`s and a `state_id` for each provider. This is done primarily to reduce the
|
46
|
+
payload size since many of the `Provider`s will share a `State`
|
47
|
+
|
48
|
+
```
|
49
|
+
{
|
50
|
+
providers: [{ id: 1, state_id: 1}, { id: 2, state_id: 1 }],
|
51
|
+
states: [{ id: 1, code: 'NY' }]
|
52
|
+
}
|
53
|
+
```
|
54
|
+
|
55
|
+
If you need the second level of the object graph, you can just match the
|
56
|
+
corresponding id.
|
57
|
+
|
58
|
+
## Selecting specific data
|
59
|
+
|
60
|
+
All endpoints allow you to specify which fields you would like to return.
|
61
|
+
This allows you to limit the response to contain only the data you need.
|
62
|
+
|
63
|
+
For example, let's take a request that returns the following JSON by default
|
64
|
+
|
65
|
+
```
|
66
|
+
{
|
67
|
+
provider: {
|
68
|
+
id: 1,
|
69
|
+
name: 'John',
|
70
|
+
phone: '1234567890',
|
71
|
+
field_we_dont_care_about: 'value_we_dont_care_about'
|
72
|
+
},
|
73
|
+
states: [{
|
74
|
+
id: 1,
|
75
|
+
name: 'New York',
|
76
|
+
code: 'NY',
|
77
|
+
field_we_dont_care_about: 'value_we_dont_care_about'
|
78
|
+
}]
|
79
|
+
}
|
80
|
+
```
|
81
|
+
|
82
|
+
To limit our results to only return the fields we care about, we specify the
|
83
|
+
`select` query string parameter for the corresponding fields in the JSON
|
84
|
+
document.
|
85
|
+
|
86
|
+
In this case, we want to select `name` and `phone` from the `provider` key,
|
87
|
+
so we would add the parameters `select=provider.name,provider.phone`.
|
88
|
+
We also want the `name` and `code` from the `states` key, so we would
|
89
|
+
add the parameters `select=states.name,staes.code`. The id field of
|
90
|
+
each document is always returned whether or not it is requested.
|
91
|
+
|
92
|
+
Our final request would be `GET /providers/12345?select=provider.name,provider.phone,states.name,states.code`
|
93
|
+
|
94
|
+
The response would be
|
95
|
+
|
96
|
+
```
|
97
|
+
{
|
98
|
+
provider: {
|
99
|
+
id: 1,
|
100
|
+
name: 'John',
|
101
|
+
phone: '1234567890'
|
102
|
+
},
|
103
|
+
states: [{
|
104
|
+
id: 1,
|
105
|
+
name: 'New York',
|
106
|
+
code: 'NY'
|
107
|
+
}]
|
108
|
+
}
|
109
|
+
```
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
OpenAPI spec version: 1.0.0
|
114
|
+
|
115
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
116
|
+
|
117
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
118
|
+
you may not use this file except in compliance with the License.
|
119
|
+
You may obtain a copy of the License at
|
120
|
+
|
121
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
122
|
+
|
123
|
+
Unless required by applicable law or agreed to in writing, software
|
124
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
125
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
126
|
+
See the License for the specific language governing permissions and
|
127
|
+
limitations under the License.
|
128
|
+
|
129
|
+
=end
|
130
|
+
|
131
|
+
require 'date'
|
132
|
+
|
133
|
+
module VericredClient
|
134
|
+
|
135
|
+
class ServiceArea
|
136
|
+
# Primary key
|
137
|
+
attr_accessor :id
|
138
|
+
|
139
|
+
# Issuer foreign key
|
140
|
+
attr_accessor :issuer_id
|
141
|
+
|
142
|
+
# Name of the Service Area
|
143
|
+
attr_accessor :name
|
144
|
+
|
145
|
+
|
146
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
147
|
+
def self.attribute_map
|
148
|
+
{
|
149
|
+
:'id' => :'id',
|
150
|
+
:'issuer_id' => :'issuer_id',
|
151
|
+
:'name' => :'name'
|
152
|
+
}
|
153
|
+
end
|
154
|
+
|
155
|
+
# Attribute type mapping.
|
156
|
+
def self.swagger_types
|
157
|
+
{
|
158
|
+
:'id' => :'String',
|
159
|
+
:'issuer_id' => :'String',
|
160
|
+
:'name' => :'String'
|
161
|
+
}
|
162
|
+
end
|
163
|
+
|
164
|
+
# Initializes the object
|
165
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
166
|
+
def initialize(attributes = {})
|
167
|
+
return unless attributes.is_a?(Hash)
|
168
|
+
|
169
|
+
# convert string to symbol for hash key
|
170
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
171
|
+
|
172
|
+
if attributes.has_key?(:'id')
|
173
|
+
self.id = attributes[:'id']
|
174
|
+
end
|
175
|
+
|
176
|
+
if attributes.has_key?(:'issuer_id')
|
177
|
+
self.issuer_id = attributes[:'issuer_id']
|
178
|
+
end
|
179
|
+
|
180
|
+
if attributes.has_key?(:'name')
|
181
|
+
self.name = attributes[:'name']
|
182
|
+
end
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
187
|
+
# @return Array for valid properies with the reasons
|
188
|
+
def list_invalid_properties
|
189
|
+
invalid_properties = Array.new
|
190
|
+
return invalid_properties
|
191
|
+
end
|
192
|
+
|
193
|
+
# Check to see if the all the properties in the model are valid
|
194
|
+
# @return true if the model is valid
|
195
|
+
def valid?
|
196
|
+
return true
|
197
|
+
end
|
198
|
+
|
199
|
+
# Checks equality by comparing each attribute.
|
200
|
+
# @param [Object] Object to be compared
|
201
|
+
def ==(o)
|
202
|
+
return true if self.equal?(o)
|
203
|
+
self.class == o.class &&
|
204
|
+
id == o.id &&
|
205
|
+
issuer_id == o.issuer_id &&
|
206
|
+
name == o.name
|
207
|
+
end
|
208
|
+
|
209
|
+
# @see the `==` method
|
210
|
+
# @param [Object] Object to be compared
|
211
|
+
def eql?(o)
|
212
|
+
self == o
|
213
|
+
end
|
214
|
+
|
215
|
+
# Calculates hash code according to all attributes.
|
216
|
+
# @return [Fixnum] Hash code
|
217
|
+
def hash
|
218
|
+
[id, issuer_id, name].hash
|
219
|
+
end
|
220
|
+
|
221
|
+
# Builds the object from hash
|
222
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
223
|
+
# @return [Object] Returns the model itself
|
224
|
+
def build_from_hash(attributes)
|
225
|
+
return nil unless attributes.is_a?(Hash)
|
226
|
+
self.class.swagger_types.each_pair do |key, type|
|
227
|
+
if type =~ /^Array<(.*)>/i
|
228
|
+
# check to ensure the input is an array given that the the attribute
|
229
|
+
# is documented as an array but the input is not
|
230
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
231
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
232
|
+
end
|
233
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
234
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
235
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
236
|
+
end
|
237
|
+
|
238
|
+
self
|
239
|
+
end
|
240
|
+
|
241
|
+
# Deserializes the data based on type
|
242
|
+
# @param string type Data type
|
243
|
+
# @param string value Value to be deserialized
|
244
|
+
# @return [Object] Deserialized data
|
245
|
+
def _deserialize(type, value)
|
246
|
+
case type.to_sym
|
247
|
+
when :DateTime
|
248
|
+
DateTime.parse(value)
|
249
|
+
when :Date
|
250
|
+
Date.parse(value)
|
251
|
+
when :String
|
252
|
+
value.to_s
|
253
|
+
when :Integer
|
254
|
+
value.to_i
|
255
|
+
when :Float
|
256
|
+
value.to_f
|
257
|
+
when :BOOLEAN
|
258
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
259
|
+
true
|
260
|
+
else
|
261
|
+
false
|
262
|
+
end
|
263
|
+
when :Object
|
264
|
+
# generic object (usually a Hash), return directly
|
265
|
+
value
|
266
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
267
|
+
inner_type = Regexp.last_match[:inner_type]
|
268
|
+
value.map { |v| _deserialize(inner_type, v) }
|
269
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
270
|
+
k_type = Regexp.last_match[:k_type]
|
271
|
+
v_type = Regexp.last_match[:v_type]
|
272
|
+
{}.tap do |hash|
|
273
|
+
value.each do |k, v|
|
274
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
275
|
+
end
|
276
|
+
end
|
277
|
+
else # model
|
278
|
+
temp_model = VericredClient.const_get(type).new
|
279
|
+
temp_model.build_from_hash(value)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
# Returns the string representation of the object
|
284
|
+
# @return [String] String presentation of the object
|
285
|
+
def to_s
|
286
|
+
to_hash.to_s
|
287
|
+
end
|
288
|
+
|
289
|
+
# to_body is an alias to to_hash (backward compatibility)
|
290
|
+
# @return [Hash] Returns the object in the form of hash
|
291
|
+
def to_body
|
292
|
+
to_hash
|
293
|
+
end
|
294
|
+
|
295
|
+
# Returns the object in the form of hash
|
296
|
+
# @return [Hash] Returns the object in the form of hash
|
297
|
+
def to_hash
|
298
|
+
hash = {}
|
299
|
+
self.class.attribute_map.each_pair do |attr, param|
|
300
|
+
value = self.send(attr)
|
301
|
+
next if value.nil?
|
302
|
+
hash[param] = _to_hash(value)
|
303
|
+
end
|
304
|
+
hash
|
305
|
+
end
|
306
|
+
|
307
|
+
# Outputs non-array value in the form of hash
|
308
|
+
# For object, use to_hash. Otherwise, just return the value
|
309
|
+
# @param [Object] value Any valid value
|
310
|
+
# @return [Hash] Returns the value in the form of hash
|
311
|
+
def _to_hash(value)
|
312
|
+
if value.is_a?(Array)
|
313
|
+
value.compact.map{ |v| _to_hash(v) }
|
314
|
+
elsif value.is_a?(Hash)
|
315
|
+
{}.tap do |hash|
|
316
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
317
|
+
end
|
318
|
+
elsif value.respond_to? :to_hash
|
319
|
+
value.to_hash
|
320
|
+
else
|
321
|
+
value
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
end
|
326
|
+
|
327
|
+
end
|