zernio-sdk 0.0.847 → 0.0.848
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.
- checksums.yaml +4 -4
- data/docs/CreatePhoneNumberStockWatchRequest.md +3 -1
- data/docs/PhoneNumberStockWatch.md +2 -0
- data/docs/PhoneNumbersApi.md +1 -1
- data/lib/zernio-sdk/api/phone_numbers_api.rb +2 -2
- data/lib/zernio-sdk/models/create_phone_number_stock_watch_request.rb +48 -4
- data/lib/zernio-sdk/models/phone_number_stock_watch.rb +48 -1
- data/lib/zernio-sdk/version.rb +1 -1
- data/openapi.yaml +18 -5
- data/spec/api/phone_numbers_api_spec.rb +1 -1
- data/spec/models/create_phone_number_stock_watch_request_spec.rb +10 -0
- data/spec/models/phone_number_stock_watch_spec.rb +10 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f8bae5f1c84fdec763ef43f93d2ac74de874a656369e398bf5198433a08848e4
|
|
4
|
+
data.tar.gz: 6ad3b2aec91a9bdcf7ded38410d06cf3d9cf5e2d82ccb86e59fc441f41641050
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 424648936bb7436db8b8d66655347bbd71100915773bd1ab2f5f4180097215a488bf4cef238c8331c14b738678787f506d21917da12b82776339637da68ecf3c
|
|
7
|
+
data.tar.gz: b9a1c4555a35505382c0d2f54af4157567dc9fcf57ed7158833a558d06dec9f5b6cc4b1fca2b15566836c232842744fa410a864cff9cff8a844f924acaa5f7e8
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
7
|
| **country** | **String** | ISO 3166-1 alpha-2 code of a country listed by GET /v1/phone-numbers/countries. | |
|
|
8
|
+
| **number_type** | **String** | Narrow the watch to one number type. Omit to be notified when any type in the country is back. | [optional] |
|
|
8
9
|
|
|
9
10
|
## Example
|
|
10
11
|
|
|
@@ -12,7 +13,8 @@
|
|
|
12
13
|
require 'zernio-sdk'
|
|
13
14
|
|
|
14
15
|
instance = Zernio::CreatePhoneNumberStockWatchRequest.new(
|
|
15
|
-
country: null
|
|
16
|
+
country: null,
|
|
17
|
+
number_type: null
|
|
16
18
|
)
|
|
17
19
|
```
|
|
18
20
|
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
| **id** | **String** | | |
|
|
8
8
|
| **country** | **String** | ISO 3166-1 alpha-2. | |
|
|
9
9
|
| **country_name** | **String** | | |
|
|
10
|
+
| **number_type** | **String** | The watched number type, or null when the watch covers every type in the country. | |
|
|
10
11
|
| **created_at** | **Time** | | |
|
|
11
12
|
|
|
12
13
|
## Example
|
|
@@ -18,6 +19,7 @@ instance = Zernio::PhoneNumberStockWatch.new(
|
|
|
18
19
|
id: null,
|
|
19
20
|
country: null,
|
|
20
21
|
country_name: null,
|
|
22
|
+
number_type: null,
|
|
21
23
|
created_at: null
|
|
22
24
|
)
|
|
23
25
|
```
|
data/docs/PhoneNumbersApi.md
CHANGED
|
@@ -391,7 +391,7 @@ end
|
|
|
391
391
|
|
|
392
392
|
Watch an out-of-stock country
|
|
393
393
|
|
|
394
|
-
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
|
|
394
|
+
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 and number type; 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 watches at once. Countries and types marked `fulfilment: request` by GET /v1/phone-numbers/countries can also be watched. Those are sourced by a carrier request rather than held in stock, so a watch records interest and no date is implied.
|
|
395
395
|
|
|
396
396
|
### Examples
|
|
397
397
|
|
|
@@ -361,7 +361,7 @@ module Zernio
|
|
|
361
361
|
end
|
|
362
362
|
|
|
363
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
|
|
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 and number type; 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 watches at once. Countries and types marked `fulfilment: request` by GET /v1/phone-numbers/countries can also be watched. Those are sourced by a carrier request rather than held in stock, so a watch records interest and no date is implied.
|
|
365
365
|
# @param create_phone_number_stock_watch_request [CreatePhoneNumberStockWatchRequest]
|
|
366
366
|
# @param [Hash] opts the optional parameters
|
|
367
367
|
# @return [PhoneNumberStockWatch]
|
|
@@ -371,7 +371,7 @@ module Zernio
|
|
|
371
371
|
end
|
|
372
372
|
|
|
373
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
|
|
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 and number type; 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 watches at once. Countries and types marked `fulfilment: request` by GET /v1/phone-numbers/countries can also be watched. Those are sourced by a carrier request rather than held in stock, so a watch records interest and no date is implied.
|
|
375
375
|
# @param create_phone_number_stock_watch_request [CreatePhoneNumberStockWatchRequest]
|
|
376
376
|
# @param [Hash] opts the optional parameters
|
|
377
377
|
# @return [Array<(PhoneNumberStockWatch, Integer, Hash)>] PhoneNumberStockWatch data, response status code and response headers
|
|
@@ -18,10 +18,36 @@ module Zernio
|
|
|
18
18
|
# ISO 3166-1 alpha-2 code of a country listed by GET /v1/phone-numbers/countries.
|
|
19
19
|
attr_accessor :country
|
|
20
20
|
|
|
21
|
+
# Narrow the watch to one number type. Omit to be notified when any type in the country is back.
|
|
22
|
+
attr_accessor :number_type
|
|
23
|
+
|
|
24
|
+
class EnumAttributeValidator
|
|
25
|
+
attr_reader :datatype
|
|
26
|
+
attr_reader :allowable_values
|
|
27
|
+
|
|
28
|
+
def initialize(datatype, allowable_values)
|
|
29
|
+
@allowable_values = allowable_values.map do |value|
|
|
30
|
+
case datatype.to_s
|
|
31
|
+
when /Integer/i
|
|
32
|
+
value.to_i
|
|
33
|
+
when /Float/i
|
|
34
|
+
value.to_f
|
|
35
|
+
else
|
|
36
|
+
value
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def valid?(value)
|
|
42
|
+
!value || allowable_values.include?(value)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
21
46
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
22
47
|
def self.attribute_map
|
|
23
48
|
{
|
|
24
|
-
:'country' => :'country'
|
|
49
|
+
:'country' => :'country',
|
|
50
|
+
:'number_type' => :'numberType'
|
|
25
51
|
}
|
|
26
52
|
end
|
|
27
53
|
|
|
@@ -38,7 +64,8 @@ module Zernio
|
|
|
38
64
|
# Attribute type mapping.
|
|
39
65
|
def self.openapi_types
|
|
40
66
|
{
|
|
41
|
-
:'country' => :'String'
|
|
67
|
+
:'country' => :'String',
|
|
68
|
+
:'number_type' => :'String'
|
|
42
69
|
}
|
|
43
70
|
end
|
|
44
71
|
|
|
@@ -69,6 +96,10 @@ module Zernio
|
|
|
69
96
|
else
|
|
70
97
|
self.country = nil
|
|
71
98
|
end
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'number_type')
|
|
101
|
+
self.number_type = attributes[:'number_type']
|
|
102
|
+
end
|
|
72
103
|
end
|
|
73
104
|
|
|
74
105
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -98,6 +129,8 @@ module Zernio
|
|
|
98
129
|
return false if @country.nil?
|
|
99
130
|
return false if @country.to_s.length > 2
|
|
100
131
|
return false if @country.to_s.length < 2
|
|
132
|
+
number_type_validator = EnumAttributeValidator.new('String', ["local", "mobile", "national", "toll_free"])
|
|
133
|
+
return false unless number_type_validator.valid?(@number_type)
|
|
101
134
|
true
|
|
102
135
|
end
|
|
103
136
|
|
|
@@ -119,12 +152,23 @@ module Zernio
|
|
|
119
152
|
@country = country
|
|
120
153
|
end
|
|
121
154
|
|
|
155
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
156
|
+
# @param [Object] number_type Object to be assigned
|
|
157
|
+
def number_type=(number_type)
|
|
158
|
+
validator = EnumAttributeValidator.new('String', ["local", "mobile", "national", "toll_free"])
|
|
159
|
+
unless validator.valid?(number_type)
|
|
160
|
+
fail ArgumentError, "invalid value for \"number_type\", must be one of #{validator.allowable_values}."
|
|
161
|
+
end
|
|
162
|
+
@number_type = number_type
|
|
163
|
+
end
|
|
164
|
+
|
|
122
165
|
# Checks equality by comparing each attribute.
|
|
123
166
|
# @param [Object] Object to be compared
|
|
124
167
|
def ==(o)
|
|
125
168
|
return true if self.equal?(o)
|
|
126
169
|
self.class == o.class &&
|
|
127
|
-
country == o.country
|
|
170
|
+
country == o.country &&
|
|
171
|
+
number_type == o.number_type
|
|
128
172
|
end
|
|
129
173
|
|
|
130
174
|
# @see the `==` method
|
|
@@ -136,7 +180,7 @@ module Zernio
|
|
|
136
180
|
# Calculates hash code according to all attributes.
|
|
137
181
|
# @return [Integer] Hash code
|
|
138
182
|
def hash
|
|
139
|
-
[country].hash
|
|
183
|
+
[country, number_type].hash
|
|
140
184
|
end
|
|
141
185
|
|
|
142
186
|
# Builds the object from hash
|
|
@@ -22,14 +22,40 @@ module Zernio
|
|
|
22
22
|
|
|
23
23
|
attr_accessor :country_name
|
|
24
24
|
|
|
25
|
+
# The watched number type, or null when the watch covers every type in the country.
|
|
26
|
+
attr_accessor :number_type
|
|
27
|
+
|
|
25
28
|
attr_accessor :created_at
|
|
26
29
|
|
|
30
|
+
class EnumAttributeValidator
|
|
31
|
+
attr_reader :datatype
|
|
32
|
+
attr_reader :allowable_values
|
|
33
|
+
|
|
34
|
+
def initialize(datatype, allowable_values)
|
|
35
|
+
@allowable_values = allowable_values.map do |value|
|
|
36
|
+
case datatype.to_s
|
|
37
|
+
when /Integer/i
|
|
38
|
+
value.to_i
|
|
39
|
+
when /Float/i
|
|
40
|
+
value.to_f
|
|
41
|
+
else
|
|
42
|
+
value
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def valid?(value)
|
|
48
|
+
!value || allowable_values.include?(value)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
27
52
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
28
53
|
def self.attribute_map
|
|
29
54
|
{
|
|
30
55
|
:'id' => :'id',
|
|
31
56
|
:'country' => :'country',
|
|
32
57
|
:'country_name' => :'countryName',
|
|
58
|
+
:'number_type' => :'numberType',
|
|
33
59
|
:'created_at' => :'createdAt'
|
|
34
60
|
}
|
|
35
61
|
end
|
|
@@ -50,6 +76,7 @@ module Zernio
|
|
|
50
76
|
:'id' => :'String',
|
|
51
77
|
:'country' => :'String',
|
|
52
78
|
:'country_name' => :'String',
|
|
79
|
+
:'number_type' => :'String',
|
|
53
80
|
:'created_at' => :'Time'
|
|
54
81
|
}
|
|
55
82
|
end
|
|
@@ -57,6 +84,7 @@ module Zernio
|
|
|
57
84
|
# List of attributes with nullable: true
|
|
58
85
|
def self.openapi_nullable
|
|
59
86
|
Set.new([
|
|
87
|
+
:'number_type',
|
|
60
88
|
])
|
|
61
89
|
end
|
|
62
90
|
|
|
@@ -94,6 +122,12 @@ module Zernio
|
|
|
94
122
|
self.country_name = nil
|
|
95
123
|
end
|
|
96
124
|
|
|
125
|
+
if attributes.key?(:'number_type')
|
|
126
|
+
self.number_type = attributes[:'number_type']
|
|
127
|
+
else
|
|
128
|
+
self.number_type = nil
|
|
129
|
+
end
|
|
130
|
+
|
|
97
131
|
if attributes.key?(:'created_at')
|
|
98
132
|
self.created_at = attributes[:'created_at']
|
|
99
133
|
else
|
|
@@ -132,6 +166,8 @@ module Zernio
|
|
|
132
166
|
return false if @id.nil?
|
|
133
167
|
return false if @country.nil?
|
|
134
168
|
return false if @country_name.nil?
|
|
169
|
+
number_type_validator = EnumAttributeValidator.new('String', ["local", "mobile", "national", "toll_free"])
|
|
170
|
+
return false unless number_type_validator.valid?(@number_type)
|
|
135
171
|
return false if @created_at.nil?
|
|
136
172
|
true
|
|
137
173
|
end
|
|
@@ -166,6 +202,16 @@ module Zernio
|
|
|
166
202
|
@country_name = country_name
|
|
167
203
|
end
|
|
168
204
|
|
|
205
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
206
|
+
# @param [Object] number_type Object to be assigned
|
|
207
|
+
def number_type=(number_type)
|
|
208
|
+
validator = EnumAttributeValidator.new('String', ["local", "mobile", "national", "toll_free"])
|
|
209
|
+
unless validator.valid?(number_type)
|
|
210
|
+
fail ArgumentError, "invalid value for \"number_type\", must be one of #{validator.allowable_values}."
|
|
211
|
+
end
|
|
212
|
+
@number_type = number_type
|
|
213
|
+
end
|
|
214
|
+
|
|
169
215
|
# Custom attribute writer method with validation
|
|
170
216
|
# @param [Object] created_at Value to be assigned
|
|
171
217
|
def created_at=(created_at)
|
|
@@ -184,6 +230,7 @@ module Zernio
|
|
|
184
230
|
id == o.id &&
|
|
185
231
|
country == o.country &&
|
|
186
232
|
country_name == o.country_name &&
|
|
233
|
+
number_type == o.number_type &&
|
|
187
234
|
created_at == o.created_at
|
|
188
235
|
end
|
|
189
236
|
|
|
@@ -196,7 +243,7 @@ module Zernio
|
|
|
196
243
|
# Calculates hash code according to all attributes.
|
|
197
244
|
# @return [Integer] Hash code
|
|
198
245
|
def hash
|
|
199
|
-
[id, country, country_name, created_at].hash
|
|
246
|
+
[id, country, country_name, number_type, created_at].hash
|
|
200
247
|
end
|
|
201
248
|
|
|
202
249
|
# Builds the object from hash
|
data/lib/zernio-sdk/version.rb
CHANGED
data/openapi.yaml
CHANGED
|
@@ -2724,11 +2724,15 @@ components:
|
|
|
2724
2724
|
description: '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.'
|
|
2725
2725
|
PhoneNumberStockWatch:
|
|
2726
2726
|
type: object
|
|
2727
|
-
required: [id, country, countryName, createdAt]
|
|
2727
|
+
required: [id, country, countryName, numberType, createdAt]
|
|
2728
2728
|
properties:
|
|
2729
2729
|
id: { type: string }
|
|
2730
2730
|
country: { type: string, description: 'ISO 3166-1 alpha-2.' }
|
|
2731
2731
|
countryName: { type: string }
|
|
2732
|
+
numberType:
|
|
2733
|
+
type: [string, "null"]
|
|
2734
|
+
enum: [local, mobile, national, toll_free, null]
|
|
2735
|
+
description: 'The watched number type, or null when the watch covers every type in the country.'
|
|
2732
2736
|
createdAt: { type: string, format: date-time }
|
|
2733
2737
|
WebhookPayloadPhoneNumberStockAvailable:
|
|
2734
2738
|
type: object
|
|
@@ -36619,9 +36623,14 @@ paths:
|
|
|
36619
36623
|
Get notified the first time an out-of-stock country has deliverable
|
|
36620
36624
|
numbers again: an email to the account holder plus the
|
|
36621
36625
|
`phone_number.stock_available` webhook. Stock is re-checked every 6h.
|
|
36622
|
-
One watch per country; a repeat request returns the
|
|
36623
|
-
(200). The watch is consumed when it fires, so re-create
|
|
36624
|
-
miss the stock. Up to 20
|
|
36626
|
+
One watch per country and number type; a repeat request returns the
|
|
36627
|
+
existing watch (200). The watch is consumed when it fires, so re-create
|
|
36628
|
+
it if you miss the stock. Up to 20 watches at once.
|
|
36629
|
+
|
|
36630
|
+
Countries and types marked `fulfilment: request` by
|
|
36631
|
+
GET /v1/phone-numbers/countries can also be watched. Those are sourced
|
|
36632
|
+
by a carrier request rather than held in stock, so a watch records
|
|
36633
|
+
interest and no date is implied.
|
|
36625
36634
|
security:
|
|
36626
36635
|
- bearerAuth: []
|
|
36627
36636
|
requestBody:
|
|
@@ -36633,6 +36642,10 @@ paths:
|
|
|
36633
36642
|
required: [country]
|
|
36634
36643
|
properties:
|
|
36635
36644
|
country: { type: string, minLength: 2, maxLength: 2, description: 'ISO 3166-1 alpha-2 code of a country listed by GET /v1/phone-numbers/countries.' }
|
|
36645
|
+
numberType:
|
|
36646
|
+
type: string
|
|
36647
|
+
enum: [local, mobile, national, toll_free]
|
|
36648
|
+
description: 'Narrow the watch to one number type. Omit to be notified when any type in the country is back.'
|
|
36636
36649
|
responses:
|
|
36637
36650
|
'201':
|
|
36638
36651
|
description: Watch created.
|
|
@@ -36641,7 +36654,7 @@ paths:
|
|
|
36641
36654
|
schema:
|
|
36642
36655
|
$ref: '#/components/schemas/PhoneNumberStockWatch'
|
|
36643
36656
|
'200':
|
|
36644
|
-
description: A watch for this country already existed; returned unchanged.
|
|
36657
|
+
description: 'A watch for this country and type already existed; returned unchanged.'
|
|
36645
36658
|
content:
|
|
36646
36659
|
application/json:
|
|
36647
36660
|
schema:
|
|
@@ -96,7 +96,7 @@ describe 'PhoneNumbersApi' do
|
|
|
96
96
|
|
|
97
97
|
# unit tests for create_phone_number_stock_watch
|
|
98
98
|
# Watch an out-of-stock country
|
|
99
|
-
# 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
|
|
99
|
+
# 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 and number type; 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 watches at once. Countries and types marked `fulfilment: request` by GET /v1/phone-numbers/countries can also be watched. Those are sourced by a carrier request rather than held in stock, so a watch records interest and no date is implied.
|
|
100
100
|
# @param create_phone_number_stock_watch_request
|
|
101
101
|
# @param [Hash] opts the optional parameters
|
|
102
102
|
# @return [PhoneNumberStockWatch]
|
|
@@ -33,4 +33,14 @@ describe Zernio::CreatePhoneNumberStockWatchRequest do
|
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
describe 'test attribute "number_type"' do
|
|
37
|
+
it 'should work' do
|
|
38
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
39
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["local", "mobile", "national", "toll_free"])
|
|
40
|
+
# validator.allowable_values.each do |value|
|
|
41
|
+
# expect { instance.number_type = value }.not_to raise_error
|
|
42
|
+
# end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
36
46
|
end
|
|
@@ -45,6 +45,16 @@ describe Zernio::PhoneNumberStockWatch do
|
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
describe 'test attribute "number_type"' do
|
|
49
|
+
it 'should work' do
|
|
50
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
51
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["local", "mobile", "national", "toll_free"])
|
|
52
|
+
# validator.allowable_values.each do |value|
|
|
53
|
+
# expect { instance.number_type = value }.not_to raise_error
|
|
54
|
+
# end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
48
58
|
describe 'test attribute "created_at"' do
|
|
49
59
|
it 'should work' do
|
|
50
60
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|