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.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/docs/Applicant.md +2 -2
  4. data/docs/{InlineResponse2001.md → Base.md} +2 -2
  5. data/docs/Carrier.md +1 -1
  6. data/docs/County.md +3 -3
  7. data/docs/CountyBulk.md +10 -0
  8. data/docs/Drug.md +2 -1
  9. data/docs/DrugCoverage.md +4 -4
  10. data/docs/DrugCoverageResponse.md +9 -0
  11. data/docs/DrugPackage.md +9 -0
  12. data/docs/DrugSearchResponse.md +9 -0
  13. data/docs/DrugsApi.md +59 -0
  14. data/docs/Meta.md +8 -0
  15. data/docs/Plan.md +22 -6
  16. data/docs/PlanCounty.md +1 -1
  17. data/docs/PlanCountyBulk.md +10 -0
  18. data/docs/PlanFindResponse.md +9 -0
  19. data/docs/PlanSearchResult.md +26 -8
  20. data/docs/PlansApi.md +11 -11
  21. data/docs/Pricing.md +7 -1
  22. data/docs/Provider.md +9 -6
  23. data/docs/ProviderResponse.md +10 -0
  24. data/docs/ProvidersApi.md +19 -21
  25. data/docs/RatingArea.md +2 -2
  26. data/docs/RequestPlanFind.md +15 -0
  27. data/docs/State.md +4 -4
  28. data/docs/ZipCountiesApi.md +7 -8
  29. data/docs/ZipCountyBulk.md +11 -0
  30. data/docs/ZipCountyResponse.md +10 -0
  31. data/lib/vericred_client.rb +14 -6
  32. data/lib/vericred_client/api/{drug_coverage_api.rb → drugs_api.rb} +25 -19
  33. data/lib/vericred_client/api/plans_api.rb +14 -16
  34. data/lib/vericred_client/api/providers_api.rb +29 -29
  35. data/lib/vericred_client/api/zip_counties_api.rb +12 -12
  36. data/lib/vericred_client/api_client.rb +1 -1
  37. data/lib/vericred_client/api_error.rb +1 -1
  38. data/lib/vericred_client/models/applicant.rb +14 -12
  39. data/lib/vericred_client/models/{inline_response_200_1.rb → base.rb} +10 -9
  40. data/lib/vericred_client/models/carrier.rb +15 -15
  41. data/lib/vericred_client/models/carrier_subsidiary.rb +1 -1
  42. data/lib/vericred_client/models/county.rb +18 -14
  43. data/lib/vericred_client/models/county_bulk.rb +318 -0
  44. data/lib/vericred_client/models/drug.rb +27 -15
  45. data/lib/vericred_client/models/drug_coverage.rb +38 -32
  46. data/lib/vericred_client/models/drug_coverage_response.rb +310 -0
  47. data/lib/vericred_client/models/drug_package.rb +308 -0
  48. data/lib/vericred_client/models/drug_search_response.rb +310 -0
  49. data/lib/vericred_client/models/meta.rb +298 -0
  50. data/lib/vericred_client/models/plan.rb +196 -22
  51. data/lib/vericred_client/models/plan_county.rb +15 -15
  52. data/lib/vericred_client/models/plan_county_bulk.rb +318 -0
  53. data/lib/vericred_client/models/{inline_response_200.rb → plan_find_response.rb} +13 -11
  54. data/lib/vericred_client/models/plan_search_result.rb +236 -42
  55. data/lib/vericred_client/models/pricing.rb +63 -3
  56. data/lib/vericred_client/models/provider.rb +51 -9
  57. data/lib/vericred_client/models/provider_response.rb +322 -0
  58. data/lib/vericred_client/models/rating_area.rb +5 -5
  59. data/lib/vericred_client/models/{query.rb → request_plan_find.rb} +14 -6
  60. data/lib/vericred_client/models/state.rb +29 -25
  61. data/lib/vericred_client/models/zip_code.rb +1 -1
  62. data/lib/vericred_client/models/zip_county.rb +1 -1
  63. data/lib/vericred_client/models/zip_county_bulk.rb +328 -0
  64. data/lib/vericred_client/models/{inline_response_200_2.rb → zip_county_response.rb} +20 -17
  65. data/lib/vericred_client/version.rb +2 -2
  66. data/spec/api/{drug_coverage_api_spec.rb → drugs_api_spec.rb} +14 -17
  67. data/spec/api/plans_api_spec.rb +7 -69
  68. data/spec/api/providers_api_spec.rb +12 -28
  69. data/spec/api/zip_counties_api_spec.rb +6 -13
  70. metadata +31 -15
  71. data/docs/DrugCoverageApi.md +0 -54
  72. data/docs/InlineResponse200.md +0 -9
  73. data/docs/InlineResponse2002.md +0 -10
  74. data/docs/Query.md +0 -15
@@ -116,7 +116,7 @@ The response would be
116
116
 
117
117
 
118
118
 
119
- OpenAPI spec version:
119
+ OpenAPI spec version: 1.0.0
120
120
 
121
121
  Generated by: https://github.com/swagger-api/swagger-codegen.git
122
122
 
@@ -127,45 +127,45 @@ require 'date'
127
127
 
128
128
  module VericredClient
129
129
  class DrugCoverage
130
- # Health Insurance Oversight System id
131
- attr_accessor :plan_id
132
-
133
130
  # NDC package code
134
131
  attr_accessor :ndc_package_code
135
132
 
136
- # Tier Name
137
- attr_accessor :tier
138
-
139
- # Quantity limit exists
140
- attr_accessor :quantity_limit
133
+ # Health Insurance Oversight System id
134
+ attr_accessor :plan_id
141
135
 
142
136
  # Prior authorization required
143
137
  attr_accessor :prior_authorization
144
138
 
139
+ # Quantity limit exists
140
+ attr_accessor :quantity_limit
141
+
145
142
  # Step Treatment required
146
143
  attr_accessor :step_therapy
147
144
 
145
+ # Tier Name
146
+ attr_accessor :tier
147
+
148
148
  # Attribute mapping from ruby-style variable name to JSON key.
149
149
  def self.attribute_map
150
150
  {
151
- :'plan_id' => :'plan_id',
152
151
  :'ndc_package_code' => :'ndc_package_code',
153
- :'tier' => :'tier',
154
- :'quantity_limit' => :'quantity_limit',
152
+ :'plan_id' => :'plan_id',
155
153
  :'prior_authorization' => :'prior_authorization',
156
- :'step_therapy' => :'step_therapy'
154
+ :'quantity_limit' => :'quantity_limit',
155
+ :'step_therapy' => :'step_therapy',
156
+ :'tier' => :'tier'
157
157
  }
158
158
  end
159
159
 
160
160
  # Attribute type mapping.
161
161
  def self.swagger_types
162
162
  {
163
- :'plan_id' => :'String',
164
163
  :'ndc_package_code' => :'String',
165
- :'tier' => :'String',
166
- :'quantity_limit' => :'BOOLEAN',
164
+ :'plan_id' => :'String',
167
165
  :'prior_authorization' => :'BOOLEAN',
168
- :'step_therapy' => :'BOOLEAN'
166
+ :'quantity_limit' => :'BOOLEAN',
167
+ :'step_therapy' => :'BOOLEAN',
168
+ :'tier' => :'String'
169
169
  }
170
170
  end
171
171
 
@@ -177,28 +177,34 @@ module VericredClient
177
177
  # convert string to symbol for hash key
178
178
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
179
179
 
180
- if attributes.has_key?(:'plan_id')
181
- self.plan_id = attributes[:'plan_id']
182
- end
183
-
184
180
  if attributes.has_key?(:'ndc_package_code')
185
181
  self.ndc_package_code = attributes[:'ndc_package_code']
186
182
  end
187
183
 
188
- if attributes.has_key?(:'tier')
189
- self.tier = attributes[:'tier']
190
- end
191
-
192
- if attributes.has_key?(:'quantity_limit')
193
- self.quantity_limit = attributes[:'quantity_limit']
184
+ if attributes.has_key?(:'plan_id')
185
+ self.plan_id = attributes[:'plan_id']
194
186
  end
195
187
 
196
188
  if attributes.has_key?(:'prior_authorization')
197
189
  self.prior_authorization = attributes[:'prior_authorization']
190
+ else
191
+ self.prior_authorization = false
192
+ end
193
+
194
+ if attributes.has_key?(:'quantity_limit')
195
+ self.quantity_limit = attributes[:'quantity_limit']
196
+ else
197
+ self.quantity_limit = false
198
198
  end
199
199
 
200
200
  if attributes.has_key?(:'step_therapy')
201
201
  self.step_therapy = attributes[:'step_therapy']
202
+ else
203
+ self.step_therapy = false
204
+ end
205
+
206
+ if attributes.has_key?(:'tier')
207
+ self.tier = attributes[:'tier']
202
208
  end
203
209
 
204
210
  end
@@ -220,12 +226,12 @@ module VericredClient
220
226
  def ==(o)
221
227
  return true if self.equal?(o)
222
228
  self.class == o.class &&
223
- plan_id == o.plan_id &&
224
229
  ndc_package_code == o.ndc_package_code &&
225
- tier == o.tier &&
226
- quantity_limit == o.quantity_limit &&
230
+ plan_id == o.plan_id &&
227
231
  prior_authorization == o.prior_authorization &&
228
- step_therapy == o.step_therapy
232
+ quantity_limit == o.quantity_limit &&
233
+ step_therapy == o.step_therapy &&
234
+ tier == o.tier
229
235
  end
230
236
 
231
237
  # @see the `==` method
@@ -237,7 +243,7 @@ module VericredClient
237
243
  # Calculates hash code according to all attributes.
238
244
  # @return [Fixnum] Hash code
239
245
  def hash
240
- [plan_id, ndc_package_code, tier, quantity_limit, prior_authorization, step_therapy].hash
246
+ [ndc_package_code, plan_id, prior_authorization, quantity_limit, step_therapy, tier].hash
241
247
  end
242
248
 
243
249
  # Builds the object from hash
@@ -0,0 +1,310 @@
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 DrugCoverageResponse
130
+ # DrugCoverage search results
131
+ attr_accessor :coverages
132
+
133
+ # Metadata for query
134
+ attr_accessor :meta
135
+
136
+ # Attribute mapping from ruby-style variable name to JSON key.
137
+ def self.attribute_map
138
+ {
139
+ :'coverages' => :'coverages',
140
+ :'meta' => :'meta'
141
+ }
142
+ end
143
+
144
+ # Attribute type mapping.
145
+ def self.swagger_types
146
+ {
147
+ :'coverages' => :'Array<DrugCoverage>',
148
+ :'meta' => :'Meta'
149
+ }
150
+ end
151
+
152
+ # Initializes the object
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ def initialize(attributes = {})
155
+ return unless attributes.is_a?(Hash)
156
+
157
+ # convert string to symbol for hash key
158
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
159
+
160
+ if attributes.has_key?(:'coverages')
161
+ if (value = attributes[:'coverages']).is_a?(Array)
162
+ self.coverages = value
163
+ end
164
+ end
165
+
166
+ if attributes.has_key?(:'meta')
167
+ self.meta = attributes[:'meta']
168
+ end
169
+
170
+ end
171
+
172
+ # Show invalid properties with the reasons. Usually used together with valid?
173
+ # @return Array for valid properies with the reasons
174
+ def list_invalid_properties
175
+ invalid_properties = Array.new
176
+ return invalid_properties
177
+ end
178
+
179
+ # Check to see if the all the properties in the model are valid
180
+ # @return true if the model is valid
181
+ def valid?
182
+ end
183
+
184
+ # Checks equality by comparing each attribute.
185
+ # @param [Object] Object to be compared
186
+ def ==(o)
187
+ return true if self.equal?(o)
188
+ self.class == o.class &&
189
+ coverages == o.coverages &&
190
+ meta == o.meta
191
+ end
192
+
193
+ # @see the `==` method
194
+ # @param [Object] Object to be compared
195
+ def eql?(o)
196
+ self == o
197
+ end
198
+
199
+ # Calculates hash code according to all attributes.
200
+ # @return [Fixnum] Hash code
201
+ def hash
202
+ [coverages, meta].hash
203
+ end
204
+
205
+ # Builds the object from hash
206
+ # @param [Hash] attributes Model attributes in the form of hash
207
+ # @return [Object] Returns the model itself
208
+ def build_from_hash(attributes)
209
+ return nil unless attributes.is_a?(Hash)
210
+ self.class.swagger_types.each_pair do |key, type|
211
+ if type =~ /^Array<(.*)>/i
212
+ # check to ensure the input is an array given that the the attribute
213
+ # is documented as an array but the input is not
214
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
215
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
216
+ end
217
+ elsif !attributes[self.class.attribute_map[key]].nil?
218
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
219
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
220
+ end
221
+
222
+ self
223
+ end
224
+
225
+ # Deserializes the data based on type
226
+ # @param string type Data type
227
+ # @param string value Value to be deserialized
228
+ # @return [Object] Deserialized data
229
+ def _deserialize(type, value)
230
+ case type.to_sym
231
+ when :DateTime
232
+ DateTime.parse(value)
233
+ when :Date
234
+ Date.parse(value)
235
+ when :String
236
+ value.to_s
237
+ when :Integer
238
+ value.to_i
239
+ when :Float
240
+ value.to_f
241
+ when :BOOLEAN
242
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
243
+ true
244
+ else
245
+ false
246
+ end
247
+ when :Object
248
+ # generic object (usually a Hash), return directly
249
+ value
250
+ when /\AArray<(?<inner_type>.+)>\z/
251
+ inner_type = Regexp.last_match[:inner_type]
252
+ value.map { |v| _deserialize(inner_type, v) }
253
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
254
+ k_type = Regexp.last_match[:k_type]
255
+ v_type = Regexp.last_match[:v_type]
256
+ {}.tap do |hash|
257
+ value.each do |k, v|
258
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
259
+ end
260
+ end
261
+ else # model
262
+ temp_model = VericredClient.const_get(type).new
263
+ temp_model.build_from_hash(value)
264
+ end
265
+ end
266
+
267
+ # Returns the string representation of the object
268
+ # @return [String] String presentation of the object
269
+ def to_s
270
+ to_hash.to_s
271
+ end
272
+
273
+ # to_body is an alias to to_hash (backward compatibility)
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_body
276
+ to_hash
277
+ end
278
+
279
+ # Returns the object in the form of hash
280
+ # @return [Hash] Returns the object in the form of hash
281
+ def to_hash
282
+ hash = {}
283
+ self.class.attribute_map.each_pair do |attr, param|
284
+ value = self.send(attr)
285
+ next if value.nil?
286
+ hash[param] = _to_hash(value)
287
+ end
288
+ hash
289
+ end
290
+
291
+ # Outputs non-array value in the form of hash
292
+ # For object, use to_hash. Otherwise, just return the value
293
+ # @param [Object] value Any valid value
294
+ # @return [Hash] Returns the value in the form of hash
295
+ def _to_hash(value)
296
+ if value.is_a?(Array)
297
+ value.compact.map{ |v| _to_hash(v) }
298
+ elsif value.is_a?(Hash)
299
+ {}.tap do |hash|
300
+ value.each { |k, v| hash[k] = _to_hash(v) }
301
+ end
302
+ elsif value.respond_to? :to_hash
303
+ value.to_hash
304
+ else
305
+ value
306
+ end
307
+ end
308
+
309
+ end
310
+ end
@@ -0,0 +1,308 @@
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 DrugPackage
130
+ # Package description
131
+ attr_accessor :description
132
+
133
+ # National Drug Code ID (Package)
134
+ attr_accessor :ndc_package_code
135
+
136
+ # Attribute mapping from ruby-style variable name to JSON key.
137
+ def self.attribute_map
138
+ {
139
+ :'description' => :'description',
140
+ :'ndc_package_code' => :'ndc_package_code'
141
+ }
142
+ end
143
+
144
+ # Attribute type mapping.
145
+ def self.swagger_types
146
+ {
147
+ :'description' => :'String',
148
+ :'ndc_package_code' => :'String'
149
+ }
150
+ end
151
+
152
+ # Initializes the object
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ def initialize(attributes = {})
155
+ return unless attributes.is_a?(Hash)
156
+
157
+ # convert string to symbol for hash key
158
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
159
+
160
+ if attributes.has_key?(:'description')
161
+ self.description = attributes[:'description']
162
+ end
163
+
164
+ if attributes.has_key?(:'ndc_package_code')
165
+ self.ndc_package_code = attributes[:'ndc_package_code']
166
+ end
167
+
168
+ end
169
+
170
+ # Show invalid properties with the reasons. Usually used together with valid?
171
+ # @return Array for valid properies with the reasons
172
+ def list_invalid_properties
173
+ invalid_properties = Array.new
174
+ return invalid_properties
175
+ end
176
+
177
+ # Check to see if the all the properties in the model are valid
178
+ # @return true if the model is valid
179
+ def valid?
180
+ end
181
+
182
+ # Checks equality by comparing each attribute.
183
+ # @param [Object] Object to be compared
184
+ def ==(o)
185
+ return true if self.equal?(o)
186
+ self.class == o.class &&
187
+ description == o.description &&
188
+ ndc_package_code == o.ndc_package_code
189
+ end
190
+
191
+ # @see the `==` method
192
+ # @param [Object] Object to be compared
193
+ def eql?(o)
194
+ self == o
195
+ end
196
+
197
+ # Calculates hash code according to all attributes.
198
+ # @return [Fixnum] Hash code
199
+ def hash
200
+ [description, ndc_package_code].hash
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+ self.class.swagger_types.each_pair do |key, type|
209
+ if type =~ /^Array<(.*)>/i
210
+ # check to ensure the input is an array given that the the attribute
211
+ # is documented as an array but the input is not
212
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
213
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
214
+ end
215
+ elsif !attributes[self.class.attribute_map[key]].nil?
216
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
217
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
218
+ end
219
+
220
+ self
221
+ end
222
+
223
+ # Deserializes the data based on type
224
+ # @param string type Data type
225
+ # @param string value Value to be deserialized
226
+ # @return [Object] Deserialized data
227
+ def _deserialize(type, value)
228
+ case type.to_sym
229
+ when :DateTime
230
+ DateTime.parse(value)
231
+ when :Date
232
+ Date.parse(value)
233
+ when :String
234
+ value.to_s
235
+ when :Integer
236
+ value.to_i
237
+ when :Float
238
+ value.to_f
239
+ when :BOOLEAN
240
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
241
+ true
242
+ else
243
+ false
244
+ end
245
+ when :Object
246
+ # generic object (usually a Hash), return directly
247
+ value
248
+ when /\AArray<(?<inner_type>.+)>\z/
249
+ inner_type = Regexp.last_match[:inner_type]
250
+ value.map { |v| _deserialize(inner_type, v) }
251
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
252
+ k_type = Regexp.last_match[:k_type]
253
+ v_type = Regexp.last_match[:v_type]
254
+ {}.tap do |hash|
255
+ value.each do |k, v|
256
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
257
+ end
258
+ end
259
+ else # model
260
+ temp_model = VericredClient.const_get(type).new
261
+ temp_model.build_from_hash(value)
262
+ end
263
+ end
264
+
265
+ # Returns the string representation of the object
266
+ # @return [String] String presentation of the object
267
+ def to_s
268
+ to_hash.to_s
269
+ end
270
+
271
+ # to_body is an alias to to_hash (backward compatibility)
272
+ # @return [Hash] Returns the object in the form of hash
273
+ def to_body
274
+ to_hash
275
+ end
276
+
277
+ # Returns the object in the form of hash
278
+ # @return [Hash] Returns the object in the form of hash
279
+ def to_hash
280
+ hash = {}
281
+ self.class.attribute_map.each_pair do |attr, param|
282
+ value = self.send(attr)
283
+ next if value.nil?
284
+ hash[param] = _to_hash(value)
285
+ end
286
+ hash
287
+ end
288
+
289
+ # Outputs non-array value in the form of hash
290
+ # For object, use to_hash. Otherwise, just return the value
291
+ # @param [Object] value Any valid value
292
+ # @return [Hash] Returns the value in the form of hash
293
+ def _to_hash(value)
294
+ if value.is_a?(Array)
295
+ value.compact.map{ |v| _to_hash(v) }
296
+ elsif value.is_a?(Hash)
297
+ {}.tap do |hash|
298
+ value.each { |k, v| hash[k] = _to_hash(v) }
299
+ end
300
+ elsif value.respond_to? :to_hash
301
+ value.to_hash
302
+ else
303
+ value
304
+ end
305
+ end
306
+
307
+ end
308
+ end