late-sdk 0.0.609 → 0.0.611

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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -0
  3. data/docs/PurchasePhoneNumber200ResponseOneOf1PhoneNumber.md +3 -1
  4. data/docs/PurchasePhoneNumber200ResponseOneOf2.md +3 -1
  5. data/docs/PurchasePhoneNumberRequest.md +2 -2
  6. data/docs/PurchaseWhatsAppPhoneNumber200Response.md +51 -0
  7. data/docs/PurchaseWhatsAppPhoneNumber200ResponseOneOf.md +20 -0
  8. data/docs/PurchaseWhatsAppPhoneNumber200ResponseOneOf1.md +22 -0
  9. data/docs/PurchaseWhatsAppPhoneNumber200ResponseOneOfPhoneNumber.md +30 -0
  10. data/docs/WhatsAppPhoneNumbersApi.md +4 -4
  11. data/lib/zernio-sdk/api/whats_app_phone_numbers_api.rb +3 -3
  12. data/lib/zernio-sdk/models/purchase_phone_number200_response_one_of1_phone_number.rb +14 -4
  13. data/lib/zernio-sdk/models/purchase_phone_number200_response_one_of2.rb +14 -4
  14. data/lib/zernio-sdk/models/purchase_phone_number_request.rb +2 -2
  15. data/lib/zernio-sdk/models/purchase_whats_app_phone_number200_response.rb +105 -0
  16. data/lib/zernio-sdk/models/purchase_whats_app_phone_number200_response_one_of.rb +157 -0
  17. data/lib/zernio-sdk/models/purchase_whats_app_phone_number200_response_one_of1.rb +200 -0
  18. data/lib/zernio-sdk/models/purchase_whats_app_phone_number200_response_one_of_phone_number.rb +201 -0
  19. data/lib/zernio-sdk/version.rb +1 -1
  20. data/lib/zernio-sdk.rb +4 -0
  21. data/openapi.yaml +14 -6
  22. data/spec/api/whats_app_phone_numbers_api_spec.rb +1 -1
  23. data/spec/models/purchase_phone_number200_response_one_of1_phone_number_spec.rb +6 -0
  24. data/spec/models/purchase_phone_number200_response_one_of2_spec.rb +6 -0
  25. data/spec/models/purchase_whats_app_phone_number200_response_one_of1_spec.rb +52 -0
  26. data/spec/models/purchase_whats_app_phone_number200_response_one_of_phone_number_spec.rb +72 -0
  27. data/spec/models/purchase_whats_app_phone_number200_response_one_of_spec.rb +42 -0
  28. data/spec/models/purchase_whats_app_phone_number200_response_spec.rb +32 -0
  29. data/zernio-sdk-0.0.611.gem +0 -0
  30. metadata +18 -2
  31. data/zernio-sdk-0.0.609.gem +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 283cdfa0ea2cb66472a18e4d9f1c5d939cfe9d1f23725c22ef7c711e2f33bc04
4
- data.tar.gz: 031d2f73d13096aec616ddb82b336a4bfef60b7e772a246f7259c2e6441882eb
3
+ metadata.gz: b6200a97075534b49c1532083cf74002c3f3b1215f575ceca4655b9513352ef0
4
+ data.tar.gz: 4c48ba42386004612ffcc6d12ce52a92c8083f243e5c253002c91cb8aa34aaa9
5
5
  SHA512:
6
- metadata.gz: dd1a60c104bb44c37ff5d2abae3d2f9cb8d4a84f4bad0c2b2838def5895553f4505d683e5109fff3baa2079c34102cd58901e91af602af81e4b34af758c3c1c2
7
- data.tar.gz: 57efd4c87ac005566edb66b958663d77f8cbf1c2c78a30fd42fb8250e30f269ae975542e7ec03cf45d0e90c287bf98fdc5e98853d2e605dba059921a8e73156c
6
+ metadata.gz: e1cffd1c09b64854ffa12d62cea35532c82bed741dd110d6c3649e49f86c0e3c371f40bdbf26ed7d8c56b20d339e8474d8eefdfebbeb1595ea13d5b0f8cf3c42
7
+ data.tar.gz: 37b655e2ef9e33facaa9916177c9b35a39b06a6909f76f6dc915754fdab6a7d68517d5fbb6bf67e6e04c815d8214dbe9eae292cc167d067e856033a2ef7aab75
data/README.md CHANGED
@@ -1593,6 +1593,10 @@ Class | Method | HTTP request | Description
1593
1593
  - [Zernio::PurchasePhoneNumber202Response](docs/PurchasePhoneNumber202Response.md)
1594
1594
  - [Zernio::PurchasePhoneNumber409Response](docs/PurchasePhoneNumber409Response.md)
1595
1595
  - [Zernio::PurchasePhoneNumberRequest](docs/PurchasePhoneNumberRequest.md)
1596
+ - [Zernio::PurchaseWhatsAppPhoneNumber200Response](docs/PurchaseWhatsAppPhoneNumber200Response.md)
1597
+ - [Zernio::PurchaseWhatsAppPhoneNumber200ResponseOneOf](docs/PurchaseWhatsAppPhoneNumber200ResponseOneOf.md)
1598
+ - [Zernio::PurchaseWhatsAppPhoneNumber200ResponseOneOf1](docs/PurchaseWhatsAppPhoneNumber200ResponseOneOf1.md)
1599
+ - [Zernio::PurchaseWhatsAppPhoneNumber200ResponseOneOfPhoneNumber](docs/PurchaseWhatsAppPhoneNumber200ResponseOneOfPhoneNumber.md)
1596
1600
  - [Zernio::PurchaseWhatsAppPhoneNumberRequest](docs/PurchaseWhatsAppPhoneNumberRequest.md)
1597
1601
  - [Zernio::QueryAdInsights200Response](docs/QueryAdInsights200Response.md)
1598
1602
  - [Zernio::QueryAdInsights200ResponsePaging](docs/QueryAdInsights200ResponsePaging.md)
@@ -11,6 +11,7 @@
11
11
  | **provisioned_at** | **Time** | | [optional] |
12
12
  | **meta_preverified_id** | **String** | | [optional] |
13
13
  | **meta_verification_status** | **String** | | [optional] |
14
+ | **profile_id** | **String** | The profile the number was actually assigned to. | [optional] |
14
15
 
15
16
  ## Example
16
17
 
@@ -24,7 +25,8 @@ instance = Zernio::PurchasePhoneNumber200ResponseOneOf1PhoneNumber.new(
24
25
  country: null,
25
26
  provisioned_at: null,
26
27
  meta_preverified_id: null,
27
- meta_verification_status: null
28
+ meta_verification_status: null,
29
+ profile_id: null
28
30
  )
29
31
  ```
30
32
 
@@ -7,6 +7,7 @@
7
7
  | **status** | **String** | | [optional] |
8
8
  | **number_id** | **String** | | [optional] |
9
9
  | **phone_number** | **String** | | [optional] |
10
+ | **profile_id** | **String** | The profile the number was actually assigned to. | [optional] |
10
11
 
11
12
  ## Example
12
13
 
@@ -16,7 +17,8 @@ require 'zernio-sdk'
16
17
  instance = Zernio::PurchasePhoneNumber200ResponseOneOf2.new(
17
18
  status: null,
18
19
  number_id: null,
19
- phone_number: null
20
+ phone_number: null,
21
+ profile_id: null
20
22
  )
21
23
  ```
22
24
 
@@ -4,14 +4,14 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
- | **profile_id** | **String** | Profile to associate the number with | |
7
+ | **profile_id** | **String** | Preferred profile for the number. One number = one profile, so when the requested profile already holds a number the API assigns the next free profile instead (or creates one) and returns the actual assignment in `profileId` on the response. | |
8
8
  | **country** | **String** | ISO 3166-1 alpha-2 country for the number (default US). International numbers require usage-based billing. Tier 3/4 countries return 202 { status: \"kyc_required\", kycUrl } — the customer must complete KYC at that URL before the number is ordered. See GET /v1/phone-numbers/countries. | [optional][default to 'US'] |
9
9
  | **number_type** | **String** | Which of the country's offered number types to order (see `types[]` on GET /v1/phone-numbers/countries). Omitted = the country's default type, which is always the WhatsApp-safe choice. Capabilities, price, and KYC requirements are per (country, type): toll_free can never connect WhatsApp (400 when combined with connectWhatsapp:true), and wantsSms:true requires an SMS-capable type. | [optional] |
10
10
  | **area_code** | **String** | Area code (national destination code, e.g. 11 for Sao Paulo) the number must be in. Hard constraint: when the area has no deliverable inventory the purchase fails with 409 code AREA_CODE_UNAVAILABLE instead of assigning a number from another area, and later replacements stay in this area too. Omit for any area. Get live options from GET /v1/phone-numbers/availability (areaOptions). | [optional] |
11
11
  | **connect_whatsapp** | **Boolean** | A phone number is the unit; WhatsApp is one optional feature. Pass false to buy a STANDALONE number (Calls/SMS only): provisioning skips the Meta pre-verify/OTP steps and the number activates immediately. Omitted defaults to the WhatsApp provisioning path. WhatsApp can be connected to a standalone number later from the connect flow. | [optional][default to true] |
12
12
  | **wants_sms** | **Boolean** | SMS capability is per-number, not per-country. Pass true to provision from the SMS-capable inventory pool so the number can actually text (see also GET /v1/phone-numbers/available with sms=true, and smsAvailable on GET /v1/phone-numbers/countries). | [optional][default to false] |
13
13
  | **wants_whatsapp** | **Boolean** | Declare WhatsApp intent on a STANDALONE purchase (connectWhatsapp:false). The number still activates and bills immediately, but if WhatsApp's buy-time check rejects the assigned number, it is automatically swapped for a WhatsApp-eligible one during the purchase instead of being delivered with WhatsApp unavailable. Ignored on the WhatsApp provisioning path (connectWhatsapp omitted or true), which always delivers a WhatsApp-verified number. | [optional][default to false] |
14
- | **purchase_intent_id** | **String** | Optional idempotency key. Send the same value when retrying a purchase: if a number was already bought under this key, the API returns { status: \"already_purchased\", numberId, phoneNumber } instead of provisioning a second number. Generate a fresh key for each genuinely new purchase. | [optional] |
14
+ | **purchase_intent_id** | **String** | Optional idempotency key. Send the same value when retrying a purchase: if a number was already bought under this key, the API returns { status: \"already_purchased\", numberId, phoneNumber, profileId } instead of provisioning a second number. Generate a fresh key for each genuinely new purchase. | [optional] |
15
15
  | **allow_multiple** | **Boolean** | Any second purchase within 10 minutes of a previous one is rejected with 409 code PURCHASE_VELOCITY as duplicate protection. Pass true to confirm the additional purchase is intentional (e.g. bulk provisioning). | [optional][default to false] |
16
16
 
17
17
  ## Example
@@ -0,0 +1,51 @@
1
+ # Zernio::PurchaseWhatsAppPhoneNumber200Response
2
+
3
+ ## Class instance methods
4
+
5
+ ### `openapi_one_of`
6
+
7
+ Returns the list of classes defined in oneOf.
8
+
9
+ #### Example
10
+
11
+ ```ruby
12
+ require 'zernio-sdk'
13
+
14
+ Zernio::PurchaseWhatsAppPhoneNumber200Response.openapi_one_of
15
+ # =>
16
+ # [
17
+ # :'PurchasePhoneNumber200ResponseOneOf',
18
+ # :'PurchaseWhatsAppPhoneNumber200ResponseOneOf',
19
+ # :'PurchaseWhatsAppPhoneNumber200ResponseOneOf1'
20
+ # ]
21
+ ```
22
+
23
+ ### build
24
+
25
+ Find the appropriate object from the `openapi_one_of` list and casts the data into it.
26
+
27
+ #### Example
28
+
29
+ ```ruby
30
+ require 'zernio-sdk'
31
+
32
+ Zernio::PurchaseWhatsAppPhoneNumber200Response.build(data)
33
+ # => #<PurchasePhoneNumber200ResponseOneOf:0x00007fdd4aab02a0>
34
+
35
+ Zernio::PurchaseWhatsAppPhoneNumber200Response.build(data_that_doesnt_match)
36
+ # => nil
37
+ ```
38
+
39
+ #### Parameters
40
+
41
+ | Name | Type | Description |
42
+ | ---- | ---- | ----------- |
43
+ | **data** | **Mixed** | data to be matched against the list of oneOf items |
44
+
45
+ #### Return type
46
+
47
+ - `PurchasePhoneNumber200ResponseOneOf`
48
+ - `PurchaseWhatsAppPhoneNumber200ResponseOneOf`
49
+ - `PurchaseWhatsAppPhoneNumber200ResponseOneOf1`
50
+ - `nil` (if no type matches)
51
+
@@ -0,0 +1,20 @@
1
+ # Zernio::PurchaseWhatsAppPhoneNumber200ResponseOneOf
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **message** | **String** | | [optional] |
8
+ | **phone_number** | [**PurchaseWhatsAppPhoneNumber200ResponseOneOfPhoneNumber**](PurchaseWhatsAppPhoneNumber200ResponseOneOfPhoneNumber.md) | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'zernio-sdk'
14
+
15
+ instance = Zernio::PurchaseWhatsAppPhoneNumber200ResponseOneOf.new(
16
+ message: null,
17
+ phone_number: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,22 @@
1
+ # Zernio::PurchaseWhatsAppPhoneNumber200ResponseOneOf1
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **status** | **String** | | [optional] |
8
+ | **number_id** | **String** | | [optional] |
9
+ | **phone_number** | **String** | | [optional] |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'zernio-sdk'
15
+
16
+ instance = Zernio::PurchaseWhatsAppPhoneNumber200ResponseOneOf1.new(
17
+ status: null,
18
+ number_id: null,
19
+ phone_number: null
20
+ )
21
+ ```
22
+
@@ -0,0 +1,30 @@
1
+ # Zernio::PurchaseWhatsAppPhoneNumber200ResponseOneOfPhoneNumber
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | | [optional] |
8
+ | **phone_number** | **String** | | [optional] |
9
+ | **status** | **String** | | [optional] |
10
+ | **country** | **String** | | [optional] |
11
+ | **provisioned_at** | **Time** | | [optional] |
12
+ | **meta_preverified_id** | **String** | | [optional] |
13
+ | **meta_verification_status** | **String** | | [optional] |
14
+
15
+ ## Example
16
+
17
+ ```ruby
18
+ require 'zernio-sdk'
19
+
20
+ instance = Zernio::PurchaseWhatsAppPhoneNumber200ResponseOneOfPhoneNumber.new(
21
+ id: null,
22
+ phone_number: null,
23
+ status: null,
24
+ country: null,
25
+ provisioned_at: null,
26
+ meta_preverified_id: null,
27
+ meta_verification_status: null
28
+ )
29
+ ```
30
+
@@ -584,7 +584,7 @@ This endpoint does not need any parameter.
584
584
 
585
585
  ## purchase_whats_app_phone_number
586
586
 
587
- > <PurchasePhoneNumber200Response> purchase_whats_app_phone_number(purchase_whats_app_phone_number_request)
587
+ > <PurchaseWhatsAppPhoneNumber200Response> purchase_whats_app_phone_number(purchase_whats_app_phone_number_request)
588
588
 
589
589
  Purchase phone number
590
590
 
@@ -617,7 +617,7 @@ end
617
617
 
618
618
  This returns an Array which contains the response data, status code and headers.
619
619
 
620
- > <Array(<PurchasePhoneNumber200Response>, Integer, Hash)> purchase_whats_app_phone_number_with_http_info(purchase_whats_app_phone_number_request)
620
+ > <Array(<PurchaseWhatsAppPhoneNumber200Response>, Integer, Hash)> purchase_whats_app_phone_number_with_http_info(purchase_whats_app_phone_number_request)
621
621
 
622
622
  ```ruby
623
623
  begin
@@ -625,7 +625,7 @@ begin
625
625
  data, status_code, headers = api_instance.purchase_whats_app_phone_number_with_http_info(purchase_whats_app_phone_number_request)
626
626
  p status_code # => 2xx
627
627
  p headers # => { ... }
628
- p data # => <PurchasePhoneNumber200Response>
628
+ p data # => <PurchaseWhatsAppPhoneNumber200Response>
629
629
  rescue Zernio::ApiError => e
630
630
  puts "Error when calling WhatsAppPhoneNumbersApi->purchase_whats_app_phone_number_with_http_info: #{e}"
631
631
  end
@@ -639,7 +639,7 @@ end
639
639
 
640
640
  ### Return type
641
641
 
642
- [**PurchasePhoneNumber200Response**](PurchasePhoneNumber200Response.md)
642
+ [**PurchaseWhatsAppPhoneNumber200Response**](PurchaseWhatsAppPhoneNumber200Response.md)
643
643
 
644
644
  ### Authorization
645
645
 
@@ -550,7 +550,7 @@ module Zernio
550
550
  # Deprecated alias of `/v1/phone-numbers/purchase`; same contract. New integrations should use that path. Payment-first: you do not pick a specific number, the system provisions one and auto-assigns it. With usage-based billing active and a payment method on file, the number provisions inline and bills per month on your usage-based invoice (there is no checkout redirect). No payment method on file returns `402 PAYMENT_REQUIRED`; a regulated country returns `202` with `status: \"kyc_required\"` and a `kycUrl`. Requires usage-based billing (the Usage plan). The maximum number of phone numbers is determined by the user's plan.
551
551
  # @param purchase_whats_app_phone_number_request [PurchaseWhatsAppPhoneNumberRequest]
552
552
  # @param [Hash] opts the optional parameters
553
- # @return [PurchasePhoneNumber200Response]
553
+ # @return [PurchaseWhatsAppPhoneNumber200Response]
554
554
  def purchase_whats_app_phone_number(purchase_whats_app_phone_number_request, opts = {})
555
555
  data, _status_code, _headers = purchase_whats_app_phone_number_with_http_info(purchase_whats_app_phone_number_request, opts)
556
556
  data
@@ -560,7 +560,7 @@ module Zernio
560
560
  # Deprecated alias of &#x60;/v1/phone-numbers/purchase&#x60;; same contract. New integrations should use that path. Payment-first: you do not pick a specific number, the system provisions one and auto-assigns it. With usage-based billing active and a payment method on file, the number provisions inline and bills per month on your usage-based invoice (there is no checkout redirect). No payment method on file returns &#x60;402 PAYMENT_REQUIRED&#x60;; a regulated country returns &#x60;202&#x60; with &#x60;status: \&quot;kyc_required\&quot;&#x60; and a &#x60;kycUrl&#x60;. Requires usage-based billing (the Usage plan). The maximum number of phone numbers is determined by the user&#39;s plan.
561
561
  # @param purchase_whats_app_phone_number_request [PurchaseWhatsAppPhoneNumberRequest]
562
562
  # @param [Hash] opts the optional parameters
563
- # @return [Array<(PurchasePhoneNumber200Response, Integer, Hash)>] PurchasePhoneNumber200Response data, response status code and response headers
563
+ # @return [Array<(PurchaseWhatsAppPhoneNumber200Response, Integer, Hash)>] PurchaseWhatsAppPhoneNumber200Response data, response status code and response headers
564
564
  def purchase_whats_app_phone_number_with_http_info(purchase_whats_app_phone_number_request, opts = {})
565
565
  if @api_client.config.debugging
566
566
  @api_client.config.logger.debug 'Calling API: WhatsAppPhoneNumbersApi.purchase_whats_app_phone_number ...'
@@ -592,7 +592,7 @@ module Zernio
592
592
  post_body = opts[:debug_body] || @api_client.object_to_http_body(purchase_whats_app_phone_number_request)
593
593
 
594
594
  # return_type
595
- return_type = opts[:debug_return_type] || 'PurchasePhoneNumber200Response'
595
+ return_type = opts[:debug_return_type] || 'PurchaseWhatsAppPhoneNumber200Response'
596
596
 
597
597
  # auth_names
598
598
  auth_names = opts[:debug_auth_names] || ['bearerAuth']
@@ -29,6 +29,9 @@ module Zernio
29
29
 
30
30
  attr_accessor :meta_verification_status
31
31
 
32
+ # The profile the number was actually assigned to.
33
+ attr_accessor :profile_id
34
+
32
35
  # Attribute mapping from ruby-style variable name to JSON key.
33
36
  def self.attribute_map
34
37
  {
@@ -38,7 +41,8 @@ module Zernio
38
41
  :'country' => :'country',
39
42
  :'provisioned_at' => :'provisionedAt',
40
43
  :'meta_preverified_id' => :'metaPreverifiedId',
41
- :'meta_verification_status' => :'metaVerificationStatus'
44
+ :'meta_verification_status' => :'metaVerificationStatus',
45
+ :'profile_id' => :'profileId'
42
46
  }
43
47
  end
44
48
 
@@ -61,7 +65,8 @@ module Zernio
61
65
  :'country' => :'String',
62
66
  :'provisioned_at' => :'Time',
63
67
  :'meta_preverified_id' => :'String',
64
- :'meta_verification_status' => :'String'
68
+ :'meta_verification_status' => :'String',
69
+ :'profile_id' => :'String'
65
70
  }
66
71
  end
67
72
 
@@ -114,6 +119,10 @@ module Zernio
114
119
  if attributes.key?(:'meta_verification_status')
115
120
  self.meta_verification_status = attributes[:'meta_verification_status']
116
121
  end
122
+
123
+ if attributes.key?(:'profile_id')
124
+ self.profile_id = attributes[:'profile_id']
125
+ end
117
126
  end
118
127
 
119
128
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -142,7 +151,8 @@ module Zernio
142
151
  country == o.country &&
143
152
  provisioned_at == o.provisioned_at &&
144
153
  meta_preverified_id == o.meta_preverified_id &&
145
- meta_verification_status == o.meta_verification_status
154
+ meta_verification_status == o.meta_verification_status &&
155
+ profile_id == o.profile_id
146
156
  end
147
157
 
148
158
  # @see the `==` method
@@ -154,7 +164,7 @@ module Zernio
154
164
  # Calculates hash code according to all attributes.
155
165
  # @return [Integer] Hash code
156
166
  def hash
157
- [id, phone_number, status, country, provisioned_at, meta_preverified_id, meta_verification_status].hash
167
+ [id, phone_number, status, country, provisioned_at, meta_preverified_id, meta_verification_status, profile_id].hash
158
168
  end
159
169
 
160
170
  # Builds the object from hash
@@ -22,6 +22,9 @@ module Zernio
22
22
 
23
23
  attr_accessor :phone_number
24
24
 
25
+ # The profile the number was actually assigned to.
26
+ attr_accessor :profile_id
27
+
25
28
  class EnumAttributeValidator
26
29
  attr_reader :datatype
27
30
  attr_reader :allowable_values
@@ -49,7 +52,8 @@ module Zernio
49
52
  {
50
53
  :'status' => :'status',
51
54
  :'number_id' => :'numberId',
52
- :'phone_number' => :'phoneNumber'
55
+ :'phone_number' => :'phoneNumber',
56
+ :'profile_id' => :'profileId'
53
57
  }
54
58
  end
55
59
 
@@ -68,7 +72,8 @@ module Zernio
68
72
  {
69
73
  :'status' => :'String',
70
74
  :'number_id' => :'String',
71
- :'phone_number' => :'String'
75
+ :'phone_number' => :'String',
76
+ :'profile_id' => :'String'
72
77
  }
73
78
  end
74
79
 
@@ -105,6 +110,10 @@ module Zernio
105
110
  if attributes.key?(:'phone_number')
106
111
  self.phone_number = attributes[:'phone_number']
107
112
  end
113
+
114
+ if attributes.key?(:'profile_id')
115
+ self.profile_id = attributes[:'profile_id']
116
+ end
108
117
  end
109
118
 
110
119
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -141,7 +150,8 @@ module Zernio
141
150
  self.class == o.class &&
142
151
  status == o.status &&
143
152
  number_id == o.number_id &&
144
- phone_number == o.phone_number
153
+ phone_number == o.phone_number &&
154
+ profile_id == o.profile_id
145
155
  end
146
156
 
147
157
  # @see the `==` method
@@ -153,7 +163,7 @@ module Zernio
153
163
  # Calculates hash code according to all attributes.
154
164
  # @return [Integer] Hash code
155
165
  def hash
156
- [status, number_id, phone_number].hash
166
+ [status, number_id, phone_number, profile_id].hash
157
167
  end
158
168
 
159
169
  # Builds the object from hash
@@ -15,7 +15,7 @@ require 'time'
15
15
 
16
16
  module Zernio
17
17
  class PurchasePhoneNumberRequest < ApiModelBase
18
- # Profile to associate the number with
18
+ # Preferred profile for the number. One number = one profile, so when the requested profile already holds a number the API assigns the next free profile instead (or creates one) and returns the actual assignment in `profileId` on the response.
19
19
  attr_accessor :profile_id
20
20
 
21
21
  # ISO 3166-1 alpha-2 country for the number (default US). International numbers require usage-based billing. Tier 3/4 countries return 202 { status: \"kyc_required\", kycUrl } — the customer must complete KYC at that URL before the number is ordered. See GET /v1/phone-numbers/countries.
@@ -36,7 +36,7 @@ module Zernio
36
36
  # Declare WhatsApp intent on a STANDALONE purchase (connectWhatsapp:false). The number still activates and bills immediately, but if WhatsApp's buy-time check rejects the assigned number, it is automatically swapped for a WhatsApp-eligible one during the purchase instead of being delivered with WhatsApp unavailable. Ignored on the WhatsApp provisioning path (connectWhatsapp omitted or true), which always delivers a WhatsApp-verified number.
37
37
  attr_accessor :wants_whatsapp
38
38
 
39
- # Optional idempotency key. Send the same value when retrying a purchase: if a number was already bought under this key, the API returns { status: \"already_purchased\", numberId, phoneNumber } instead of provisioning a second number. Generate a fresh key for each genuinely new purchase.
39
+ # Optional idempotency key. Send the same value when retrying a purchase: if a number was already bought under this key, the API returns { status: \"already_purchased\", numberId, phoneNumber, profileId } instead of provisioning a second number. Generate a fresh key for each genuinely new purchase.
40
40
  attr_accessor :purchase_intent_id
41
41
 
42
42
  # Any second purchase within 10 minutes of a previous one is rejected with 409 code PURCHASE_VELOCITY as duplicate protection. Pass true to confirm the additional purchase is intentional (e.g. bulk provisioning).
@@ -0,0 +1,105 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
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
+ module PurchaseWhatsAppPhoneNumber200Response
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'PurchasePhoneNumber200ResponseOneOf',
23
+ :'PurchaseWhatsAppPhoneNumber200ResponseOneOf',
24
+ :'PurchaseWhatsAppPhoneNumber200ResponseOneOf1'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of oneOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - We do not attempt to check whether exactly one item matches.
35
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
36
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
37
+ # - TODO: scalar values are de facto behaving as if they were nullable.
38
+ # - TODO: logging when debugging is set.
39
+ openapi_one_of.each do |klass|
40
+ begin
41
+ next if klass == :AnyType # "nullable: true"
42
+ return find_and_cast_into_type(klass, data)
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_one_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.iso8601(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = Zernio.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end