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
@@ -360,6 +360,135 @@ module Zernio
360
360
  return data, status_code, headers
361
361
  end
362
362
 
363
+ # Watch an out-of-stock country
364
+ # Get notified the first time an out-of-stock country has deliverable numbers again: an email to the account holder plus the `phone_number.stock_available` webhook. Stock is re-checked every 6h. One watch per country; a repeat request returns the existing watch (200). The watch is consumed when it fires, so re-create it if you miss the stock. Up to 20 countries can be watched at once.
365
+ # @param create_phone_number_stock_watch_request [CreatePhoneNumberStockWatchRequest]
366
+ # @param [Hash] opts the optional parameters
367
+ # @return [PhoneNumberStockWatch]
368
+ def create_phone_number_stock_watch(create_phone_number_stock_watch_request, opts = {})
369
+ data, _status_code, _headers = create_phone_number_stock_watch_with_http_info(create_phone_number_stock_watch_request, opts)
370
+ data
371
+ end
372
+
373
+ # Watch an out-of-stock country
374
+ # Get notified the first time an out-of-stock country has deliverable numbers again: an email to the account holder plus the `phone_number.stock_available` webhook. Stock is re-checked every 6h. One watch per country; a repeat request returns the existing watch (200). The watch is consumed when it fires, so re-create it if you miss the stock. Up to 20 countries can be watched at once.
375
+ # @param create_phone_number_stock_watch_request [CreatePhoneNumberStockWatchRequest]
376
+ # @param [Hash] opts the optional parameters
377
+ # @return [Array<(PhoneNumberStockWatch, Integer, Hash)>] PhoneNumberStockWatch data, response status code and response headers
378
+ def create_phone_number_stock_watch_with_http_info(create_phone_number_stock_watch_request, opts = {})
379
+ if @api_client.config.debugging
380
+ @api_client.config.logger.debug 'Calling API: PhoneNumbersApi.create_phone_number_stock_watch ...'
381
+ end
382
+ # verify the required parameter 'create_phone_number_stock_watch_request' is set
383
+ if @api_client.config.client_side_validation && create_phone_number_stock_watch_request.nil?
384
+ fail ArgumentError, "Missing the required parameter 'create_phone_number_stock_watch_request' when calling PhoneNumbersApi.create_phone_number_stock_watch"
385
+ end
386
+ # resource path
387
+ local_var_path = '/v1/phone-numbers/stock-watches'
388
+
389
+ # query parameters
390
+ query_params = opts[:query_params] || {}
391
+
392
+ # header parameters
393
+ header_params = opts[:header_params] || {}
394
+ # HTTP header 'Accept' (if needed)
395
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
396
+ # HTTP header 'Content-Type'
397
+ content_type = @api_client.select_header_content_type(['application/json'])
398
+ if !content_type.nil?
399
+ header_params['Content-Type'] = content_type
400
+ end
401
+
402
+ # form parameters
403
+ form_params = opts[:form_params] || {}
404
+
405
+ # http body (model)
406
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_phone_number_stock_watch_request)
407
+
408
+ # return_type
409
+ return_type = opts[:debug_return_type] || 'PhoneNumberStockWatch'
410
+
411
+ # auth_names
412
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
413
+
414
+ new_options = opts.merge(
415
+ :operation => :"PhoneNumbersApi.create_phone_number_stock_watch",
416
+ :header_params => header_params,
417
+ :query_params => query_params,
418
+ :form_params => form_params,
419
+ :body => post_body,
420
+ :auth_names => auth_names,
421
+ :return_type => return_type
422
+ )
423
+
424
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
425
+ if @api_client.config.debugging
426
+ @api_client.config.logger.debug "API called: PhoneNumbersApi#create_phone_number_stock_watch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
427
+ end
428
+ return data, status_code, headers
429
+ end
430
+
431
+ # Stop watching a country
432
+ # @param id [String]
433
+ # @param [Hash] opts the optional parameters
434
+ # @return [DeleteSmsSenderId200Response]
435
+ def delete_phone_number_stock_watch(id, opts = {})
436
+ data, _status_code, _headers = delete_phone_number_stock_watch_with_http_info(id, opts)
437
+ data
438
+ end
439
+
440
+ # Stop watching a country
441
+ # @param id [String]
442
+ # @param [Hash] opts the optional parameters
443
+ # @return [Array<(DeleteSmsSenderId200Response, Integer, Hash)>] DeleteSmsSenderId200Response data, response status code and response headers
444
+ def delete_phone_number_stock_watch_with_http_info(id, opts = {})
445
+ if @api_client.config.debugging
446
+ @api_client.config.logger.debug 'Calling API: PhoneNumbersApi.delete_phone_number_stock_watch ...'
447
+ end
448
+ # verify the required parameter 'id' is set
449
+ if @api_client.config.client_side_validation && id.nil?
450
+ fail ArgumentError, "Missing the required parameter 'id' when calling PhoneNumbersApi.delete_phone_number_stock_watch"
451
+ end
452
+ # resource path
453
+ local_var_path = '/v1/phone-numbers/stock-watches/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
454
+
455
+ # query parameters
456
+ query_params = opts[:query_params] || {}
457
+
458
+ # header parameters
459
+ header_params = opts[:header_params] || {}
460
+ # HTTP header 'Accept' (if needed)
461
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
462
+
463
+ # form parameters
464
+ form_params = opts[:form_params] || {}
465
+
466
+ # http body (model)
467
+ post_body = opts[:debug_body]
468
+
469
+ # return_type
470
+ return_type = opts[:debug_return_type] || 'DeleteSmsSenderId200Response'
471
+
472
+ # auth_names
473
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
474
+
475
+ new_options = opts.merge(
476
+ :operation => :"PhoneNumbersApi.delete_phone_number_stock_watch",
477
+ :header_params => header_params,
478
+ :query_params => query_params,
479
+ :form_params => form_params,
480
+ :body => post_body,
481
+ :auth_names => auth_names,
482
+ :return_type => return_type
483
+ )
484
+
485
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
486
+ if @api_client.config.debugging
487
+ @api_client.config.logger.debug "API called: PhoneNumbersApi#delete_phone_number_stock_watch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
488
+ end
489
+ return data, status_code, headers
490
+ end
491
+
363
492
  # Get phone number
364
493
  # Retrieve the current status of a purchased phone number. Poll this to track Meta pre-verification (US sync path) and, for regulated (Tier 3/4) numbers, the async lifecycle: pending_regulatory → active (or regulatory_declined). When a regulated number has an Onfido ID step, `onfidoVerificationUrl` appears here once the order is placed — forward it to the end user. (Or subscribe to the whatsapp.number.* webhooks instead of polling.)
365
494
  # @param id [String] Phone number record ID
@@ -813,6 +942,61 @@ module Zernio
813
942
  return data, status_code, headers
814
943
  end
815
944
 
945
+ # List stock watches
946
+ # @param [Hash] opts the optional parameters
947
+ # @return [ListPhoneNumberStockWatches200Response]
948
+ def list_phone_number_stock_watches(opts = {})
949
+ data, _status_code, _headers = list_phone_number_stock_watches_with_http_info(opts)
950
+ data
951
+ end
952
+
953
+ # List stock watches
954
+ # @param [Hash] opts the optional parameters
955
+ # @return [Array<(ListPhoneNumberStockWatches200Response, Integer, Hash)>] ListPhoneNumberStockWatches200Response data, response status code and response headers
956
+ def list_phone_number_stock_watches_with_http_info(opts = {})
957
+ if @api_client.config.debugging
958
+ @api_client.config.logger.debug 'Calling API: PhoneNumbersApi.list_phone_number_stock_watches ...'
959
+ end
960
+ # resource path
961
+ local_var_path = '/v1/phone-numbers/stock-watches'
962
+
963
+ # query parameters
964
+ query_params = opts[:query_params] || {}
965
+
966
+ # header parameters
967
+ header_params = opts[:header_params] || {}
968
+ # HTTP header 'Accept' (if needed)
969
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
970
+
971
+ # form parameters
972
+ form_params = opts[:form_params] || {}
973
+
974
+ # http body (model)
975
+ post_body = opts[:debug_body]
976
+
977
+ # return_type
978
+ return_type = opts[:debug_return_type] || 'ListPhoneNumberStockWatches200Response'
979
+
980
+ # auth_names
981
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
982
+
983
+ new_options = opts.merge(
984
+ :operation => :"PhoneNumbersApi.list_phone_number_stock_watches",
985
+ :header_params => header_params,
986
+ :query_params => query_params,
987
+ :form_params => form_params,
988
+ :body => post_body,
989
+ :auth_names => auth_names,
990
+ :return_type => return_type
991
+ )
992
+
993
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
994
+ if @api_client.config.debugging
995
+ @api_client.config.logger.debug "API called: PhoneNumbersApi#list_phone_number_stock_watches\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
996
+ end
997
+ return data, status_code, headers
998
+ end
999
+
816
1000
  # List phone numbers
817
1001
  # List all phone numbers purchased by the authenticated user. By default, released numbers are excluded. Connected (bring-your-own) WhatsApp numbers are returned in the separate `connected` array; they are not billed and have no provisioning lifecycle.
818
1002
  # @param [Hash] opts the optional parameters
@@ -1207,6 +1207,72 @@ module Zernio
1207
1207
  return data, status_code, headers
1208
1208
  end
1209
1209
 
1210
+ # Phone-number stock available event
1211
+ # Fired by the stock sweep (every 6h) the first time a country you watch via POST /v1/phone-numbers/stock-watches has deliverable numbers again. The watch is consumed, so the event fires once per watch; the stock counts are a snapshot and numbers are sold first come, first served. Buy with POST /v1/phone-numbers/purchase.
1212
+ # @param webhook_payload_phone_number_stock_available [WebhookPayloadPhoneNumberStockAvailable]
1213
+ # @param [Hash] opts the optional parameters
1214
+ # @return [nil]
1215
+ def on_phone_number_stock_available(webhook_payload_phone_number_stock_available, opts = {})
1216
+ on_phone_number_stock_available_with_http_info(webhook_payload_phone_number_stock_available, opts)
1217
+ nil
1218
+ end
1219
+
1220
+ # Phone-number stock available event
1221
+ # Fired by the stock sweep (every 6h) the first time a country you watch via POST /v1/phone-numbers/stock-watches has deliverable numbers again. The watch is consumed, so the event fires once per watch; the stock counts are a snapshot and numbers are sold first come, first served. Buy with POST /v1/phone-numbers/purchase.
1222
+ # @param webhook_payload_phone_number_stock_available [WebhookPayloadPhoneNumberStockAvailable]
1223
+ # @param [Hash] opts the optional parameters
1224
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
1225
+ def on_phone_number_stock_available_with_http_info(webhook_payload_phone_number_stock_available, opts = {})
1226
+ if @api_client.config.debugging
1227
+ @api_client.config.logger.debug 'Calling API: WebhookEventsApi.on_phone_number_stock_available ...'
1228
+ end
1229
+ # verify the required parameter 'webhook_payload_phone_number_stock_available' is set
1230
+ if @api_client.config.client_side_validation && webhook_payload_phone_number_stock_available.nil?
1231
+ fail ArgumentError, "Missing the required parameter 'webhook_payload_phone_number_stock_available' when calling WebhookEventsApi.on_phone_number_stock_available"
1232
+ end
1233
+ # resource path
1234
+ local_var_path = '/phone_number.stock_available'
1235
+
1236
+ # query parameters
1237
+ query_params = opts[:query_params] || {}
1238
+
1239
+ # header parameters
1240
+ header_params = opts[:header_params] || {}
1241
+ # HTTP header 'Content-Type'
1242
+ content_type = @api_client.select_header_content_type(['application/json'])
1243
+ if !content_type.nil?
1244
+ header_params['Content-Type'] = content_type
1245
+ end
1246
+
1247
+ # form parameters
1248
+ form_params = opts[:form_params] || {}
1249
+
1250
+ # http body (model)
1251
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_payload_phone_number_stock_available)
1252
+
1253
+ # return_type
1254
+ return_type = opts[:debug_return_type]
1255
+
1256
+ # auth_names
1257
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1258
+
1259
+ new_options = opts.merge(
1260
+ :operation => :"WebhookEventsApi.on_phone_number_stock_available",
1261
+ :header_params => header_params,
1262
+ :query_params => query_params,
1263
+ :form_params => form_params,
1264
+ :body => post_body,
1265
+ :auth_names => auth_names,
1266
+ :return_type => return_type
1267
+ )
1268
+
1269
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1270
+ if @api_client.config.debugging
1271
+ @api_client.config.logger.debug "API called: WebhookEventsApi#on_phone_number_stock_available\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1272
+ end
1273
+ return data, status_code, headers
1274
+ end
1275
+
1210
1276
  # Post cancelled event
1211
1277
  # Fired when a post publishing job is cancelled.
1212
1278
  # @param webhook_payload_post [WebhookPayloadPost]
@@ -0,0 +1,183 @@
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 CreatePhoneNumberStockWatchRequest < ApiModelBase
18
+ # ISO 3166-1 alpha-2 code of a country listed by GET /v1/phone-numbers/countries.
19
+ attr_accessor :country
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'country' => :'country'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'country' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CreatePhoneNumberStockWatchRequest` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CreatePhoneNumberStockWatchRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'country')
68
+ self.country = attributes[:'country']
69
+ else
70
+ self.country = nil
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ if @country.nil?
80
+ invalid_properties.push('invalid value for "country", country cannot be nil.')
81
+ end
82
+
83
+ if @country.to_s.length > 2
84
+ invalid_properties.push('invalid value for "country", the character length must be smaller than or equal to 2.')
85
+ end
86
+
87
+ if @country.to_s.length < 2
88
+ invalid_properties.push('invalid value for "country", the character length must be greater than or equal to 2.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ warn '[DEPRECATED] the `valid?` method is obsolete'
98
+ return false if @country.nil?
99
+ return false if @country.to_s.length > 2
100
+ return false if @country.to_s.length < 2
101
+ true
102
+ end
103
+
104
+ # Custom attribute writer method with validation
105
+ # @param [Object] country Value to be assigned
106
+ def country=(country)
107
+ if country.nil?
108
+ fail ArgumentError, 'country cannot be nil'
109
+ end
110
+
111
+ if country.to_s.length > 2
112
+ fail ArgumentError, 'invalid value for "country", the character length must be smaller than or equal to 2.'
113
+ end
114
+
115
+ if country.to_s.length < 2
116
+ fail ArgumentError, 'invalid value for "country", the character length must be greater than or equal to 2.'
117
+ end
118
+
119
+ @country = country
120
+ end
121
+
122
+ # Checks equality by comparing each attribute.
123
+ # @param [Object] Object to be compared
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ country == o.country
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Integer] Hash code
138
+ def hash
139
+ [country].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def self.build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ attributes = attributes.transform_keys(&:to_sym)
148
+ transformed_hash = {}
149
+ openapi_types.each_pair do |key, type|
150
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
151
+ transformed_hash["#{key}"] = nil
152
+ elsif type =~ /\AArray<(.*)>/i
153
+ # check to ensure the input is an array given that the attribute
154
+ # is documented as an array but the input is not
155
+ if attributes[attribute_map[key]].is_a?(Array)
156
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
157
+ end
158
+ elsif !attributes[attribute_map[key]].nil?
159
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
160
+ end
161
+ end
162
+ new(transformed_hash)
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ if value.nil?
172
+ is_nullable = self.class.openapi_nullable.include?(attr)
173
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
174
+ end
175
+
176
+ hash[param] = _to_hash(value)
177
+ end
178
+ hash
179
+ end
180
+
181
+ end
182
+
183
+ end
@@ -0,0 +1,149 @@
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 ListPhoneNumberStockWatches200Response < ApiModelBase
18
+ attr_accessor :watches
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'watches' => :'watches'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'watches' => :'Array<PhoneNumberStockWatch>'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::ListPhoneNumberStockWatches200Response` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::ListPhoneNumberStockWatches200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'watches')
67
+ if (value = attributes[:'watches']).is_a?(Array)
68
+ self.watches = value
69
+ end
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ watches == o.watches
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Integer] Hash code
104
+ def hash
105
+ [watches].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def self.build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ attributes = attributes.transform_keys(&:to_sym)
114
+ transformed_hash = {}
115
+ openapi_types.each_pair do |key, type|
116
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
117
+ transformed_hash["#{key}"] = nil
118
+ elsif type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[attribute_map[key]].is_a?(Array)
122
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
123
+ end
124
+ elsif !attributes[attribute_map[key]].nil?
125
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
126
+ end
127
+ end
128
+ new(transformed_hash)
129
+ end
130
+
131
+ # Returns the object in the form of hash
132
+ # @return [Hash] Returns the object in the form of hash
133
+ def to_hash
134
+ hash = {}
135
+ self.class.attribute_map.each_pair do |attr, param|
136
+ value = self.send(attr)
137
+ if value.nil?
138
+ is_nullable = self.class.openapi_nullable.include?(attr)
139
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
140
+ end
141
+
142
+ hash[param] = _to_hash(value)
143
+ end
144
+ hash
145
+ end
146
+
147
+ end
148
+
149
+ end