zernio-sdk 0.0.783 → 0.0.784

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -0
  3. data/docs/CreatePhoneNumberStockWatchRequest.md +18 -0
  4. data/docs/ListPhoneNumberStockWatches200Response.md +18 -0
  5. data/docs/PhoneNumberStockWatch.md +24 -0
  6. data/docs/PhoneNumbersApi.md +203 -0
  7. data/docs/WebhookEventsApi.md +69 -0
  8. data/docs/WebhookPayloadPhoneNumberStockAvailable.md +24 -0
  9. data/docs/WebhookPayloadPhoneNumberStockAvailableStock.md +20 -0
  10. data/docs/WebhookPayloadPhoneNumberStockAvailableStockTypesInner.md +20 -0
  11. data/lib/zernio-sdk/api/phone_numbers_api.rb +184 -0
  12. data/lib/zernio-sdk/api/webhook_events_api.rb +66 -0
  13. data/lib/zernio-sdk/models/create_phone_number_stock_watch_request.rb +183 -0
  14. data/lib/zernio-sdk/models/list_phone_number_stock_watches200_response.rb +149 -0
  15. data/lib/zernio-sdk/models/phone_number_stock_watch.rb +243 -0
  16. data/lib/zernio-sdk/models/webhook_payload_phone_number_stock_available.rb +269 -0
  17. data/lib/zernio-sdk/models/webhook_payload_phone_number_stock_available_stock.rb +194 -0
  18. data/lib/zernio-sdk/models/webhook_payload_phone_number_stock_available_stock_types_inner.rb +192 -0
  19. data/lib/zernio-sdk/version.rb +1 -1
  20. data/lib/zernio-sdk.rb +6 -0
  21. data/openapi.yaml +146 -4
  22. data/spec/api/phone_numbers_api_spec.rb +33 -0
  23. data/spec/models/create_phone_number_stock_watch_request_spec.rb +36 -0
  24. data/spec/models/create_webhook_settings_request_spec.rb +1 -1
  25. data/spec/models/list_phone_number_stock_watches200_response_spec.rb +36 -0
  26. data/spec/models/phone_number_stock_watch_spec.rb +54 -0
  27. data/spec/models/update_webhook_settings_request_spec.rb +1 -1
  28. data/spec/models/webhook_payload_phone_number_stock_available_spec.rb +58 -0
  29. data/spec/models/webhook_payload_phone_number_stock_available_stock_spec.rb +42 -0
  30. data/spec/models/webhook_payload_phone_number_stock_available_stock_types_inner_spec.rb +42 -0
  31. data/spec/models/webhook_spec.rb +1 -1
  32. metadata +25 -1
@@ -0,0 +1,243 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ class PhoneNumberStockWatch < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ # ISO 3166-1 alpha-2.
21
+ attr_accessor :country
22
+
23
+ attr_accessor :country_name
24
+
25
+ attr_accessor :created_at
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'id' => :'id',
31
+ :'country' => :'country',
32
+ :'country_name' => :'countryName',
33
+ :'created_at' => :'createdAt'
34
+ }
35
+ end
36
+
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ acceptable_attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'id' => :'String',
51
+ :'country' => :'String',
52
+ :'country_name' => :'String',
53
+ :'created_at' => :'Time'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::PhoneNumberStockWatch` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ acceptable_attribute_map = self.class.acceptable_attribute_map
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!acceptable_attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::PhoneNumberStockWatch`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'id')
80
+ self.id = attributes[:'id']
81
+ else
82
+ self.id = nil
83
+ end
84
+
85
+ if attributes.key?(:'country')
86
+ self.country = attributes[:'country']
87
+ else
88
+ self.country = nil
89
+ end
90
+
91
+ if attributes.key?(:'country_name')
92
+ self.country_name = attributes[:'country_name']
93
+ else
94
+ self.country_name = nil
95
+ end
96
+
97
+ if attributes.key?(:'created_at')
98
+ self.created_at = attributes[:'created_at']
99
+ else
100
+ self.created_at = nil
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
108
+ invalid_properties = Array.new
109
+ if @id.nil?
110
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
111
+ end
112
+
113
+ if @country.nil?
114
+ invalid_properties.push('invalid value for "country", country cannot be nil.')
115
+ end
116
+
117
+ if @country_name.nil?
118
+ invalid_properties.push('invalid value for "country_name", country_name cannot be nil.')
119
+ end
120
+
121
+ if @created_at.nil?
122
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
123
+ end
124
+
125
+ invalid_properties
126
+ end
127
+
128
+ # Check to see if the all the properties in the model are valid
129
+ # @return true if the model is valid
130
+ def valid?
131
+ warn '[DEPRECATED] the `valid?` method is obsolete'
132
+ return false if @id.nil?
133
+ return false if @country.nil?
134
+ return false if @country_name.nil?
135
+ return false if @created_at.nil?
136
+ true
137
+ end
138
+
139
+ # Custom attribute writer method with validation
140
+ # @param [Object] id Value to be assigned
141
+ def id=(id)
142
+ if id.nil?
143
+ fail ArgumentError, 'id cannot be nil'
144
+ end
145
+
146
+ @id = id
147
+ end
148
+
149
+ # Custom attribute writer method with validation
150
+ # @param [Object] country Value to be assigned
151
+ def country=(country)
152
+ if country.nil?
153
+ fail ArgumentError, 'country cannot be nil'
154
+ end
155
+
156
+ @country = country
157
+ end
158
+
159
+ # Custom attribute writer method with validation
160
+ # @param [Object] country_name Value to be assigned
161
+ def country_name=(country_name)
162
+ if country_name.nil?
163
+ fail ArgumentError, 'country_name cannot be nil'
164
+ end
165
+
166
+ @country_name = country_name
167
+ end
168
+
169
+ # Custom attribute writer method with validation
170
+ # @param [Object] created_at Value to be assigned
171
+ def created_at=(created_at)
172
+ if created_at.nil?
173
+ fail ArgumentError, 'created_at cannot be nil'
174
+ end
175
+
176
+ @created_at = created_at
177
+ end
178
+
179
+ # Checks equality by comparing each attribute.
180
+ # @param [Object] Object to be compared
181
+ def ==(o)
182
+ return true if self.equal?(o)
183
+ self.class == o.class &&
184
+ id == o.id &&
185
+ country == o.country &&
186
+ country_name == o.country_name &&
187
+ created_at == o.created_at
188
+ end
189
+
190
+ # @see the `==` method
191
+ # @param [Object] Object to be compared
192
+ def eql?(o)
193
+ self == o
194
+ end
195
+
196
+ # Calculates hash code according to all attributes.
197
+ # @return [Integer] Hash code
198
+ def hash
199
+ [id, country, country_name, created_at].hash
200
+ end
201
+
202
+ # Builds the object from hash
203
+ # @param [Hash] attributes Model attributes in the form of hash
204
+ # @return [Object] Returns the model itself
205
+ def self.build_from_hash(attributes)
206
+ return nil unless attributes.is_a?(Hash)
207
+ attributes = attributes.transform_keys(&:to_sym)
208
+ transformed_hash = {}
209
+ openapi_types.each_pair do |key, type|
210
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
211
+ transformed_hash["#{key}"] = nil
212
+ elsif type =~ /\AArray<(.*)>/i
213
+ # check to ensure the input is an array given that the attribute
214
+ # is documented as an array but the input is not
215
+ if attributes[attribute_map[key]].is_a?(Array)
216
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
217
+ end
218
+ elsif !attributes[attribute_map[key]].nil?
219
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
220
+ end
221
+ end
222
+ new(transformed_hash)
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ end
242
+
243
+ end
@@ -0,0 +1,269 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ # Webhook payload for phone_number.stock_available events
18
+ class WebhookPayloadPhoneNumberStockAvailable < ApiModelBase
19
+ # Stable webhook event ID
20
+ attr_accessor :id
21
+
22
+ attr_accessor :event
23
+
24
+ attr_accessor :stock
25
+
26
+ # UTC time at which Zernio generated this event (set once when the event payload is built, before delivery is queued). Retries and redeliveries keep the original value, so it reflects the event, not the delivery attempt.
27
+ attr_accessor :timestamp
28
+
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'id' => :'id',
55
+ :'event' => :'event',
56
+ :'stock' => :'stock',
57
+ :'timestamp' => :'timestamp'
58
+ }
59
+ end
60
+
61
+ # Returns attribute mapping this model knows about
62
+ def self.acceptable_attribute_map
63
+ attribute_map
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ acceptable_attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'id' => :'String',
75
+ :'event' => :'String',
76
+ :'stock' => :'WebhookPayloadPhoneNumberStockAvailableStock',
77
+ :'timestamp' => :'Time'
78
+ }
79
+ end
80
+
81
+ # List of attributes with nullable: true
82
+ def self.openapi_nullable
83
+ Set.new([
84
+ ])
85
+ end
86
+
87
+ # Initializes the object
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ def initialize(attributes = {})
90
+ if (!attributes.is_a?(Hash))
91
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::WebhookPayloadPhoneNumberStockAvailable` initialize method"
92
+ end
93
+
94
+ # check to see if the attribute exists and convert string to symbol for hash key
95
+ acceptable_attribute_map = self.class.acceptable_attribute_map
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!acceptable_attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::WebhookPayloadPhoneNumberStockAvailable`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'id')
104
+ self.id = attributes[:'id']
105
+ else
106
+ self.id = nil
107
+ end
108
+
109
+ if attributes.key?(:'event')
110
+ self.event = attributes[:'event']
111
+ else
112
+ self.event = nil
113
+ end
114
+
115
+ if attributes.key?(:'stock')
116
+ self.stock = attributes[:'stock']
117
+ else
118
+ self.stock = nil
119
+ end
120
+
121
+ if attributes.key?(:'timestamp')
122
+ self.timestamp = attributes[:'timestamp']
123
+ else
124
+ self.timestamp = nil
125
+ end
126
+ end
127
+
128
+ # Show invalid properties with the reasons. Usually used together with valid?
129
+ # @return Array for valid properties with the reasons
130
+ def list_invalid_properties
131
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
132
+ invalid_properties = Array.new
133
+ if @id.nil?
134
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
135
+ end
136
+
137
+ if @event.nil?
138
+ invalid_properties.push('invalid value for "event", event cannot be nil.')
139
+ end
140
+
141
+ if @stock.nil?
142
+ invalid_properties.push('invalid value for "stock", stock cannot be nil.')
143
+ end
144
+
145
+ if @timestamp.nil?
146
+ invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
147
+ end
148
+
149
+ invalid_properties
150
+ end
151
+
152
+ # Check to see if the all the properties in the model are valid
153
+ # @return true if the model is valid
154
+ def valid?
155
+ warn '[DEPRECATED] the `valid?` method is obsolete'
156
+ return false if @id.nil?
157
+ return false if @event.nil?
158
+ event_validator = EnumAttributeValidator.new('String', ["phone_number.stock_available"])
159
+ return false unless event_validator.valid?(@event)
160
+ return false if @stock.nil?
161
+ return false if @timestamp.nil?
162
+ true
163
+ end
164
+
165
+ # Custom attribute writer method with validation
166
+ # @param [Object] id Value to be assigned
167
+ def id=(id)
168
+ if id.nil?
169
+ fail ArgumentError, 'id cannot be nil'
170
+ end
171
+
172
+ @id = id
173
+ end
174
+
175
+ # Custom attribute writer method checking allowed values (enum).
176
+ # @param [Object] event Object to be assigned
177
+ def event=(event)
178
+ validator = EnumAttributeValidator.new('String', ["phone_number.stock_available"])
179
+ unless validator.valid?(event)
180
+ fail ArgumentError, "invalid value for \"event\", must be one of #{validator.allowable_values}."
181
+ end
182
+ @event = event
183
+ end
184
+
185
+ # Custom attribute writer method with validation
186
+ # @param [Object] stock Value to be assigned
187
+ def stock=(stock)
188
+ if stock.nil?
189
+ fail ArgumentError, 'stock cannot be nil'
190
+ end
191
+
192
+ @stock = stock
193
+ end
194
+
195
+ # Custom attribute writer method with validation
196
+ # @param [Object] timestamp Value to be assigned
197
+ def timestamp=(timestamp)
198
+ if timestamp.nil?
199
+ fail ArgumentError, 'timestamp cannot be nil'
200
+ end
201
+
202
+ @timestamp = timestamp
203
+ end
204
+
205
+ # Checks equality by comparing each attribute.
206
+ # @param [Object] Object to be compared
207
+ def ==(o)
208
+ return true if self.equal?(o)
209
+ self.class == o.class &&
210
+ id == o.id &&
211
+ event == o.event &&
212
+ stock == o.stock &&
213
+ timestamp == o.timestamp
214
+ end
215
+
216
+ # @see the `==` method
217
+ # @param [Object] Object to be compared
218
+ def eql?(o)
219
+ self == o
220
+ end
221
+
222
+ # Calculates hash code according to all attributes.
223
+ # @return [Integer] Hash code
224
+ def hash
225
+ [id, event, stock, timestamp].hash
226
+ end
227
+
228
+ # Builds the object from hash
229
+ # @param [Hash] attributes Model attributes in the form of hash
230
+ # @return [Object] Returns the model itself
231
+ def self.build_from_hash(attributes)
232
+ return nil unless attributes.is_a?(Hash)
233
+ attributes = attributes.transform_keys(&:to_sym)
234
+ transformed_hash = {}
235
+ openapi_types.each_pair do |key, type|
236
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
237
+ transformed_hash["#{key}"] = nil
238
+ elsif type =~ /\AArray<(.*)>/i
239
+ # check to ensure the input is an array given that the attribute
240
+ # is documented as an array but the input is not
241
+ if attributes[attribute_map[key]].is_a?(Array)
242
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
243
+ end
244
+ elsif !attributes[attribute_map[key]].nil?
245
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
246
+ end
247
+ end
248
+ new(transformed_hash)
249
+ end
250
+
251
+ # Returns the object in the form of hash
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_hash
254
+ hash = {}
255
+ self.class.attribute_map.each_pair do |attr, param|
256
+ value = self.send(attr)
257
+ if value.nil?
258
+ is_nullable = self.class.openapi_nullable.include?(attr)
259
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
260
+ end
261
+
262
+ hash[param] = _to_hash(value)
263
+ end
264
+ hash
265
+ end
266
+
267
+ end
268
+
269
+ end
@@ -0,0 +1,194 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ class WebhookPayloadPhoneNumberStockAvailableStock < ApiModelBase
18
+ # ISO 3166-1 alpha-2 country code of the watched country.
19
+ attr_accessor :country
20
+
21
+ # Number types deliverable at sweep time. Only types with stock are listed.
22
+ attr_accessor :types
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'country' => :'country',
28
+ :'types' => :'types'
29
+ }
30
+ end
31
+
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ acceptable_attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'country' => :'String',
46
+ :'types' => :'Array<WebhookPayloadPhoneNumberStockAvailableStockTypesInner>'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::WebhookPayloadPhoneNumberStockAvailableStock` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::WebhookPayloadPhoneNumberStockAvailableStock`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'country')
73
+ self.country = attributes[:'country']
74
+ else
75
+ self.country = nil
76
+ end
77
+
78
+ if attributes.key?(:'types')
79
+ if (value = attributes[:'types']).is_a?(Array)
80
+ self.types = value
81
+ end
82
+ else
83
+ self.types = nil
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
91
+ invalid_properties = Array.new
92
+ if @country.nil?
93
+ invalid_properties.push('invalid value for "country", country cannot be nil.')
94
+ end
95
+
96
+ if @types.nil?
97
+ invalid_properties.push('invalid value for "types", types cannot be nil.')
98
+ end
99
+
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ warn '[DEPRECATED] the `valid?` method is obsolete'
107
+ return false if @country.nil?
108
+ return false if @types.nil?
109
+ true
110
+ end
111
+
112
+ # Custom attribute writer method with validation
113
+ # @param [Object] country Value to be assigned
114
+ def country=(country)
115
+ if country.nil?
116
+ fail ArgumentError, 'country cannot be nil'
117
+ end
118
+
119
+ @country = country
120
+ end
121
+
122
+ # Custom attribute writer method with validation
123
+ # @param [Object] types Value to be assigned
124
+ def types=(types)
125
+ if types.nil?
126
+ fail ArgumentError, 'types cannot be nil'
127
+ end
128
+
129
+ @types = types
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ country == o.country &&
138
+ types == o.types
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] Object to be compared
143
+ def eql?(o)
144
+ self == o
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Integer] Hash code
149
+ def hash
150
+ [country, types].hash
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def self.build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ attributes = attributes.transform_keys(&:to_sym)
159
+ transformed_hash = {}
160
+ openapi_types.each_pair do |key, type|
161
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
162
+ transformed_hash["#{key}"] = nil
163
+ elsif type =~ /\AArray<(.*)>/i
164
+ # check to ensure the input is an array given that the attribute
165
+ # is documented as an array but the input is not
166
+ if attributes[attribute_map[key]].is_a?(Array)
167
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
168
+ end
169
+ elsif !attributes[attribute_map[key]].nil?
170
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
171
+ end
172
+ end
173
+ new(transformed_hash)
174
+ end
175
+
176
+ # Returns the object in the form of hash
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_hash
179
+ hash = {}
180
+ self.class.attribute_map.each_pair do |attr, param|
181
+ value = self.send(attr)
182
+ if value.nil?
183
+ is_nullable = self.class.openapi_nullable.include?(attr)
184
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
185
+ end
186
+
187
+ hash[param] = _to_hash(value)
188
+ end
189
+ hash
190
+ end
191
+
192
+ end
193
+
194
+ end