late-sdk 0.0.94 → 0.0.95
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/CreateWhatsAppTemplateRequest.md +1 -1
- data/docs/WhatsAppApi.md +1 -1
- data/docs/WhatsAppHeaderComponentExample.md +1 -1
- data/docs/WhatsAppTemplateButton.md +2 -2
- data/docs/WhatsAppTemplateComponent.md +32 -0
- data/lib/late-sdk/models/create_whats_app_template_request.rb +1 -1
- data/lib/late-sdk/models/create_whats_app_template_request_library_template_button_inputs_inner.rb +2 -2
- data/lib/late-sdk/models/whats_app_body_component.rb +2 -2
- data/lib/late-sdk/models/whats_app_buttons_component.rb +2 -2
- data/lib/late-sdk/models/whats_app_footer_component.rb +2 -2
- data/lib/late-sdk/models/whats_app_header_component.rb +4 -4
- data/lib/late-sdk/models/whats_app_header_component_example.rb +1 -1
- data/lib/late-sdk/models/whats_app_template_button.rb +6 -6
- data/lib/late-sdk/models/whats_app_template_component.rb +20 -67
- data/lib/late-sdk/version.rb +1 -1
- data/openapi.yaml +29 -22
- data/spec/models/create_whats_app_template_request_library_template_button_inputs_inner_spec.rb +1 -1
- data/spec/models/whats_app_body_component_spec.rb +1 -1
- data/spec/models/whats_app_buttons_component_spec.rb +1 -1
- data/spec/models/whats_app_footer_component_spec.rb +1 -1
- data/spec/models/whats_app_header_component_spec.rb +2 -2
- data/spec/models/whats_app_template_button_spec.rb +2 -2
- data/spec/models/whats_app_template_component_spec.rb +12 -0
- data/zernio-sdk-0.0.95.gem +0 -0
- metadata +2 -2
- data/zernio-sdk-0.0.94.gem +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 905d4e1c58f5b2710ba9bc81c0531fb385b9b0d423f469bd797ecf6fa0f3e219
|
|
4
|
+
data.tar.gz: 7f0677bf41376693b4732af908519a922b9c335e84bf32d5061eb9f6c3226a33
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1748471bd7113bac81109dd192d3bae70e98d795fb6abd5ca4b20e997f631dd6caabd5933f60cbaf470a93c8ed348babc257b9191cf35dcca72457b09e974f61
|
|
7
|
+
data.tar.gz: 0cc0cd4330849c056ffddf56f8f8ad0f604c161441dadd3a4c0e27e5b00a0c501f2fd4c93a0297b26dfcf5d5039e44f3bbe24448740dbc70366260a66a4b3589
|
|
@@ -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 (
|
|
11
|
+
| **components** | [**Array<WhatsAppTemplateComponent>**](WhatsAppTemplateComponent.md) | Template components (header, body, footer, buttons). 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] |
|
data/docs/WhatsAppApi.md
CHANGED
|
@@ -2975,7 +2975,7 @@ end
|
|
|
2975
2975
|
|
|
2976
2976
|
api_instance = Late::WhatsAppApi.new
|
|
2977
2977
|
template_name = 'template_name_example' # String | Template name
|
|
2978
|
-
update_whats_app_template_request = Late::UpdateWhatsAppTemplateRequest.new({account_id: 'account_id_example', components: [Late::WhatsAppBodyComponent.new({type: '
|
|
2978
|
+
update_whats_app_template_request = Late::UpdateWhatsAppTemplateRequest.new({account_id: 'account_id_example', components: [Late::WhatsAppBodyComponent.new({type: 'body', text: 'text_example'})]}) # UpdateWhatsAppTemplateRequest |
|
|
2979
2979
|
|
|
2980
2980
|
begin
|
|
2981
2981
|
# Update template
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
7
|
| **header_text** | **Array<String>** | Sample values for header text variables | [optional] |
|
|
8
|
-
| **header_handle** | **Array<String>** | When the header format is a media type (
|
|
8
|
+
| **header_handle** | **Array<String>** | When the header format is a media type (image, video, gif, document), provide a public URL here. Zernio will download and upload it to WhatsApp on your behalf, replacing it with the internal file handle before creating the template. | [optional] |
|
|
9
9
|
|
|
10
10
|
## Example
|
|
11
11
|
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
| **text** | **String** | | |
|
|
9
9
|
| **url** | **String** | Required when type is URL | [optional] |
|
|
10
10
|
| **example** | **Array<String>** | Example values for URL suffix variables | [optional] |
|
|
11
|
-
| **phone_number** | **String** | Required when type is
|
|
12
|
-
| **otp_type** | **String** | Required when type is
|
|
11
|
+
| **phone_number** | **String** | Required when type is phone_number | [optional] |
|
|
12
|
+
| **otp_type** | **String** | Required when type is otp | [optional] |
|
|
13
13
|
| **autofill_text** | **String** | | [optional] |
|
|
14
14
|
| **package_name** | **String** | | [optional] |
|
|
15
15
|
| **signature_hash** | **String** | | [optional] |
|
|
@@ -21,6 +21,38 @@ Late::WhatsAppTemplateComponent.openapi_one_of
|
|
|
21
21
|
# ]
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
### `openapi_discriminator_name`
|
|
25
|
+
|
|
26
|
+
Returns the discriminator's property name.
|
|
27
|
+
|
|
28
|
+
#### Example
|
|
29
|
+
|
|
30
|
+
```ruby
|
|
31
|
+
require 'late-sdk'
|
|
32
|
+
|
|
33
|
+
Late::WhatsAppTemplateComponent.openapi_discriminator_name
|
|
34
|
+
# => :'type'
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### `openapi_discriminator_name`
|
|
38
|
+
|
|
39
|
+
Returns the discriminator's mapping.
|
|
40
|
+
|
|
41
|
+
#### Example
|
|
42
|
+
|
|
43
|
+
```ruby
|
|
44
|
+
require 'late-sdk'
|
|
45
|
+
|
|
46
|
+
Late::WhatsAppTemplateComponent.openapi_discriminator_mapping
|
|
47
|
+
# =>
|
|
48
|
+
# {
|
|
49
|
+
# :'body' => :'WhatsAppBodyComponent',
|
|
50
|
+
# :'buttons' => :'WhatsAppButtonsComponent',
|
|
51
|
+
# :'footer' => :'WhatsAppFooterComponent',
|
|
52
|
+
# :'header' => :'WhatsAppHeaderComponent'
|
|
53
|
+
# }
|
|
54
|
+
```
|
|
55
|
+
|
|
24
56
|
### build
|
|
25
57
|
|
|
26
58
|
Find the appropriate object from the `openapi_one_of` list and casts the data into it.
|
|
@@ -27,7 +27,7 @@ module Late
|
|
|
27
27
|
# Template language code (e.g., en_US)
|
|
28
28
|
attr_accessor :language
|
|
29
29
|
|
|
30
|
-
# Template components (
|
|
30
|
+
# Template components (header, body, footer, buttons). 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.
|
data/lib/late-sdk/models/create_whats_app_template_request_library_template_button_inputs_inner.rb
CHANGED
|
@@ -118,7 +118,7 @@ module Late
|
|
|
118
118
|
# @return true if the model is valid
|
|
119
119
|
def valid?
|
|
120
120
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
121
|
-
type_validator = EnumAttributeValidator.new('String', ["
|
|
121
|
+
type_validator = EnumAttributeValidator.new('String', ["quick_reply", "url", "phone_number"])
|
|
122
122
|
return false unless type_validator.valid?(@type)
|
|
123
123
|
true
|
|
124
124
|
end
|
|
@@ -126,7 +126,7 @@ module Late
|
|
|
126
126
|
# Custom attribute writer method checking allowed values (enum).
|
|
127
127
|
# @param [Object] type Object to be assigned
|
|
128
128
|
def type=(type)
|
|
129
|
-
validator = EnumAttributeValidator.new('String', ["
|
|
129
|
+
validator = EnumAttributeValidator.new('String', ["quick_reply", "url", "phone_number"])
|
|
130
130
|
unless validator.valid?(type)
|
|
131
131
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
132
132
|
end
|
|
@@ -141,7 +141,7 @@ module Late
|
|
|
141
141
|
def valid?
|
|
142
142
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
143
143
|
return false if @type.nil?
|
|
144
|
-
type_validator = EnumAttributeValidator.new('String', ["
|
|
144
|
+
type_validator = EnumAttributeValidator.new('String', ["body"])
|
|
145
145
|
return false unless type_validator.valid?(@type)
|
|
146
146
|
return false if @text.nil?
|
|
147
147
|
true
|
|
@@ -150,7 +150,7 @@ module Late
|
|
|
150
150
|
# Custom attribute writer method checking allowed values (enum).
|
|
151
151
|
# @param [Object] type Object to be assigned
|
|
152
152
|
def type=(type)
|
|
153
|
-
validator = EnumAttributeValidator.new('String', ["
|
|
153
|
+
validator = EnumAttributeValidator.new('String', ["body"])
|
|
154
154
|
unless validator.valid?(type)
|
|
155
155
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
156
156
|
end
|
|
@@ -129,7 +129,7 @@ module Late
|
|
|
129
129
|
def valid?
|
|
130
130
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
131
131
|
return false if @type.nil?
|
|
132
|
-
type_validator = EnumAttributeValidator.new('String', ["
|
|
132
|
+
type_validator = EnumAttributeValidator.new('String', ["buttons"])
|
|
133
133
|
return false unless type_validator.valid?(@type)
|
|
134
134
|
return false if @buttons.nil?
|
|
135
135
|
return false if @buttons.length < 1
|
|
@@ -139,7 +139,7 @@ module Late
|
|
|
139
139
|
# Custom attribute writer method checking allowed values (enum).
|
|
140
140
|
# @param [Object] type Object to be assigned
|
|
141
141
|
def type=(type)
|
|
142
|
-
validator = EnumAttributeValidator.new('String', ["
|
|
142
|
+
validator = EnumAttributeValidator.new('String', ["buttons"])
|
|
143
143
|
unless validator.valid?(type)
|
|
144
144
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
145
145
|
end
|
|
@@ -131,7 +131,7 @@ module Late
|
|
|
131
131
|
def valid?
|
|
132
132
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
133
133
|
return false if @type.nil?
|
|
134
|
-
type_validator = EnumAttributeValidator.new('String', ["
|
|
134
|
+
type_validator = EnumAttributeValidator.new('String', ["footer"])
|
|
135
135
|
return false unless type_validator.valid?(@type)
|
|
136
136
|
return false if !@code_expiration_minutes.nil? && @code_expiration_minutes < 1
|
|
137
137
|
true
|
|
@@ -140,7 +140,7 @@ module Late
|
|
|
140
140
|
# Custom attribute writer method checking allowed values (enum).
|
|
141
141
|
# @param [Object] type Object to be assigned
|
|
142
142
|
def type=(type)
|
|
143
|
-
validator = EnumAttributeValidator.new('String', ["
|
|
143
|
+
validator = EnumAttributeValidator.new('String', ["footer"])
|
|
144
144
|
unless validator.valid?(type)
|
|
145
145
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
146
146
|
end
|
|
@@ -140,10 +140,10 @@ module Late
|
|
|
140
140
|
def valid?
|
|
141
141
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
142
142
|
return false if @type.nil?
|
|
143
|
-
type_validator = EnumAttributeValidator.new('String', ["
|
|
143
|
+
type_validator = EnumAttributeValidator.new('String', ["header"])
|
|
144
144
|
return false unless type_validator.valid?(@type)
|
|
145
145
|
return false if @format.nil?
|
|
146
|
-
format_validator = EnumAttributeValidator.new('String', ["
|
|
146
|
+
format_validator = EnumAttributeValidator.new('String', ["text", "image", "video", "gif", "document", "location"])
|
|
147
147
|
return false unless format_validator.valid?(@format)
|
|
148
148
|
true
|
|
149
149
|
end
|
|
@@ -151,7 +151,7 @@ module Late
|
|
|
151
151
|
# Custom attribute writer method checking allowed values (enum).
|
|
152
152
|
# @param [Object] type Object to be assigned
|
|
153
153
|
def type=(type)
|
|
154
|
-
validator = EnumAttributeValidator.new('String', ["
|
|
154
|
+
validator = EnumAttributeValidator.new('String', ["header"])
|
|
155
155
|
unless validator.valid?(type)
|
|
156
156
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
157
157
|
end
|
|
@@ -161,7 +161,7 @@ module Late
|
|
|
161
161
|
# Custom attribute writer method checking allowed values (enum).
|
|
162
162
|
# @param [Object] format Object to be assigned
|
|
163
163
|
def format=(format)
|
|
164
|
-
validator = EnumAttributeValidator.new('String', ["
|
|
164
|
+
validator = EnumAttributeValidator.new('String', ["text", "image", "video", "gif", "document", "location"])
|
|
165
165
|
unless validator.valid?(format)
|
|
166
166
|
fail ArgumentError, "invalid value for \"format\", must be one of #{validator.allowable_values}."
|
|
167
167
|
end
|
|
@@ -18,7 +18,7 @@ module Late
|
|
|
18
18
|
# Sample values for header text variables
|
|
19
19
|
attr_accessor :header_text
|
|
20
20
|
|
|
21
|
-
# When the header format is a media type (
|
|
21
|
+
# When the header format is a media type (image, video, gif, document), provide a public URL here. Zernio will download and upload it to WhatsApp on your behalf, replacing it with the internal file handle before creating the template.
|
|
22
22
|
attr_accessor :header_handle
|
|
23
23
|
|
|
24
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -25,10 +25,10 @@ module Late
|
|
|
25
25
|
# Example values for URL suffix variables
|
|
26
26
|
attr_accessor :example
|
|
27
27
|
|
|
28
|
-
# Required when type is
|
|
28
|
+
# Required when type is phone_number
|
|
29
29
|
attr_accessor :phone_number
|
|
30
30
|
|
|
31
|
-
# Required when type is
|
|
31
|
+
# Required when type is otp
|
|
32
32
|
attr_accessor :otp_type
|
|
33
33
|
|
|
34
34
|
attr_accessor :autofill_text
|
|
@@ -225,10 +225,10 @@ module Late
|
|
|
225
225
|
def valid?
|
|
226
226
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
227
227
|
return false if @type.nil?
|
|
228
|
-
type_validator = EnumAttributeValidator.new('String', ["
|
|
228
|
+
type_validator = EnumAttributeValidator.new('String', ["quick_reply", "url", "phone_number", "otp", "flow", "mpm", "catalog"])
|
|
229
229
|
return false unless type_validator.valid?(@type)
|
|
230
230
|
return false if @text.nil?
|
|
231
|
-
otp_type_validator = EnumAttributeValidator.new('String', ["
|
|
231
|
+
otp_type_validator = EnumAttributeValidator.new('String', ["copy_code", "one_tap", "zero_tap"])
|
|
232
232
|
return false unless otp_type_validator.valid?(@otp_type)
|
|
233
233
|
true
|
|
234
234
|
end
|
|
@@ -236,7 +236,7 @@ module Late
|
|
|
236
236
|
# Custom attribute writer method checking allowed values (enum).
|
|
237
237
|
# @param [Object] type Object to be assigned
|
|
238
238
|
def type=(type)
|
|
239
|
-
validator = EnumAttributeValidator.new('String', ["
|
|
239
|
+
validator = EnumAttributeValidator.new('String', ["quick_reply", "url", "phone_number", "otp", "flow", "mpm", "catalog"])
|
|
240
240
|
unless validator.valid?(type)
|
|
241
241
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
242
242
|
end
|
|
@@ -256,7 +256,7 @@ module Late
|
|
|
256
256
|
# Custom attribute writer method checking allowed values (enum).
|
|
257
257
|
# @param [Object] otp_type Object to be assigned
|
|
258
258
|
def otp_type=(otp_type)
|
|
259
|
-
validator = EnumAttributeValidator.new('String', ["
|
|
259
|
+
validator = EnumAttributeValidator.new('String', ["copy_code", "one_tap", "zero_tap"])
|
|
260
260
|
unless validator.valid?(otp_type)
|
|
261
261
|
fail ArgumentError, "invalid value for \"otp_type\", must be one of #{validator.allowable_values}."
|
|
262
262
|
end
|
|
@@ -26,79 +26,32 @@ module Late
|
|
|
26
26
|
]
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
+
# Discriminator's property name (OpenAPI v3)
|
|
30
|
+
def openapi_discriminator_name
|
|
31
|
+
:'type'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Discriminator's mapping (OpenAPI v3)
|
|
35
|
+
def openapi_discriminator_mapping
|
|
36
|
+
{
|
|
37
|
+
:'body' => :'WhatsAppBodyComponent',
|
|
38
|
+
:'buttons' => :'WhatsAppButtonsComponent',
|
|
39
|
+
:'footer' => :'WhatsAppFooterComponent',
|
|
40
|
+
:'header' => :'WhatsAppHeaderComponent'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
29
44
|
# Builds the object
|
|
30
45
|
# @param [Mixed] Data to be matched against the list of oneOf items
|
|
31
46
|
# @return [Object] Returns the model or the data itself
|
|
32
47
|
def build(data)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
# - We do not attempt to check whether exactly one item matches.
|
|
36
|
-
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
37
|
-
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
38
|
-
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
39
|
-
# - TODO: logging when debugging is set.
|
|
40
|
-
openapi_one_of.each do |klass|
|
|
41
|
-
begin
|
|
42
|
-
next if klass == :AnyType # "nullable: true"
|
|
43
|
-
return find_and_cast_into_type(klass, data)
|
|
44
|
-
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
openapi_one_of.include?(:AnyType) ? data : nil
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
private
|
|
52
|
-
|
|
53
|
-
SchemaMismatchError = Class.new(StandardError)
|
|
54
|
-
|
|
55
|
-
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
56
|
-
def find_and_cast_into_type(klass, data)
|
|
57
|
-
return if data.nil?
|
|
48
|
+
discriminator_value = data[openapi_discriminator_name]
|
|
49
|
+
return nil if discriminator_value.nil?
|
|
58
50
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
62
|
-
when 'Float'
|
|
63
|
-
return data if data.instance_of?(Float)
|
|
64
|
-
when 'Integer'
|
|
65
|
-
return data if data.instance_of?(Integer)
|
|
66
|
-
when 'Time'
|
|
67
|
-
return Time.parse(data)
|
|
68
|
-
when 'Date'
|
|
69
|
-
return Date.iso8601(data)
|
|
70
|
-
when 'String'
|
|
71
|
-
return data if data.instance_of?(String)
|
|
72
|
-
when 'Object' # "type: object"
|
|
73
|
-
return data if data.instance_of?(Hash)
|
|
74
|
-
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
75
|
-
if data.instance_of?(Array)
|
|
76
|
-
sub_type = Regexp.last_match[:sub_type]
|
|
77
|
-
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
78
|
-
end
|
|
79
|
-
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
80
|
-
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
81
|
-
sub_type = Regexp.last_match[:sub_type]
|
|
82
|
-
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
83
|
-
end
|
|
84
|
-
else # model
|
|
85
|
-
const = Late.const_get(klass)
|
|
86
|
-
if const
|
|
87
|
-
if const.respond_to?(:openapi_one_of) # nested oneOf model
|
|
88
|
-
model = const.build(data)
|
|
89
|
-
return model if model
|
|
90
|
-
else
|
|
91
|
-
# raise if data contains keys that are not known to the model
|
|
92
|
-
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
93
|
-
model = const.build_from_hash(data)
|
|
94
|
-
return model if model
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
end
|
|
51
|
+
klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
|
|
52
|
+
return nil unless klass
|
|
98
53
|
|
|
99
|
-
|
|
100
|
-
rescue
|
|
101
|
-
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
54
|
+
Late.const_get(klass).build_from_hash(data)
|
|
102
55
|
end
|
|
103
56
|
end
|
|
104
57
|
end
|
data/lib/late-sdk/version.rb
CHANGED
data/openapi.yaml
CHANGED
|
@@ -315,7 +315,7 @@ components:
|
|
|
315
315
|
properties:
|
|
316
316
|
type:
|
|
317
317
|
type: string
|
|
318
|
-
enum: [
|
|
318
|
+
enum: [quick_reply, url, phone_number, otp, flow, mpm, catalog]
|
|
319
319
|
text:
|
|
320
320
|
type: string
|
|
321
321
|
url:
|
|
@@ -328,11 +328,11 @@ components:
|
|
|
328
328
|
description: Example values for URL suffix variables
|
|
329
329
|
phone_number:
|
|
330
330
|
type: string
|
|
331
|
-
description: Required when type is
|
|
331
|
+
description: Required when type is phone_number
|
|
332
332
|
otp_type:
|
|
333
333
|
type: string
|
|
334
|
-
enum: [
|
|
335
|
-
description: Required when type is
|
|
334
|
+
enum: [copy_code, one_tap, zero_tap]
|
|
335
|
+
description: Required when type is otp
|
|
336
336
|
autofill_text:
|
|
337
337
|
type: string
|
|
338
338
|
package_name:
|
|
@@ -355,16 +355,23 @@ components:
|
|
|
355
355
|
- $ref: '#/components/schemas/WhatsAppBodyComponent'
|
|
356
356
|
- $ref: '#/components/schemas/WhatsAppFooterComponent'
|
|
357
357
|
- $ref: '#/components/schemas/WhatsAppButtonsComponent'
|
|
358
|
+
discriminator:
|
|
359
|
+
propertyName: type
|
|
360
|
+
mapping:
|
|
361
|
+
header: '#/components/schemas/WhatsAppHeaderComponent'
|
|
362
|
+
body: '#/components/schemas/WhatsAppBodyComponent'
|
|
363
|
+
footer: '#/components/schemas/WhatsAppFooterComponent'
|
|
364
|
+
buttons: '#/components/schemas/WhatsAppButtonsComponent'
|
|
358
365
|
WhatsAppHeaderComponent:
|
|
359
366
|
type: object
|
|
360
367
|
required: [type, format]
|
|
361
368
|
properties:
|
|
362
369
|
type:
|
|
363
370
|
type: string
|
|
364
|
-
enum: [
|
|
371
|
+
enum: [header]
|
|
365
372
|
format:
|
|
366
373
|
type: string
|
|
367
|
-
enum: [
|
|
374
|
+
enum: [text, image, video, gif, document, location]
|
|
368
375
|
text:
|
|
369
376
|
type: string
|
|
370
377
|
description: Header text (may include {{1}} variable). Used when format is TEXT.
|
|
@@ -382,14 +389,14 @@ components:
|
|
|
382
389
|
items:
|
|
383
390
|
type: string
|
|
384
391
|
format: uri
|
|
385
|
-
description: When the header format is a media type (
|
|
392
|
+
description: When the header format is a media type (image, video, gif, document), provide a public URL here. Zernio will download and upload it to WhatsApp on your behalf, replacing it with the internal file handle before creating the template.
|
|
386
393
|
WhatsAppBodyComponent:
|
|
387
394
|
type: object
|
|
388
395
|
required: [type, text]
|
|
389
396
|
properties:
|
|
390
397
|
type:
|
|
391
398
|
type: string
|
|
392
|
-
enum: [
|
|
399
|
+
enum: [body]
|
|
393
400
|
text:
|
|
394
401
|
type: string
|
|
395
402
|
description: Body text with optional {{n}} variables
|
|
@@ -411,7 +418,7 @@ components:
|
|
|
411
418
|
properties:
|
|
412
419
|
type:
|
|
413
420
|
type: string
|
|
414
|
-
enum: [
|
|
421
|
+
enum: [footer]
|
|
415
422
|
text:
|
|
416
423
|
type: string
|
|
417
424
|
description: Static footer text
|
|
@@ -425,7 +432,7 @@ components:
|
|
|
425
432
|
properties:
|
|
426
433
|
type:
|
|
427
434
|
type: string
|
|
428
|
-
enum: [
|
|
435
|
+
enum: [buttons]
|
|
429
436
|
buttons:
|
|
430
437
|
type: array
|
|
431
438
|
minItems: 1
|
|
@@ -14154,7 +14161,7 @@ paths:
|
|
|
14154
14161
|
description: Template language code (e.g., en_US)
|
|
14155
14162
|
components:
|
|
14156
14163
|
type: array
|
|
14157
|
-
description: "Template components (
|
|
14164
|
+
description: "Template components (header, body, footer, buttons). Required for custom templates, omit when using library_template_name."
|
|
14158
14165
|
minItems: 1
|
|
14159
14166
|
items:
|
|
14160
14167
|
$ref: '#/components/schemas/WhatsAppTemplateComponent'
|
|
@@ -14180,7 +14187,7 @@ paths:
|
|
|
14180
14187
|
properties:
|
|
14181
14188
|
type:
|
|
14182
14189
|
type: string
|
|
14183
|
-
enum: [
|
|
14190
|
+
enum: [quick_reply, url, phone_number]
|
|
14184
14191
|
url:
|
|
14185
14192
|
type: object
|
|
14186
14193
|
properties:
|
|
@@ -14196,19 +14203,19 @@ paths:
|
|
|
14196
14203
|
category: "UTILITY"
|
|
14197
14204
|
language: "en_US"
|
|
14198
14205
|
components:
|
|
14199
|
-
- type: "
|
|
14200
|
-
format: "
|
|
14206
|
+
- type: "header"
|
|
14207
|
+
format: "image"
|
|
14201
14208
|
example:
|
|
14202
14209
|
header_handle: ["https://example.com/header.jpg"]
|
|
14203
|
-
- type: "
|
|
14210
|
+
- type: "body"
|
|
14204
14211
|
text: "Your order {{1}} has been confirmed. Expected delivery: {{2}}"
|
|
14205
14212
|
example:
|
|
14206
14213
|
body_text: [["ORD-12345", "March 31"]]
|
|
14207
|
-
- type: "
|
|
14214
|
+
- type: "footer"
|
|
14208
14215
|
text: "Thank you for your purchase"
|
|
14209
|
-
- type: "
|
|
14216
|
+
- type: "buttons"
|
|
14210
14217
|
buttons:
|
|
14211
|
-
- type: "
|
|
14218
|
+
- type: "quick_reply"
|
|
14212
14219
|
text: "Track Order"
|
|
14213
14220
|
library:
|
|
14214
14221
|
summary: Library template (pre-approved, no review)
|
|
@@ -14219,7 +14226,7 @@ paths:
|
|
|
14219
14226
|
language: "en_US"
|
|
14220
14227
|
library_template_name: "appointment_reminder"
|
|
14221
14228
|
library_template_button_inputs:
|
|
14222
|
-
- type: "
|
|
14229
|
+
- type: "url"
|
|
14223
14230
|
url:
|
|
14224
14231
|
base_url: "https://myapp.com/appointments/{{1}}"
|
|
14225
14232
|
responses:
|
|
@@ -14327,13 +14334,13 @@ paths:
|
|
|
14327
14334
|
example:
|
|
14328
14335
|
accountId: "507f1f77bcf86cd799439011"
|
|
14329
14336
|
components:
|
|
14330
|
-
- type: "
|
|
14337
|
+
- type: "body"
|
|
14331
14338
|
text: "Updated: Your order {{1}} is confirmed. Delivery by {{2}}"
|
|
14332
14339
|
example:
|
|
14333
14340
|
body_text: [["ORD-12345", "April 1"]]
|
|
14334
|
-
- type: "
|
|
14341
|
+
- type: "buttons"
|
|
14335
14342
|
buttons:
|
|
14336
|
-
- type: "
|
|
14343
|
+
- type: "quick_reply"
|
|
14337
14344
|
text: "Track Order"
|
|
14338
14345
|
responses:
|
|
14339
14346
|
'200':
|
data/spec/models/create_whats_app_template_request_library_template_button_inputs_inner_spec.rb
CHANGED
|
@@ -30,7 +30,7 @@ describe Late::CreateWhatsAppTemplateRequestLibraryTemplateButtonInputsInner do
|
|
|
30
30
|
describe 'test attribute "type"' do
|
|
31
31
|
it 'should work' do
|
|
32
32
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
33
|
-
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["
|
|
33
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["quick_reply", "url", "phone_number"])
|
|
34
34
|
# validator.allowable_values.each do |value|
|
|
35
35
|
# expect { instance.type = value }.not_to raise_error
|
|
36
36
|
# end
|
|
@@ -30,7 +30,7 @@ describe Late::WhatsAppBodyComponent do
|
|
|
30
30
|
describe 'test attribute "type"' do
|
|
31
31
|
it 'should work' do
|
|
32
32
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
33
|
-
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["
|
|
33
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["body"])
|
|
34
34
|
# validator.allowable_values.each do |value|
|
|
35
35
|
# expect { instance.type = value }.not_to raise_error
|
|
36
36
|
# end
|
|
@@ -30,7 +30,7 @@ describe Late::WhatsAppButtonsComponent do
|
|
|
30
30
|
describe 'test attribute "type"' do
|
|
31
31
|
it 'should work' do
|
|
32
32
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
33
|
-
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["
|
|
33
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["buttons"])
|
|
34
34
|
# validator.allowable_values.each do |value|
|
|
35
35
|
# expect { instance.type = value }.not_to raise_error
|
|
36
36
|
# end
|
|
@@ -30,7 +30,7 @@ describe Late::WhatsAppFooterComponent do
|
|
|
30
30
|
describe 'test attribute "type"' do
|
|
31
31
|
it 'should work' do
|
|
32
32
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
33
|
-
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["
|
|
33
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["footer"])
|
|
34
34
|
# validator.allowable_values.each do |value|
|
|
35
35
|
# expect { instance.type = value }.not_to raise_error
|
|
36
36
|
# end
|
|
@@ -30,7 +30,7 @@ describe Late::WhatsAppHeaderComponent do
|
|
|
30
30
|
describe 'test attribute "type"' do
|
|
31
31
|
it 'should work' do
|
|
32
32
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
33
|
-
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["
|
|
33
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["header"])
|
|
34
34
|
# validator.allowable_values.each do |value|
|
|
35
35
|
# expect { instance.type = value }.not_to raise_error
|
|
36
36
|
# end
|
|
@@ -40,7 +40,7 @@ describe Late::WhatsAppHeaderComponent do
|
|
|
40
40
|
describe 'test attribute "format"' do
|
|
41
41
|
it 'should work' do
|
|
42
42
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
43
|
-
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["
|
|
43
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["text", "image", "video", "gif", "document", "location"])
|
|
44
44
|
# validator.allowable_values.each do |value|
|
|
45
45
|
# expect { instance.format = value }.not_to raise_error
|
|
46
46
|
# end
|
|
@@ -30,7 +30,7 @@ describe Late::WhatsAppTemplateButton do
|
|
|
30
30
|
describe 'test attribute "type"' do
|
|
31
31
|
it 'should work' do
|
|
32
32
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
33
|
-
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["
|
|
33
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["quick_reply", "url", "phone_number", "otp", "flow", "mpm", "catalog"])
|
|
34
34
|
# validator.allowable_values.each do |value|
|
|
35
35
|
# expect { instance.type = value }.not_to raise_error
|
|
36
36
|
# end
|
|
@@ -64,7 +64,7 @@ describe Late::WhatsAppTemplateButton do
|
|
|
64
64
|
describe 'test attribute "otp_type"' do
|
|
65
65
|
it 'should work' do
|
|
66
66
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
67
|
-
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["
|
|
67
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["copy_code", "one_tap", "zero_tap"])
|
|
68
68
|
# validator.allowable_values.each do |value|
|
|
69
69
|
# expect { instance.otp_type = value }.not_to raise_error
|
|
70
70
|
# end
|
|
@@ -24,6 +24,18 @@ describe Late::WhatsAppTemplateComponent do
|
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
describe '.openapi_discriminator_name' do
|
|
28
|
+
it 'returns the value of the "discriminator" property' do
|
|
29
|
+
expect(described_class.openapi_discriminator_name).to_not be_empty
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe '.openapi_discriminator_mapping' do
|
|
34
|
+
it 'returns the key/values of the "mapping" property' do
|
|
35
|
+
expect(described_class.openapi_discriminator_mapping.values.sort).to eq(described_class.openapi_one_of.sort)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
27
39
|
describe '.build' do
|
|
28
40
|
it 'returns the correct model' do
|
|
29
41
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: late-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.95
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenAPI-Generator
|
|
@@ -2247,7 +2247,7 @@ files:
|
|
|
2247
2247
|
- spec/models/you_tube_scope_missing_response_scope_status_spec.rb
|
|
2248
2248
|
- spec/models/you_tube_scope_missing_response_spec.rb
|
|
2249
2249
|
- spec/spec_helper.rb
|
|
2250
|
-
- zernio-sdk-0.0.
|
|
2250
|
+
- zernio-sdk-0.0.95.gem
|
|
2251
2251
|
homepage: https://openapi-generator.tech
|
|
2252
2252
|
licenses:
|
|
2253
2253
|
- Unlicense
|
data/zernio-sdk-0.0.94.gem
DELETED
|
Binary file
|