zernio-sdk 0.0.548 → 0.0.550

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 (28) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -0
  3. data/docs/CreateWhatsAppTemplateRequest.md +1 -1
  4. data/docs/PurchasePhoneNumberRequest.md +2 -0
  5. data/docs/WhatsAppCarouselCardComponent.md +82 -0
  6. data/docs/WhatsAppCarouselComponent.md +20 -0
  7. data/docs/WhatsAppCarouselComponentCardsInner.md +18 -0
  8. data/docs/WhatsAppLimitedTimeOfferComponent.md +20 -0
  9. data/docs/WhatsAppLimitedTimeOfferComponentLimitedTimeOffer.md +20 -0
  10. data/docs/WhatsAppTemplateComponent.md +8 -2
  11. data/lib/zernio-sdk/models/create_whats_app_template_request.rb +1 -1
  12. data/lib/zernio-sdk/models/purchase_phone_number_request.rb +13 -1
  13. data/lib/zernio-sdk/models/whats_app_carousel_card_component.rb +57 -0
  14. data/lib/zernio-sdk/models/whats_app_carousel_component.rb +235 -0
  15. data/lib/zernio-sdk/models/whats_app_carousel_component_cards_inner.rb +176 -0
  16. data/lib/zernio-sdk/models/whats_app_limited_time_offer_component.rb +214 -0
  17. data/lib/zernio-sdk/models/whats_app_limited_time_offer_component_limited_time_offer.rb +193 -0
  18. data/lib/zernio-sdk/models/whats_app_template_component.rb +6 -2
  19. data/lib/zernio-sdk/version.rb +1 -1
  20. data/lib/zernio-sdk.rb +5 -0
  21. data/openapi.yaml +69 -1
  22. data/spec/models/purchase_phone_number_request_spec.rb +6 -0
  23. data/spec/models/whats_app_carousel_card_component_spec.rb +44 -0
  24. data/spec/models/whats_app_carousel_component_cards_inner_spec.rb +36 -0
  25. data/spec/models/whats_app_carousel_component_spec.rb +46 -0
  26. data/spec/models/whats_app_limited_time_offer_component_limited_time_offer_spec.rb +42 -0
  27. data/spec/models/whats_app_limited_time_offer_component_spec.rb +46 -0
  28. metadata +21 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d41e330aba1ffba4d8eac38593410f83e845781eadadd4856dbbdf5780c1c67
4
- data.tar.gz: 6e17a25a53595737fb8b619ec3e2da956be3f532b0fff95667d33617a06a9c93
3
+ metadata.gz: 67401c9dc22b99bc4f1234d7940dba17484202a8f048e603b830b4a614fc65f9
4
+ data.tar.gz: 51a63cfff2eb2644bcdf08199dbcb676f1ebcad0673d12e7ff86bbd69d88eaf9
5
5
  SHA512:
6
- metadata.gz: a78772ffcfbe668fbdf2c2f65026da938d40ebca0ee4fe0aa182307ad49b4af7a35a8ccb98a3c4b18edf1128064f494ead252325b960254932f47bc86cb9b6bc
7
- data.tar.gz: e67a1274875d8425637ef14f5a1c5fff1033ea43b0e69ec6586f8ed0048250583f4c9b19a19615a49968c91d6d5fde49bd64d70e896c8e224fbfe03a977b72db
6
+ metadata.gz: '08f761e36f302e0f9e96b7b196233833d2bee8ae7612e5bc7056f4df892f518369e2e7795a861335f9050782fcb33c0993179b8d4198eb1084ae17c1336b93e6'
7
+ data.tar.gz: 2f8763b5c75cd7344b8bd0549053b3d48dbd552929ccc41f68030af7188a076d1d5d7f34c6c97ecc16be30a285d6f2d1e0a38212f9b040141fdb45cdee5b03df
data/README.md CHANGED
@@ -2042,9 +2042,14 @@ Class | Method | HTTP request | Description
2042
2042
  - [Zernio::WhatsAppBodyComponent](docs/WhatsAppBodyComponent.md)
2043
2043
  - [Zernio::WhatsAppBodyComponentExample](docs/WhatsAppBodyComponentExample.md)
2044
2044
  - [Zernio::WhatsAppButtonsComponent](docs/WhatsAppButtonsComponent.md)
2045
+ - [Zernio::WhatsAppCarouselCardComponent](docs/WhatsAppCarouselCardComponent.md)
2046
+ - [Zernio::WhatsAppCarouselComponent](docs/WhatsAppCarouselComponent.md)
2047
+ - [Zernio::WhatsAppCarouselComponentCardsInner](docs/WhatsAppCarouselComponentCardsInner.md)
2045
2048
  - [Zernio::WhatsAppFooterComponent](docs/WhatsAppFooterComponent.md)
2046
2049
  - [Zernio::WhatsAppHeaderComponent](docs/WhatsAppHeaderComponent.md)
2047
2050
  - [Zernio::WhatsAppHeaderComponentExample](docs/WhatsAppHeaderComponentExample.md)
2051
+ - [Zernio::WhatsAppLimitedTimeOfferComponent](docs/WhatsAppLimitedTimeOfferComponent.md)
2052
+ - [Zernio::WhatsAppLimitedTimeOfferComponentLimitedTimeOffer](docs/WhatsAppLimitedTimeOfferComponentLimitedTimeOffer.md)
2048
2053
  - [Zernio::WhatsAppSandboxSession](docs/WhatsAppSandboxSession.md)
2049
2054
  - [Zernio::WhatsAppTemplateButton](docs/WhatsAppTemplateButton.md)
2050
2055
  - [Zernio::WhatsAppTemplateComponent](docs/WhatsAppTemplateComponent.md)
@@ -8,7 +8,7 @@
8
8
  | **name** | **String** | Template name (lowercase, letters/numbers/underscores, must start with a letter) | |
9
9
  | **category** | **String** | Template category | |
10
10
  | **language** | **String** | Template language code (e.g., en_US) | |
11
- | **components** | [**Array<WhatsAppTemplateComponent>**](WhatsAppTemplateComponent.md) | Template components (header, body, footer, buttons). Required for custom templates, omit when using library_template_name. | [optional] |
11
+ | **components** | [**Array<WhatsAppTemplateComponent>**](WhatsAppTemplateComponent.md) | Template components (header, body, footer, buttons, carousel, limited_time_offer). Required for custom templates, omit when using library_template_name. | [optional] |
12
12
  | **library_template_name** | **String** | Name of a pre-built template from Meta's template library (e.g., \"appointment_reminder\", \"auto_pay_reminder_1\", \"address_update\"). When provided, the template is pre-approved by Meta with no review wait. Omit components when using this field. | [optional] |
13
13
  | **library_template_body_inputs** | **Object** | Optional body customizations for library templates. Available options depend on the template (e.g., add_contact_number, add_learn_more_link, add_security_recommendation, add_track_package_link, code_expiration_minutes). | [optional] |
14
14
  | **library_template_button_inputs** | [**Array<CreateWhatsAppTemplateRequestLibraryTemplateButtonInputsInner>**](CreateWhatsAppTemplateRequestLibraryTemplateButtonInputsInner.md) | Optional button customizations for library templates. Each item specifies button type and configuration (e.g., URL, phone number, quick reply). | [optional] |
@@ -9,6 +9,7 @@
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
  | **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] |
11
11
  | **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] |
12
+ | **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] |
12
13
  | **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] |
13
14
  | **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] |
14
15
 
@@ -23,6 +24,7 @@ instance = Zernio::PurchasePhoneNumberRequest.new(
23
24
  number_type: null,
24
25
  connect_whatsapp: null,
25
26
  wants_sms: null,
27
+ wants_whatsapp: null,
26
28
  purchase_intent_id: null,
27
29
  allow_multiple: null
28
30
  )
@@ -0,0 +1,82 @@
1
+ # Zernio::WhatsAppCarouselCardComponent
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::WhatsAppCarouselCardComponent.openapi_one_of
15
+ # =>
16
+ # [
17
+ # :'WhatsAppBodyComponent',
18
+ # :'WhatsAppButtonsComponent',
19
+ # :'WhatsAppHeaderComponent'
20
+ # ]
21
+ ```
22
+
23
+ ### `openapi_discriminator_name`
24
+
25
+ Returns the discriminator's property name.
26
+
27
+ #### Example
28
+
29
+ ```ruby
30
+ require 'zernio-sdk'
31
+
32
+ Zernio::WhatsAppCarouselCardComponent.openapi_discriminator_name
33
+ # => :'type'
34
+ ```
35
+
36
+ ### `openapi_discriminator_name`
37
+
38
+ Returns the discriminator's mapping.
39
+
40
+ #### Example
41
+
42
+ ```ruby
43
+ require 'zernio-sdk'
44
+
45
+ Zernio::WhatsAppCarouselCardComponent.openapi_discriminator_mapping
46
+ # =>
47
+ # {
48
+ # :'body' => :'WhatsAppBodyComponent',
49
+ # :'buttons' => :'WhatsAppButtonsComponent',
50
+ # :'header' => :'WhatsAppHeaderComponent'
51
+ # }
52
+ ```
53
+
54
+ ### build
55
+
56
+ Find the appropriate object from the `openapi_one_of` list and casts the data into it.
57
+
58
+ #### Example
59
+
60
+ ```ruby
61
+ require 'zernio-sdk'
62
+
63
+ Zernio::WhatsAppCarouselCardComponent.build(data)
64
+ # => #<WhatsAppBodyComponent:0x00007fdd4aab02a0>
65
+
66
+ Zernio::WhatsAppCarouselCardComponent.build(data_that_doesnt_match)
67
+ # => nil
68
+ ```
69
+
70
+ #### Parameters
71
+
72
+ | Name | Type | Description |
73
+ | ---- | ---- | ----------- |
74
+ | **data** | **Mixed** | data to be matched against the list of oneOf items |
75
+
76
+ #### Return type
77
+
78
+ - `WhatsAppBodyComponent`
79
+ - `WhatsAppButtonsComponent`
80
+ - `WhatsAppHeaderComponent`
81
+ - `nil` (if no type matches)
82
+
@@ -0,0 +1,20 @@
1
+ # Zernio::WhatsAppCarouselComponent
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **type** | **String** | | |
8
+ | **cards** | [**Array&lt;WhatsAppCarouselComponentCardsInner&gt;**](WhatsAppCarouselComponentCardsInner.md) | 2-10 cards. Meta requires all cards to share the same component structure; a mismatch surfaces as a rejected_reason. MARKETING category only. | |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'zernio-sdk'
14
+
15
+ instance = Zernio::WhatsAppCarouselComponent.new(
16
+ type: null,
17
+ cards: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,18 @@
1
+ # Zernio::WhatsAppCarouselComponentCardsInner
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **components** | [**Array&lt;WhatsAppCarouselCardComponent&gt;**](WhatsAppCarouselCardComponent.md) | Per-card components. Each card carries its own media header + optional body + up to 2 buttons. Footer and nested carousel are not allowed inside cards. | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'zernio-sdk'
13
+
14
+ instance = Zernio::WhatsAppCarouselComponentCardsInner.new(
15
+ components: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,20 @@
1
+ # Zernio::WhatsAppLimitedTimeOfferComponent
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **type** | **String** | | |
8
+ | **limited_time_offer** | [**WhatsAppLimitedTimeOfferComponentLimitedTimeOffer**](WhatsAppLimitedTimeOfferComponentLimitedTimeOffer.md) | | |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'zernio-sdk'
14
+
15
+ instance = Zernio::WhatsAppLimitedTimeOfferComponent.new(
16
+ type: null,
17
+ limited_time_offer: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,20 @@
1
+ # Zernio::WhatsAppLimitedTimeOfferComponentLimitedTimeOffer
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **text** | **String** | Short offer label (&lt;&#x3D;16 chars). MARKETING only. | |
8
+ | **has_expiration** | **Boolean** | Toggles the countdown timer. The actual coupon code + expiry are bound at SEND time, not here. | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'zernio-sdk'
14
+
15
+ instance = Zernio::WhatsAppLimitedTimeOfferComponentLimitedTimeOffer.new(
16
+ text: null,
17
+ has_expiration: null
18
+ )
19
+ ```
20
+
@@ -16,8 +16,10 @@ Zernio::WhatsAppTemplateComponent.openapi_one_of
16
16
  # [
17
17
  # :'WhatsAppBodyComponent',
18
18
  # :'WhatsAppButtonsComponent',
19
+ # :'WhatsAppCarouselComponent',
19
20
  # :'WhatsAppFooterComponent',
20
- # :'WhatsAppHeaderComponent'
21
+ # :'WhatsAppHeaderComponent',
22
+ # :'WhatsAppLimitedTimeOfferComponent'
21
23
  # ]
22
24
  ```
23
25
 
@@ -48,8 +50,10 @@ Zernio::WhatsAppTemplateComponent.openapi_discriminator_mapping
48
50
  # {
49
51
  # :'body' => :'WhatsAppBodyComponent',
50
52
  # :'buttons' => :'WhatsAppButtonsComponent',
53
+ # :'carousel' => :'WhatsAppCarouselComponent',
51
54
  # :'footer' => :'WhatsAppFooterComponent',
52
- # :'header' => :'WhatsAppHeaderComponent'
55
+ # :'header' => :'WhatsAppHeaderComponent',
56
+ # :'limited_time_offer' => :'WhatsAppLimitedTimeOfferComponent'
53
57
  # }
54
58
  ```
55
59
 
@@ -79,7 +83,9 @@ Zernio::WhatsAppTemplateComponent.build(data_that_doesnt_match)
79
83
 
80
84
  - `WhatsAppBodyComponent`
81
85
  - `WhatsAppButtonsComponent`
86
+ - `WhatsAppCarouselComponent`
82
87
  - `WhatsAppFooterComponent`
83
88
  - `WhatsAppHeaderComponent`
89
+ - `WhatsAppLimitedTimeOfferComponent`
84
90
  - `nil` (if no type matches)
85
91
 
@@ -27,7 +27,7 @@ module Zernio
27
27
  # Template language code (e.g., en_US)
28
28
  attr_accessor :language
29
29
 
30
- # Template components (header, body, footer, buttons). Required for custom templates, omit when using library_template_name.
30
+ # Template components (header, body, footer, buttons, carousel, limited_time_offer). Required for custom templates, omit when using library_template_name.
31
31
  attr_accessor :components
32
32
 
33
33
  # Name of a pre-built template from Meta's template library (e.g., \"appointment_reminder\", \"auto_pay_reminder_1\", \"address_update\"). When provided, the template is pre-approved by Meta with no review wait. Omit components when using this field.
@@ -30,6 +30,9 @@ module Zernio
30
30
  # 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).
31
31
  attr_accessor :wants_sms
32
32
 
33
+ # 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.
34
+ attr_accessor :wants_whatsapp
35
+
33
36
  # 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.
34
37
  attr_accessor :purchase_intent_id
35
38
 
@@ -66,6 +69,7 @@ module Zernio
66
69
  :'number_type' => :'numberType',
67
70
  :'connect_whatsapp' => :'connectWhatsapp',
68
71
  :'wants_sms' => :'wantsSms',
72
+ :'wants_whatsapp' => :'wantsWhatsapp',
69
73
  :'purchase_intent_id' => :'purchaseIntentId',
70
74
  :'allow_multiple' => :'allowMultiple'
71
75
  }
@@ -89,6 +93,7 @@ module Zernio
89
93
  :'number_type' => :'String',
90
94
  :'connect_whatsapp' => :'Boolean',
91
95
  :'wants_sms' => :'Boolean',
96
+ :'wants_whatsapp' => :'Boolean',
92
97
  :'purchase_intent_id' => :'String',
93
98
  :'allow_multiple' => :'Boolean'
94
99
  }
@@ -144,6 +149,12 @@ module Zernio
144
149
  self.wants_sms = false
145
150
  end
146
151
 
152
+ if attributes.key?(:'wants_whatsapp')
153
+ self.wants_whatsapp = attributes[:'wants_whatsapp']
154
+ else
155
+ self.wants_whatsapp = false
156
+ end
157
+
147
158
  if attributes.key?(:'purchase_intent_id')
148
159
  self.purchase_intent_id = attributes[:'purchase_intent_id']
149
160
  end
@@ -226,6 +237,7 @@ module Zernio
226
237
  number_type == o.number_type &&
227
238
  connect_whatsapp == o.connect_whatsapp &&
228
239
  wants_sms == o.wants_sms &&
240
+ wants_whatsapp == o.wants_whatsapp &&
229
241
  purchase_intent_id == o.purchase_intent_id &&
230
242
  allow_multiple == o.allow_multiple
231
243
  end
@@ -239,7 +251,7 @@ module Zernio
239
251
  # Calculates hash code according to all attributes.
240
252
  # @return [Integer] Hash code
241
253
  def hash
242
- [profile_id, country, number_type, connect_whatsapp, wants_sms, purchase_intent_id, allow_multiple].hash
254
+ [profile_id, country, number_type, connect_whatsapp, wants_sms, wants_whatsapp, purchase_intent_id, allow_multiple].hash
243
255
  end
244
256
 
245
257
  # Builds the object from hash
@@ -0,0 +1,57 @@
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 WhatsAppCarouselCardComponent
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'WhatsAppBodyComponent',
23
+ :'WhatsAppButtonsComponent',
24
+ :'WhatsAppHeaderComponent'
25
+ ]
26
+ end
27
+
28
+ # Discriminator's property name (OpenAPI v3)
29
+ def openapi_discriminator_name
30
+ :'type'
31
+ end
32
+
33
+ # Discriminator's mapping (OpenAPI v3)
34
+ def openapi_discriminator_mapping
35
+ {
36
+ :'body' => :'WhatsAppBodyComponent',
37
+ :'buttons' => :'WhatsAppButtonsComponent',
38
+ :'header' => :'WhatsAppHeaderComponent'
39
+ }
40
+ end
41
+
42
+ # Builds the object
43
+ # @param [Mixed] Data to be matched against the list of oneOf items
44
+ # @return [Object] Returns the model or the data itself
45
+ def build(data)
46
+ discriminator_value = data[openapi_discriminator_name]
47
+ return nil if discriminator_value.nil?
48
+
49
+ klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
50
+ return nil unless klass
51
+
52
+ Zernio.const_get(klass).build_from_hash(data)
53
+ end
54
+ end
55
+ end
56
+
57
+ end
@@ -0,0 +1,235 @@
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
+ class WhatsAppCarouselComponent < ApiModelBase
18
+ attr_accessor :type
19
+
20
+ # 2-10 cards. Meta requires all cards to share the same component structure; a mismatch surfaces as a rejected_reason. MARKETING category only.
21
+ attr_accessor :cards
22
+
23
+ class EnumAttributeValidator
24
+ attr_reader :datatype
25
+ attr_reader :allowable_values
26
+
27
+ def initialize(datatype, allowable_values)
28
+ @allowable_values = allowable_values.map do |value|
29
+ case datatype.to_s
30
+ when /Integer/i
31
+ value.to_i
32
+ when /Float/i
33
+ value.to_f
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+
40
+ def valid?(value)
41
+ !value || allowable_values.include?(value)
42
+ end
43
+ end
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'type' => :'type',
49
+ :'cards' => :'cards'
50
+ }
51
+ end
52
+
53
+ # Returns attribute mapping this model knows about
54
+ def self.acceptable_attribute_map
55
+ attribute_map
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ acceptable_attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'type' => :'String',
67
+ :'cards' => :'Array<WhatsAppCarouselComponentCardsInner>'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::WhatsAppCarouselComponent` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ acceptable_attribute_map = self.class.acceptable_attribute_map
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!acceptable_attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::WhatsAppCarouselComponent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'type')
94
+ self.type = attributes[:'type']
95
+ else
96
+ self.type = nil
97
+ end
98
+
99
+ if attributes.key?(:'cards')
100
+ if (value = attributes[:'cards']).is_a?(Array)
101
+ self.cards = value
102
+ end
103
+ else
104
+ self.cards = nil
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
112
+ invalid_properties = Array.new
113
+ if @type.nil?
114
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
115
+ end
116
+
117
+ if @cards.nil?
118
+ invalid_properties.push('invalid value for "cards", cards cannot be nil.')
119
+ end
120
+
121
+ if @cards.length > 10
122
+ invalid_properties.push('invalid value for "cards", number of items must be less than or equal to 10.')
123
+ end
124
+
125
+ if @cards.length < 2
126
+ invalid_properties.push('invalid value for "cards", number of items must be greater than or equal to 2.')
127
+ end
128
+
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ warn '[DEPRECATED] the `valid?` method is obsolete'
136
+ return false if @type.nil?
137
+ type_validator = EnumAttributeValidator.new('String', ["carousel"])
138
+ return false unless type_validator.valid?(@type)
139
+ return false if @cards.nil?
140
+ return false if @cards.length > 10
141
+ return false if @cards.length < 2
142
+ true
143
+ end
144
+
145
+ # Custom attribute writer method checking allowed values (enum).
146
+ # @param [Object] type Object to be assigned
147
+ def type=(type)
148
+ validator = EnumAttributeValidator.new('String', ["carousel"])
149
+ unless validator.valid?(type)
150
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
151
+ end
152
+ @type = type
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] cards Value to be assigned
157
+ def cards=(cards)
158
+ if cards.nil?
159
+ fail ArgumentError, 'cards cannot be nil'
160
+ end
161
+
162
+ if cards.length > 10
163
+ fail ArgumentError, 'invalid value for "cards", number of items must be less than or equal to 10.'
164
+ end
165
+
166
+ if cards.length < 2
167
+ fail ArgumentError, 'invalid value for "cards", number of items must be greater than or equal to 2.'
168
+ end
169
+
170
+ @cards = cards
171
+ end
172
+
173
+ # Checks equality by comparing each attribute.
174
+ # @param [Object] Object to be compared
175
+ def ==(o)
176
+ return true if self.equal?(o)
177
+ self.class == o.class &&
178
+ type == o.type &&
179
+ cards == o.cards
180
+ end
181
+
182
+ # @see the `==` method
183
+ # @param [Object] Object to be compared
184
+ def eql?(o)
185
+ self == o
186
+ end
187
+
188
+ # Calculates hash code according to all attributes.
189
+ # @return [Integer] Hash code
190
+ def hash
191
+ [type, cards].hash
192
+ end
193
+
194
+ # Builds the object from hash
195
+ # @param [Hash] attributes Model attributes in the form of hash
196
+ # @return [Object] Returns the model itself
197
+ def self.build_from_hash(attributes)
198
+ return nil unless attributes.is_a?(Hash)
199
+ attributes = attributes.transform_keys(&:to_sym)
200
+ transformed_hash = {}
201
+ openapi_types.each_pair do |key, type|
202
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
203
+ transformed_hash["#{key}"] = nil
204
+ elsif type =~ /\AArray<(.*)>/i
205
+ # check to ensure the input is an array given that the attribute
206
+ # is documented as an array but the input is not
207
+ if attributes[attribute_map[key]].is_a?(Array)
208
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
209
+ end
210
+ elsif !attributes[attribute_map[key]].nil?
211
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
212
+ end
213
+ end
214
+ new(transformed_hash)
215
+ end
216
+
217
+ # Returns the object in the form of hash
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ if value.nil?
224
+ is_nullable = self.class.openapi_nullable.include?(attr)
225
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
226
+ end
227
+
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ end
234
+
235
+ end