vericred_client 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +225 -0
- data/docs/Applicant.md +14 -0
- data/docs/Carrier.md +10 -0
- data/docs/CarrierSubsidiary.md +9 -0
- data/docs/County.md +16 -0
- data/docs/Drug.md +10 -0
- data/docs/DrugCoverage.md +13 -0
- data/docs/DrugCoverageApi.md +60 -0
- data/docs/InlineResponse200.md +9 -0
- data/docs/InlineResponse2001.md +8 -0
- data/docs/InlineResponse2002.md +10 -0
- data/docs/Plan.md +53 -0
- data/docs/PlanCounty.md +10 -0
- data/docs/PlanSearchResult.md +54 -0
- data/docs/PlansApi.md +118 -0
- data/docs/Pricing.md +12 -0
- data/docs/Provider.md +31 -0
- data/docs/ProvidersApi.md +135 -0
- data/docs/Query.md +15 -0
- data/docs/RatingArea.md +9 -0
- data/docs/State.md +15 -0
- data/docs/ZipCode.md +9 -0
- data/docs/ZipCountiesApi.md +63 -0
- data/docs/ZipCounty.md +10 -0
- data/lib/vericred_client/api/drug_coverage_api.rb +201 -0
- data/lib/vericred_client/api/plans_api.rb +317 -0
- data/lib/vericred_client/api/providers_api.rb +303 -0
- data/lib/vericred_client/api/zip_counties_api.rb +208 -0
- data/lib/vericred_client/api_client.rb +474 -0
- data/lib/vericred_client/api_error.rb +149 -0
- data/lib/vericred_client/configuration.rb +163 -0
- data/lib/vericred_client/models/applicant.rb +358 -0
- data/lib/vericred_client/models/carrier.rb +318 -0
- data/lib/vericred_client/models/carrier_subsidiary.rb +308 -0
- data/lib/vericred_client/models/county.rb +360 -0
- data/lib/vericred_client/models/drug.rb +318 -0
- data/lib/vericred_client/models/drug_coverage.rb +348 -0
- data/lib/vericred_client/models/inline_response_200.rb +308 -0
- data/lib/vericred_client/models/inline_response_200_1.rb +297 -0
- data/lib/vericred_client/models/inline_response_200_2.rb +321 -0
- data/lib/vericred_client/models/plan.rb +748 -0
- data/lib/vericred_client/models/plan_county.rb +318 -0
- data/lib/vericred_client/models/plan_search_result.rb +758 -0
- data/lib/vericred_client/models/pricing.rb +338 -0
- data/lib/vericred_client/models/provider.rb +528 -0
- data/lib/vericred_client/models/query.rb +364 -0
- data/lib/vericred_client/models/rating_area.rb +308 -0
- data/lib/vericred_client/models/state.rb +368 -0
- data/lib/vericred_client/models/zip_code.rb +308 -0
- data/lib/vericred_client/models/zip_county.rb +318 -0
- data/lib/vericred_client/version.rb +128 -0
- data/lib/vericred_client.rb +175 -0
- data/spec/api/drug_coverage_api_spec.rb +168 -0
- data/spec/api/plans_api_spec.rb +226 -0
- data/spec/api/providers_api_spec.rb +202 -0
- data/spec/api/zip_counties_api_spec.rb +171 -0
- data/vericred_client.gemspec +31 -0
- metadata +285 -0
@@ -0,0 +1,149 @@
|
|
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:
|
120
|
+
|
121
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
122
|
+
|
123
|
+
|
124
|
+
=end
|
125
|
+
|
126
|
+
module VericredClient
|
127
|
+
class ApiError < StandardError
|
128
|
+
attr_reader :code, :response_headers, :response_body
|
129
|
+
|
130
|
+
# Usage examples:
|
131
|
+
# ApiError.new
|
132
|
+
# ApiError.new("message")
|
133
|
+
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
134
|
+
# ApiError.new(:code => 404, :message => "Not Found")
|
135
|
+
def initialize(arg = nil)
|
136
|
+
if arg.is_a? Hash
|
137
|
+
arg.each do |k, v|
|
138
|
+
if k.to_s == 'message'
|
139
|
+
super v
|
140
|
+
else
|
141
|
+
instance_variable_set "@#{k}", v
|
142
|
+
end
|
143
|
+
end
|
144
|
+
else
|
145
|
+
super arg
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
@@ -0,0 +1,163 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module VericredClient
|
4
|
+
class Configuration
|
5
|
+
# Defines url scheme
|
6
|
+
attr_accessor :scheme
|
7
|
+
|
8
|
+
# Defines url host
|
9
|
+
attr_accessor :host
|
10
|
+
|
11
|
+
# Defines url base path
|
12
|
+
attr_accessor :base_path
|
13
|
+
|
14
|
+
# Defines API keys used with API Key authentications.
|
15
|
+
#
|
16
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
17
|
+
#
|
18
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
19
|
+
# config.api_key['api_key'] = 'xxx'
|
20
|
+
attr_accessor :api_key
|
21
|
+
|
22
|
+
# Defines API key prefixes used with API Key authentications.
|
23
|
+
#
|
24
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
25
|
+
#
|
26
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
27
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
28
|
+
attr_accessor :api_key_prefix
|
29
|
+
|
30
|
+
# Defines the username used with HTTP basic authentication.
|
31
|
+
#
|
32
|
+
# @return [String]
|
33
|
+
attr_accessor :username
|
34
|
+
|
35
|
+
# Defines the password used with HTTP basic authentication.
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :password
|
39
|
+
|
40
|
+
# Defines the access token (Bearer) used with OAuth2.
|
41
|
+
attr_accessor :access_token
|
42
|
+
|
43
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
44
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
45
|
+
# Default to false.
|
46
|
+
#
|
47
|
+
# @return [true, false]
|
48
|
+
attr_accessor :debugging
|
49
|
+
|
50
|
+
# Defines the logger used for debugging.
|
51
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
52
|
+
#
|
53
|
+
# @return [#debug]
|
54
|
+
attr_accessor :logger
|
55
|
+
|
56
|
+
# Defines the temporary folder to store downloaded files
|
57
|
+
# (for API endpoints that have file response).
|
58
|
+
# Default to use `Tempfile`.
|
59
|
+
#
|
60
|
+
# @return [String]
|
61
|
+
attr_accessor :temp_folder_path
|
62
|
+
|
63
|
+
# The time limit for HTTP request in seconds.
|
64
|
+
# Default to 0 (never times out).
|
65
|
+
attr_accessor :timeout
|
66
|
+
|
67
|
+
### TLS/SSL
|
68
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
69
|
+
# Default to true.
|
70
|
+
#
|
71
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
72
|
+
#
|
73
|
+
# @return [true, false]
|
74
|
+
attr_accessor :verify_ssl
|
75
|
+
|
76
|
+
# Set this to customize the certificate file to verify the peer.
|
77
|
+
#
|
78
|
+
# @return [String] the path to the certificate file
|
79
|
+
#
|
80
|
+
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
81
|
+
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
82
|
+
attr_accessor :ssl_ca_cert
|
83
|
+
|
84
|
+
# Client certificate file (for client certificate)
|
85
|
+
attr_accessor :cert_file
|
86
|
+
|
87
|
+
# Client private key file (for client certificate)
|
88
|
+
attr_accessor :key_file
|
89
|
+
|
90
|
+
attr_accessor :inject_format
|
91
|
+
|
92
|
+
attr_accessor :force_ending_format
|
93
|
+
|
94
|
+
def initialize
|
95
|
+
@scheme = 'https'
|
96
|
+
@host = 'api.vericred.com'
|
97
|
+
@base_path = '/'
|
98
|
+
@api_key = {}
|
99
|
+
@api_key_prefix = {}
|
100
|
+
@timeout = 0
|
101
|
+
@verify_ssl = true
|
102
|
+
@cert_file = nil
|
103
|
+
@key_file = nil
|
104
|
+
@debugging = false
|
105
|
+
@inject_format = false
|
106
|
+
@force_ending_format = false
|
107
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
108
|
+
|
109
|
+
yield(self) if block_given?
|
110
|
+
end
|
111
|
+
|
112
|
+
# The default Configuration object.
|
113
|
+
def self.default
|
114
|
+
@@default ||= Configuration.new
|
115
|
+
end
|
116
|
+
|
117
|
+
def configure
|
118
|
+
yield(self) if block_given?
|
119
|
+
end
|
120
|
+
|
121
|
+
def scheme=(scheme)
|
122
|
+
# remove :// from scheme
|
123
|
+
@scheme = scheme.sub(/:\/\//, '')
|
124
|
+
end
|
125
|
+
|
126
|
+
def host=(host)
|
127
|
+
# remove http(s):// and anything after a slash
|
128
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
129
|
+
end
|
130
|
+
|
131
|
+
def base_path=(base_path)
|
132
|
+
# Add leading and trailing slashes to base_path
|
133
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
134
|
+
@base_path = "" if @base_path == "/"
|
135
|
+
end
|
136
|
+
|
137
|
+
def base_url
|
138
|
+
url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
139
|
+
URI.encode(url)
|
140
|
+
end
|
141
|
+
|
142
|
+
# Gets API key (with prefix if set).
|
143
|
+
# @param [String] param_name the parameter name of API key auth
|
144
|
+
def api_key_with_prefix(param_name)
|
145
|
+
if @api_key_prefix[param_name]
|
146
|
+
"#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
|
147
|
+
else
|
148
|
+
@api_key[param_name]
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# Gets Basic Auth token string
|
153
|
+
def basic_auth_token
|
154
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
155
|
+
end
|
156
|
+
|
157
|
+
# Returns Auth Settings hash for api client.
|
158
|
+
def auth_settings
|
159
|
+
{
|
160
|
+
}
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
@@ -0,0 +1,358 @@
|
|
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:
|
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 Applicant
|
130
|
+
# Primary key
|
131
|
+
attr_accessor :id
|
132
|
+
|
133
|
+
# Date of Birth
|
134
|
+
attr_accessor :dob
|
135
|
+
|
136
|
+
# Foreign key to members
|
137
|
+
attr_accessor :member_id
|
138
|
+
|
139
|
+
# Full name of the Applicant
|
140
|
+
attr_accessor :name
|
141
|
+
|
142
|
+
# Relationship of the Applicant to the Member
|
143
|
+
attr_accessor :relationship
|
144
|
+
|
145
|
+
# Does the Applicant smoke?
|
146
|
+
attr_accessor :smoker
|
147
|
+
|
148
|
+
# Applicant's Social Security Number
|
149
|
+
attr_accessor :ssn
|
150
|
+
|
151
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
152
|
+
def self.attribute_map
|
153
|
+
{
|
154
|
+
:'id' => :'id',
|
155
|
+
:'dob' => :'dob',
|
156
|
+
:'member_id' => :'member_id',
|
157
|
+
:'name' => :'name',
|
158
|
+
:'relationship' => :'relationship',
|
159
|
+
:'smoker' => :'smoker',
|
160
|
+
:'ssn' => :'ssn'
|
161
|
+
}
|
162
|
+
end
|
163
|
+
|
164
|
+
# Attribute type mapping.
|
165
|
+
def self.swagger_types
|
166
|
+
{
|
167
|
+
:'id' => :'Integer',
|
168
|
+
:'dob' => :'Date',
|
169
|
+
:'member_id' => :'String',
|
170
|
+
:'name' => :'String',
|
171
|
+
:'relationship' => :'String',
|
172
|
+
:'smoker' => :'BOOLEAN',
|
173
|
+
:'ssn' => :'String'
|
174
|
+
}
|
175
|
+
end
|
176
|
+
|
177
|
+
# Initializes the object
|
178
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
179
|
+
def initialize(attributes = {})
|
180
|
+
return unless attributes.is_a?(Hash)
|
181
|
+
|
182
|
+
# convert string to symbol for hash key
|
183
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
184
|
+
|
185
|
+
if attributes.has_key?(:'id')
|
186
|
+
self.id = attributes[:'id']
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.has_key?(:'dob')
|
190
|
+
self.dob = attributes[:'dob']
|
191
|
+
end
|
192
|
+
|
193
|
+
if attributes.has_key?(:'member_id')
|
194
|
+
self.member_id = attributes[:'member_id']
|
195
|
+
end
|
196
|
+
|
197
|
+
if attributes.has_key?(:'name')
|
198
|
+
self.name = attributes[:'name']
|
199
|
+
end
|
200
|
+
|
201
|
+
if attributes.has_key?(:'relationship')
|
202
|
+
self.relationship = attributes[:'relationship']
|
203
|
+
end
|
204
|
+
|
205
|
+
if attributes.has_key?(:'smoker')
|
206
|
+
self.smoker = attributes[:'smoker']
|
207
|
+
end
|
208
|
+
|
209
|
+
if attributes.has_key?(:'ssn')
|
210
|
+
self.ssn = attributes[:'ssn']
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
|
215
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
216
|
+
# @return Array for valid properies with the reasons
|
217
|
+
def list_invalid_properties
|
218
|
+
invalid_properties = Array.new
|
219
|
+
return invalid_properties
|
220
|
+
end
|
221
|
+
|
222
|
+
# Check to see if the all the properties in the model are valid
|
223
|
+
# @return true if the model is valid
|
224
|
+
def valid?
|
225
|
+
end
|
226
|
+
|
227
|
+
# Checks equality by comparing each attribute.
|
228
|
+
# @param [Object] Object to be compared
|
229
|
+
def ==(o)
|
230
|
+
return true if self.equal?(o)
|
231
|
+
self.class == o.class &&
|
232
|
+
id == o.id &&
|
233
|
+
dob == o.dob &&
|
234
|
+
member_id == o.member_id &&
|
235
|
+
name == o.name &&
|
236
|
+
relationship == o.relationship &&
|
237
|
+
smoker == o.smoker &&
|
238
|
+
ssn == o.ssn
|
239
|
+
end
|
240
|
+
|
241
|
+
# @see the `==` method
|
242
|
+
# @param [Object] Object to be compared
|
243
|
+
def eql?(o)
|
244
|
+
self == o
|
245
|
+
end
|
246
|
+
|
247
|
+
# Calculates hash code according to all attributes.
|
248
|
+
# @return [Fixnum] Hash code
|
249
|
+
def hash
|
250
|
+
[id, dob, member_id, name, relationship, smoker, ssn].hash
|
251
|
+
end
|
252
|
+
|
253
|
+
# Builds the object from hash
|
254
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
255
|
+
# @return [Object] Returns the model itself
|
256
|
+
def build_from_hash(attributes)
|
257
|
+
return nil unless attributes.is_a?(Hash)
|
258
|
+
self.class.swagger_types.each_pair do |key, type|
|
259
|
+
if type =~ /^Array<(.*)>/i
|
260
|
+
# check to ensure the input is an array given that the the attribute
|
261
|
+
# is documented as an array but the input is not
|
262
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
263
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
264
|
+
end
|
265
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
266
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
267
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
268
|
+
end
|
269
|
+
|
270
|
+
self
|
271
|
+
end
|
272
|
+
|
273
|
+
# Deserializes the data based on type
|
274
|
+
# @param string type Data type
|
275
|
+
# @param string value Value to be deserialized
|
276
|
+
# @return [Object] Deserialized data
|
277
|
+
def _deserialize(type, value)
|
278
|
+
case type.to_sym
|
279
|
+
when :DateTime
|
280
|
+
DateTime.parse(value)
|
281
|
+
when :Date
|
282
|
+
Date.parse(value)
|
283
|
+
when :String
|
284
|
+
value.to_s
|
285
|
+
when :Integer
|
286
|
+
value.to_i
|
287
|
+
when :Float
|
288
|
+
value.to_f
|
289
|
+
when :BOOLEAN
|
290
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
291
|
+
true
|
292
|
+
else
|
293
|
+
false
|
294
|
+
end
|
295
|
+
when :Object
|
296
|
+
# generic object (usually a Hash), return directly
|
297
|
+
value
|
298
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
299
|
+
inner_type = Regexp.last_match[:inner_type]
|
300
|
+
value.map { |v| _deserialize(inner_type, v) }
|
301
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
302
|
+
k_type = Regexp.last_match[:k_type]
|
303
|
+
v_type = Regexp.last_match[:v_type]
|
304
|
+
{}.tap do |hash|
|
305
|
+
value.each do |k, v|
|
306
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
307
|
+
end
|
308
|
+
end
|
309
|
+
else # model
|
310
|
+
temp_model = VericredClient.const_get(type).new
|
311
|
+
temp_model.build_from_hash(value)
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
# Returns the string representation of the object
|
316
|
+
# @return [String] String presentation of the object
|
317
|
+
def to_s
|
318
|
+
to_hash.to_s
|
319
|
+
end
|
320
|
+
|
321
|
+
# to_body is an alias to to_hash (backward compatibility)
|
322
|
+
# @return [Hash] Returns the object in the form of hash
|
323
|
+
def to_body
|
324
|
+
to_hash
|
325
|
+
end
|
326
|
+
|
327
|
+
# Returns the object in the form of hash
|
328
|
+
# @return [Hash] Returns the object in the form of hash
|
329
|
+
def to_hash
|
330
|
+
hash = {}
|
331
|
+
self.class.attribute_map.each_pair do |attr, param|
|
332
|
+
value = self.send(attr)
|
333
|
+
next if value.nil?
|
334
|
+
hash[param] = _to_hash(value)
|
335
|
+
end
|
336
|
+
hash
|
337
|
+
end
|
338
|
+
|
339
|
+
# Outputs non-array value in the form of hash
|
340
|
+
# For object, use to_hash. Otherwise, just return the value
|
341
|
+
# @param [Object] value Any valid value
|
342
|
+
# @return [Hash] Returns the value in the form of hash
|
343
|
+
def _to_hash(value)
|
344
|
+
if value.is_a?(Array)
|
345
|
+
value.compact.map{ |v| _to_hash(v) }
|
346
|
+
elsif value.is_a?(Hash)
|
347
|
+
{}.tap do |hash|
|
348
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
349
|
+
end
|
350
|
+
elsif value.respond_to? :to_hash
|
351
|
+
value.to_hash
|
352
|
+
else
|
353
|
+
value
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
end
|
358
|
+
end
|