vericred_client 0.0.4 → 0.0.5

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.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -18
  3. data/docs/Applicant.md +3 -3
  4. data/docs/Carrier.md +1 -1
  5. data/docs/County.md +3 -3
  6. data/docs/Drug.md +3 -3
  7. data/docs/DrugCoverage.md +4 -4
  8. data/docs/DrugCoverageResponse.md +3 -1
  9. data/docs/DrugPackage.md +1 -1
  10. data/docs/DrugSearchResponse.md +2 -1
  11. data/docs/DrugsApi.md +71 -10
  12. data/docs/Meta.md +1 -1
  13. data/docs/Network.md +9 -0
  14. data/docs/NetworkSearchResponse.md +9 -0
  15. data/docs/NetworksApi.md +58 -0
  16. data/docs/Plan.md +10 -10
  17. data/docs/PlanCounty.md +1 -1
  18. data/docs/PlanCountyBulk.md +1 -1
  19. data/docs/{PlanFindResponse.md → PlanSearchResponse.md} +2 -1
  20. data/docs/PlanSearchResult.md +14 -14
  21. data/docs/PlansApi.md +69 -6
  22. data/docs/Provider.md +7 -6
  23. data/docs/ProvidersApi.md +39 -30
  24. data/docs/{ProviderResponse.md → ProvidersSearchResponse.md} +1 -1
  25. data/docs/RequestPlanFind.md +3 -2
  26. data/docs/RequestPlanFindApplicant.md +8 -0
  27. data/docs/RequestPlanFindProvider.md +8 -0
  28. data/docs/RequestProvidersSearch.md +17 -0
  29. data/docs/State.md +4 -4
  30. data/docs/ZipCountiesApi.md +11 -4
  31. data/docs/ZipCountiesResponse.md +11 -0
  32. data/docs/ZipCountyBulk.md +1 -1
  33. data/docs/ZipCountyResponse.md +2 -1
  34. data/lib/vericred_client/api/drugs_api.rb +86 -14
  35. data/lib/vericred_client/api/networks_api.rb +198 -0
  36. data/lib/vericred_client/api/plans_api.rb +134 -14
  37. data/lib/vericred_client/api/providers_api.rb +65 -59
  38. data/lib/vericred_client/api/zip_counties_api.rb +8 -5
  39. data/lib/vericred_client/api_client.rb +1 -1
  40. data/lib/vericred_client/api_error.rb +1 -1
  41. data/lib/vericred_client/models/applicant.rb +13 -15
  42. data/lib/vericred_client/models/base.rb +1 -1
  43. data/lib/vericred_client/models/carrier.rb +15 -15
  44. data/lib/vericred_client/models/carrier_subsidiary.rb +1 -1
  45. data/lib/vericred_client/models/county.rb +12 -16
  46. data/lib/vericred_client/models/county_bulk.rb +1 -1
  47. data/lib/vericred_client/models/drug.rb +26 -26
  48. data/lib/vericred_client/models/drug_coverage.rb +32 -38
  49. data/lib/vericred_client/models/drug_coverage_response.rb +40 -16
  50. data/lib/vericred_client/models/drug_package.rb +15 -15
  51. data/lib/vericred_client/models/drug_search_response.rb +21 -9
  52. data/lib/vericred_client/models/meta.rb +8 -8
  53. data/lib/vericred_client/models/network.rb +308 -0
  54. data/lib/vericred_client/models/{plan_find_response.rb → network_search_response.rb} +11 -11
  55. data/lib/vericred_client/models/plan.rb +62 -72
  56. data/lib/vericred_client/models/plan_county.rb +15 -15
  57. data/lib/vericred_client/models/plan_county_bulk.rb +15 -15
  58. data/lib/vericred_client/models/plan_search_response.rb +322 -0
  59. data/lib/vericred_client/models/plan_search_result.rb +102 -112
  60. data/lib/vericred_client/models/pricing.rb +1 -1
  61. data/lib/vericred_client/models/provider.rb +24 -22
  62. data/lib/vericred_client/models/{provider_response.rb → providers_search_response.rb} +2 -2
  63. data/lib/vericred_client/models/rating_area.rb +1 -1
  64. data/lib/vericred_client/models/request_plan_find.rb +16 -4
  65. data/lib/vericred_client/models/request_plan_find_applicant.rb +298 -0
  66. data/lib/vericred_client/models/request_plan_find_provider.rb +298 -0
  67. data/lib/vericred_client/models/request_providers_search.rb +372 -0
  68. data/lib/vericred_client/models/state.rb +25 -29
  69. data/lib/vericred_client/models/zip_code.rb +1 -1
  70. data/lib/vericred_client/models/zip_counties_response.rb +336 -0
  71. data/lib/vericred_client/models/zip_county.rb +1 -1
  72. data/lib/vericred_client/models/zip_county_bulk.rb +12 -12
  73. data/lib/vericred_client/models/zip_county_response.rb +21 -11
  74. data/lib/vericred_client/version.rb +2 -2
  75. data/lib/vericred_client.rb +10 -3
  76. data/spec/api/drugs_api_spec.rb +26 -5
  77. data/spec/api/networks_api_spec.rb +166 -0
  78. data/spec/api/plans_api_spec.rb +66 -6
  79. data/spec/api/providers_api_spec.rb +27 -19
  80. data/spec/api/zip_counties_api_spec.rb +4 -3
  81. metadata +22 -6
@@ -6,7 +6,7 @@ accepts.
6
6
 
7
7
  ## Getting Started
8
8
 
9
- Visit our [Developer Portal](https://vericred.3scale.net/access_code?access_code=vericred&cms_token=3545ca52af07bde85b7c0c3aa9d1985e) to
9
+ Visit our [Developer Portal](https://vericred.3scale.net) to
10
10
  create an account.
11
11
 
12
12
  Once you have created an account, you can create one Application for
@@ -6,7 +6,7 @@ accepts.
6
6
 
7
7
  ## Getting Started
8
8
 
9
- Visit our [Developer Portal](https://vericred.3scale.net/access_code?access_code=vericred&cms_token=3545ca52af07bde85b7c0c3aa9d1985e) to
9
+ Visit our [Developer Portal](https://vericred.3scale.net) to
10
10
  create an account.
11
11
 
12
12
  Once you have created an account, you can create one Application for
@@ -133,6 +133,9 @@ module VericredClient
133
133
  # Date of enrollment
134
134
  attr_accessor :enrollment_date
135
135
 
136
+ # National Drug Code Package Id
137
+ attr_accessor :drug_packages
138
+
136
139
  # County code to determine eligibility
137
140
  attr_accessor :fips_code
138
141
 
@@ -156,6 +159,7 @@ module VericredClient
156
159
  {
157
160
  :'applicants' => :'applicants',
158
161
  :'enrollment_date' => :'enrollment_date',
162
+ :'drug_packages' => :'drug_packages',
159
163
  :'fips_code' => :'fips_code',
160
164
  :'household_income' => :'household_income',
161
165
  :'household_size' => :'household_size',
@@ -168,13 +172,14 @@ module VericredClient
168
172
  # Attribute type mapping.
169
173
  def self.swagger_types
170
174
  {
171
- :'applicants' => :'Array<Applicant>',
175
+ :'applicants' => :'Array<RequestPlanFindApplicant>',
172
176
  :'enrollment_date' => :'String',
177
+ :'drug_packages' => :'Array<DrugPackage>',
173
178
  :'fips_code' => :'String',
174
179
  :'household_income' => :'Integer',
175
180
  :'household_size' => :'Integer',
176
181
  :'market' => :'String',
177
- :'providers' => :'Array<Provider>',
182
+ :'providers' => :'Array<RequestPlanFindProvider>',
178
183
  :'zip_code' => :'String'
179
184
  }
180
185
  end
@@ -197,6 +202,12 @@ module VericredClient
197
202
  self.enrollment_date = attributes[:'enrollment_date']
198
203
  end
199
204
 
205
+ if attributes.has_key?(:'drug_packages')
206
+ if (value = attributes[:'drug_packages']).is_a?(Array)
207
+ self.drug_packages = value
208
+ end
209
+ end
210
+
200
211
  if attributes.has_key?(:'fips_code')
201
212
  self.fips_code = attributes[:'fips_code']
202
213
  end
@@ -244,6 +255,7 @@ module VericredClient
244
255
  self.class == o.class &&
245
256
  applicants == o.applicants &&
246
257
  enrollment_date == o.enrollment_date &&
258
+ drug_packages == o.drug_packages &&
247
259
  fips_code == o.fips_code &&
248
260
  household_income == o.household_income &&
249
261
  household_size == o.household_size &&
@@ -261,7 +273,7 @@ module VericredClient
261
273
  # Calculates hash code according to all attributes.
262
274
  # @return [Fixnum] Hash code
263
275
  def hash
264
- [applicants, enrollment_date, fips_code, household_income, household_size, market, providers, zip_code].hash
276
+ [applicants, enrollment_date, drug_packages, fips_code, household_income, household_size, market, providers, zip_code].hash
265
277
  end
266
278
 
267
279
  # Builds the object from hash
@@ -0,0 +1,298 @@
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
+ 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 RequestPlanFindApplicant
130
+ # Age of applicant to search for
131
+ attr_accessor :age
132
+
133
+ # Attribute mapping from ruby-style variable name to JSON key.
134
+ def self.attribute_map
135
+ {
136
+ :'age' => :'age'
137
+ }
138
+ end
139
+
140
+ # Attribute type mapping.
141
+ def self.swagger_types
142
+ {
143
+ :'age' => :'Integer'
144
+ }
145
+ end
146
+
147
+ # Initializes the object
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ def initialize(attributes = {})
150
+ return unless attributes.is_a?(Hash)
151
+
152
+ # convert string to symbol for hash key
153
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
154
+
155
+ if attributes.has_key?(:'age')
156
+ self.age = attributes[:'age']
157
+ end
158
+
159
+ end
160
+
161
+ # Show invalid properties with the reasons. Usually used together with valid?
162
+ # @return Array for valid properies with the reasons
163
+ def list_invalid_properties
164
+ invalid_properties = Array.new
165
+ return invalid_properties
166
+ end
167
+
168
+ # Check to see if the all the properties in the model are valid
169
+ # @return true if the model is valid
170
+ def valid?
171
+ end
172
+
173
+ # Checks equality by comparing each attribute.
174
+ # @param [Object] Object to be compared
175
+ def ==(o)
176
+ return true if self.equal?(o)
177
+ self.class == o.class &&
178
+ age == o.age
179
+ end
180
+
181
+ # @see the `==` method
182
+ # @param [Object] Object to be compared
183
+ def eql?(o)
184
+ self == o
185
+ end
186
+
187
+ # Calculates hash code according to all attributes.
188
+ # @return [Fixnum] Hash code
189
+ def hash
190
+ [age].hash
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def build_from_hash(attributes)
197
+ return nil unless attributes.is_a?(Hash)
198
+ self.class.swagger_types.each_pair do |key, type|
199
+ if type =~ /^Array<(.*)>/i
200
+ # check to ensure the input is an array given that the the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
203
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
204
+ end
205
+ elsif !attributes[self.class.attribute_map[key]].nil?
206
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
207
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
208
+ end
209
+
210
+ self
211
+ end
212
+
213
+ # Deserializes the data based on type
214
+ # @param string type Data type
215
+ # @param string value Value to be deserialized
216
+ # @return [Object] Deserialized data
217
+ def _deserialize(type, value)
218
+ case type.to_sym
219
+ when :DateTime
220
+ DateTime.parse(value)
221
+ when :Date
222
+ Date.parse(value)
223
+ when :String
224
+ value.to_s
225
+ when :Integer
226
+ value.to_i
227
+ when :Float
228
+ value.to_f
229
+ when :BOOLEAN
230
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
231
+ true
232
+ else
233
+ false
234
+ end
235
+ when :Object
236
+ # generic object (usually a Hash), return directly
237
+ value
238
+ when /\AArray<(?<inner_type>.+)>\z/
239
+ inner_type = Regexp.last_match[:inner_type]
240
+ value.map { |v| _deserialize(inner_type, v) }
241
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
242
+ k_type = Regexp.last_match[:k_type]
243
+ v_type = Regexp.last_match[:v_type]
244
+ {}.tap do |hash|
245
+ value.each do |k, v|
246
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
247
+ end
248
+ end
249
+ else # model
250
+ temp_model = VericredClient.const_get(type).new
251
+ temp_model.build_from_hash(value)
252
+ end
253
+ end
254
+
255
+ # Returns the string representation of the object
256
+ # @return [String] String presentation of the object
257
+ def to_s
258
+ to_hash.to_s
259
+ end
260
+
261
+ # to_body is an alias to to_hash (backward compatibility)
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_body
264
+ to_hash
265
+ end
266
+
267
+ # Returns the object in the form of hash
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_hash
270
+ hash = {}
271
+ self.class.attribute_map.each_pair do |attr, param|
272
+ value = self.send(attr)
273
+ next if value.nil?
274
+ hash[param] = _to_hash(value)
275
+ end
276
+ hash
277
+ end
278
+
279
+ # Outputs non-array value in the form of hash
280
+ # For object, use to_hash. Otherwise, just return the value
281
+ # @param [Object] value Any valid value
282
+ # @return [Hash] Returns the value in the form of hash
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map{ |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+
297
+ end
298
+ end
@@ -0,0 +1,298 @@
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
+ 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 RequestPlanFindProvider
130
+ # NPI of provider to search for
131
+ attr_accessor :npi
132
+
133
+ # Attribute mapping from ruby-style variable name to JSON key.
134
+ def self.attribute_map
135
+ {
136
+ :'npi' => :'npi'
137
+ }
138
+ end
139
+
140
+ # Attribute type mapping.
141
+ def self.swagger_types
142
+ {
143
+ :'npi' => :'Integer'
144
+ }
145
+ end
146
+
147
+ # Initializes the object
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ def initialize(attributes = {})
150
+ return unless attributes.is_a?(Hash)
151
+
152
+ # convert string to symbol for hash key
153
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
154
+
155
+ if attributes.has_key?(:'npi')
156
+ self.npi = attributes[:'npi']
157
+ end
158
+
159
+ end
160
+
161
+ # Show invalid properties with the reasons. Usually used together with valid?
162
+ # @return Array for valid properies with the reasons
163
+ def list_invalid_properties
164
+ invalid_properties = Array.new
165
+ return invalid_properties
166
+ end
167
+
168
+ # Check to see if the all the properties in the model are valid
169
+ # @return true if the model is valid
170
+ def valid?
171
+ end
172
+
173
+ # Checks equality by comparing each attribute.
174
+ # @param [Object] Object to be compared
175
+ def ==(o)
176
+ return true if self.equal?(o)
177
+ self.class == o.class &&
178
+ npi == o.npi
179
+ end
180
+
181
+ # @see the `==` method
182
+ # @param [Object] Object to be compared
183
+ def eql?(o)
184
+ self == o
185
+ end
186
+
187
+ # Calculates hash code according to all attributes.
188
+ # @return [Fixnum] Hash code
189
+ def hash
190
+ [npi].hash
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def build_from_hash(attributes)
197
+ return nil unless attributes.is_a?(Hash)
198
+ self.class.swagger_types.each_pair do |key, type|
199
+ if type =~ /^Array<(.*)>/i
200
+ # check to ensure the input is an array given that the the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
203
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
204
+ end
205
+ elsif !attributes[self.class.attribute_map[key]].nil?
206
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
207
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
208
+ end
209
+
210
+ self
211
+ end
212
+
213
+ # Deserializes the data based on type
214
+ # @param string type Data type
215
+ # @param string value Value to be deserialized
216
+ # @return [Object] Deserialized data
217
+ def _deserialize(type, value)
218
+ case type.to_sym
219
+ when :DateTime
220
+ DateTime.parse(value)
221
+ when :Date
222
+ Date.parse(value)
223
+ when :String
224
+ value.to_s
225
+ when :Integer
226
+ value.to_i
227
+ when :Float
228
+ value.to_f
229
+ when :BOOLEAN
230
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
231
+ true
232
+ else
233
+ false
234
+ end
235
+ when :Object
236
+ # generic object (usually a Hash), return directly
237
+ value
238
+ when /\AArray<(?<inner_type>.+)>\z/
239
+ inner_type = Regexp.last_match[:inner_type]
240
+ value.map { |v| _deserialize(inner_type, v) }
241
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
242
+ k_type = Regexp.last_match[:k_type]
243
+ v_type = Regexp.last_match[:v_type]
244
+ {}.tap do |hash|
245
+ value.each do |k, v|
246
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
247
+ end
248
+ end
249
+ else # model
250
+ temp_model = VericredClient.const_get(type).new
251
+ temp_model.build_from_hash(value)
252
+ end
253
+ end
254
+
255
+ # Returns the string representation of the object
256
+ # @return [String] String presentation of the object
257
+ def to_s
258
+ to_hash.to_s
259
+ end
260
+
261
+ # to_body is an alias to to_hash (backward compatibility)
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_body
264
+ to_hash
265
+ end
266
+
267
+ # Returns the object in the form of hash
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_hash
270
+ hash = {}
271
+ self.class.attribute_map.each_pair do |attr, param|
272
+ value = self.send(attr)
273
+ next if value.nil?
274
+ hash[param] = _to_hash(value)
275
+ end
276
+ hash
277
+ end
278
+
279
+ # Outputs non-array value in the form of hash
280
+ # For object, use to_hash. Otherwise, just return the value
281
+ # @param [Object] value Any valid value
282
+ # @return [Hash] Returns the value in the form of hash
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map{ |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+
297
+ end
298
+ end