late-sdk 0.0.94 → 0.0.96

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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/docs/CreateWhatsAppTemplateRequest.md +1 -1
  3. data/docs/UpdatePostMetadataRequest.md +3 -1
  4. data/docs/WhatsAppApi.md +1 -1
  5. data/docs/WhatsAppHeaderComponentExample.md +1 -1
  6. data/docs/WhatsAppTemplateButton.md +2 -2
  7. data/docs/WhatsAppTemplateComponent.md +32 -0
  8. data/lib/late-sdk/models/create_whats_app_template_request.rb +1 -1
  9. data/lib/late-sdk/models/create_whats_app_template_request_library_template_button_inputs_inner.rb +2 -2
  10. data/lib/late-sdk/models/update_post_metadata_request.rb +14 -4
  11. data/lib/late-sdk/models/whats_app_body_component.rb +2 -2
  12. data/lib/late-sdk/models/whats_app_buttons_component.rb +2 -2
  13. data/lib/late-sdk/models/whats_app_footer_component.rb +2 -2
  14. data/lib/late-sdk/models/whats_app_header_component.rb +4 -4
  15. data/lib/late-sdk/models/whats_app_header_component_example.rb +1 -1
  16. data/lib/late-sdk/models/whats_app_template_button.rb +6 -6
  17. data/lib/late-sdk/models/whats_app_template_component.rb +20 -67
  18. data/lib/late-sdk/version.rb +1 -1
  19. data/openapi.yaml +40 -22
  20. data/spec/models/create_whats_app_template_request_library_template_button_inputs_inner_spec.rb +1 -1
  21. data/spec/models/update_post_metadata_request_spec.rb +6 -0
  22. data/spec/models/whats_app_body_component_spec.rb +1 -1
  23. data/spec/models/whats_app_buttons_component_spec.rb +1 -1
  24. data/spec/models/whats_app_footer_component_spec.rb +1 -1
  25. data/spec/models/whats_app_header_component_spec.rb +2 -2
  26. data/spec/models/whats_app_template_button_spec.rb +2 -2
  27. data/spec/models/whats_app_template_component_spec.rb +12 -0
  28. data/zernio-sdk-0.0.96.gem +0 -0
  29. metadata +3 -3
  30. data/zernio-sdk-0.0.94.gem +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df932c23e88e3e6675ca38fcaefff7052a4da59d3eb923526297e4d9a2c1e3a6
4
- data.tar.gz: 4a7c1e5fb67076512e24cc667f13cbbe49e13872c615b0cb76ba63079d7ab1f7
3
+ metadata.gz: 2717864079f8ab4dad84f4a81988f8b2d9b518d34e6069c52b0c4ce2e71e4de3
4
+ data.tar.gz: df29f816d2bf25dc10531ea3b794b12257bdd9cc5c60c6d1acd996504c99962b
5
5
  SHA512:
6
- metadata.gz: fdf054f2ab97d4977f16f783c266969c59ff7d9fdc182570760ff43d744bf950c4bc3b6b8b702a6f094452bd01ae0a9b2d93c1fc0a9aeb17a9b4d01fc789efa1
7
- data.tar.gz: 6cae037881482b4b672c25c987e3cd271202787d32745fc9b17c7c1d7dd6191a609a278cbfb0e04fbe8cfd734c684ef8d12d922733e530fc232d16028308b902
6
+ metadata.gz: 6f21dbc4619729a471e7a6bb217928e41554b0bc2b9c5254b1914db464bf9e06f329667208c240a7590380d0b6a481ca21ce1dfc48bd34a9978c951098d06473
7
+ data.tar.gz: 99f279fb6ff56242de7139b3fd8527d366503cc2fa62d7abebdce8e7aee01e8ee37bd971cbba20e57b6d96d6534d4bbc539255b8fd1530ebba6c201cfcdf0f74
@@ -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). 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] |
@@ -12,6 +12,7 @@
12
12
  | **tags** | **Array<String>** | Array of keyword tags (max 500 characters combined for YouTube) | [optional] |
13
13
  | **category_id** | **String** | YouTube video category ID | [optional] |
14
14
  | **privacy_status** | **String** | Video privacy setting | [optional] |
15
+ | **thumbnail_url** | **String** | Public URL of a custom thumbnail image (JPEG, PNG, or GIF, max 2 MB, recommended 1280x720). Works on any video you own, including existing videos not published through Zernio. The channel must be verified (phone verification) to set custom thumbnails. | [optional] |
15
16
 
16
17
  ## Example
17
18
 
@@ -26,7 +27,8 @@ instance = Late::UpdatePostMetadataRequest.new(
26
27
  description: null,
27
28
  tags: null,
28
29
  category_id: null,
29
- privacy_status: null
30
+ privacy_status: null,
31
+ thumbnail_url: null
30
32
  )
31
33
  ```
32
34
 
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: 'BODY', text: 'text_example'})]}) # UpdateWhatsAppTemplateRequest |
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 (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] |
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 PHONE_NUMBER | [optional] |
12
- | **otp_type** | **String** | Required when type is OTP | [optional] |
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 (HEADER, BODY, FOOTER, BUTTONS). Required for custom templates, omit when using library_template_name.
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.
@@ -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', ["QUICK_REPLY", "URL", "PHONE_NUMBER"])
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', ["QUICK_REPLY", "URL", "PHONE_NUMBER"])
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
@@ -39,6 +39,9 @@ module Late
39
39
  # Video privacy setting
40
40
  attr_accessor :privacy_status
41
41
 
42
+ # Public URL of a custom thumbnail image (JPEG, PNG, or GIF, max 2 MB, recommended 1280x720). Works on any video you own, including existing videos not published through Zernio. The channel must be verified (phone verification) to set custom thumbnails.
43
+ attr_accessor :thumbnail_url
44
+
42
45
  class EnumAttributeValidator
43
46
  attr_reader :datatype
44
47
  attr_reader :allowable_values
@@ -71,7 +74,8 @@ module Late
71
74
  :'description' => :'description',
72
75
  :'tags' => :'tags',
73
76
  :'category_id' => :'categoryId',
74
- :'privacy_status' => :'privacyStatus'
77
+ :'privacy_status' => :'privacyStatus',
78
+ :'thumbnail_url' => :'thumbnailUrl'
75
79
  }
76
80
  end
77
81
 
@@ -95,7 +99,8 @@ module Late
95
99
  :'description' => :'String',
96
100
  :'tags' => :'Array<String>',
97
101
  :'category_id' => :'String',
98
- :'privacy_status' => :'String'
102
+ :'privacy_status' => :'String',
103
+ :'thumbnail_url' => :'String'
99
104
  }
100
105
  end
101
106
 
@@ -156,6 +161,10 @@ module Late
156
161
  if attributes.key?(:'privacy_status')
157
162
  self.privacy_status = attributes[:'privacy_status']
158
163
  end
164
+
165
+ if attributes.key?(:'thumbnail_url')
166
+ self.thumbnail_url = attributes[:'thumbnail_url']
167
+ end
159
168
  end
160
169
 
161
170
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -233,7 +242,8 @@ module Late
233
242
  description == o.description &&
234
243
  tags == o.tags &&
235
244
  category_id == o.category_id &&
236
- privacy_status == o.privacy_status
245
+ privacy_status == o.privacy_status &&
246
+ thumbnail_url == o.thumbnail_url
237
247
  end
238
248
 
239
249
  # @see the `==` method
@@ -245,7 +255,7 @@ module Late
245
255
  # Calculates hash code according to all attributes.
246
256
  # @return [Integer] Hash code
247
257
  def hash
248
- [platform, video_id, account_id, title, description, tags, category_id, privacy_status].hash
258
+ [platform, video_id, account_id, title, description, tags, category_id, privacy_status, thumbnail_url].hash
249
259
  end
250
260
 
251
261
  # Builds the object from hash
@@ -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', ["BODY"])
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', ["BODY"])
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', ["BUTTONS"])
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', ["BUTTONS"])
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', ["FOOTER"])
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', ["FOOTER"])
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', ["HEADER"])
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', ["TEXT", "IMAGE", "VIDEO", "GIF", "DOCUMENT", "LOCATION"])
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', ["HEADER"])
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', ["TEXT", "IMAGE", "VIDEO", "GIF", "DOCUMENT", "LOCATION"])
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 (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.
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 PHONE_NUMBER
28
+ # Required when type is phone_number
29
29
  attr_accessor :phone_number
30
30
 
31
- # Required when type is OTP
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', ["QUICK_REPLY", "URL", "PHONE_NUMBER", "OTP", "FLOW", "MPM", "CATALOG"])
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', ["COPY_CODE", "ONE_TAP", "ZERO_TAP"])
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', ["QUICK_REPLY", "URL", "PHONE_NUMBER", "OTP", "FLOW", "MPM", "CATALOG"])
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', ["COPY_CODE", "ONE_TAP", "ZERO_TAP"])
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
- # Go through the list of oneOf items and attempt to identify the appropriate one.
34
- # Note:
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
- case klass.to_s
60
- when 'Boolean'
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
- raise # if no match by now, raise
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
@@ -11,5 +11,5 @@ Generator version: 7.19.0
11
11
  =end
12
12
 
13
13
  module Late
14
- VERSION = '0.0.94'
14
+ VERSION = '0.0.96'
15
15
  end
data/openapi.yaml CHANGED
@@ -315,7 +315,7 @@ components:
315
315
  properties:
316
316
  type:
317
317
  type: string
318
- enum: [QUICK_REPLY, URL, PHONE_NUMBER, OTP, FLOW, MPM, CATALOG]
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 PHONE_NUMBER
331
+ description: Required when type is phone_number
332
332
  otp_type:
333
333
  type: string
334
- enum: [COPY_CODE, ONE_TAP, ZERO_TAP]
335
- description: Required when type is OTP
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: [HEADER]
371
+ enum: [header]
365
372
  format:
366
373
  type: string
367
- enum: [TEXT, IMAGE, VIDEO, GIF, DOCUMENT, LOCATION]
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 (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.
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: [BODY]
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: [FOOTER]
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: [BUTTONS]
435
+ enum: [buttons]
429
436
  buttons:
430
437
  type: array
431
438
  minItems: 1
@@ -5770,6 +5777,10 @@ paths:
5770
5777
  type: string
5771
5778
  enum: [public, private, unlisted]
5772
5779
  description: Video privacy setting
5780
+ thumbnailUrl:
5781
+ type: string
5782
+ format: uri
5783
+ description: "Public URL of a custom thumbnail image (JPEG, PNG, or GIF, max 2 MB, recommended 1280x720). Works on any video you own, including existing videos not published through Zernio. The channel must be verified (phone verification) to set custom thumbnails."
5773
5784
  examples:
5774
5785
  post-based:
5775
5786
  summary: Update a video published through Zernio
@@ -5786,6 +5797,13 @@ paths:
5786
5797
  accountId: "68fb37418bbca9c10cbfef26"
5787
5798
  title: "Updated Title with SEO Keywords"
5788
5799
  tags: ["seo", "youtube", "optimization"]
5800
+ update-thumbnail:
5801
+ summary: Update thumbnail on an existing video
5802
+ value:
5803
+ platform: "youtube"
5804
+ videoId: "dQw4w9WgXcQ"
5805
+ accountId: "68fb37418bbca9c10cbfef26"
5806
+ thumbnailUrl: "https://example.com/my-thumbnail.jpg"
5789
5807
  responses:
5790
5808
  '200':
5791
5809
  description: Metadata updated successfully
@@ -14154,7 +14172,7 @@ paths:
14154
14172
  description: Template language code (e.g., en_US)
14155
14173
  components:
14156
14174
  type: array
14157
- description: "Template components (HEADER, BODY, FOOTER, BUTTONS). Required for custom templates, omit when using library_template_name."
14175
+ description: "Template components (header, body, footer, buttons). Required for custom templates, omit when using library_template_name."
14158
14176
  minItems: 1
14159
14177
  items:
14160
14178
  $ref: '#/components/schemas/WhatsAppTemplateComponent'
@@ -14180,7 +14198,7 @@ paths:
14180
14198
  properties:
14181
14199
  type:
14182
14200
  type: string
14183
- enum: [QUICK_REPLY, URL, PHONE_NUMBER]
14201
+ enum: [quick_reply, url, phone_number]
14184
14202
  url:
14185
14203
  type: object
14186
14204
  properties:
@@ -14196,19 +14214,19 @@ paths:
14196
14214
  category: "UTILITY"
14197
14215
  language: "en_US"
14198
14216
  components:
14199
- - type: "HEADER"
14200
- format: "IMAGE"
14217
+ - type: "header"
14218
+ format: "image"
14201
14219
  example:
14202
14220
  header_handle: ["https://example.com/header.jpg"]
14203
- - type: "BODY"
14221
+ - type: "body"
14204
14222
  text: "Your order {{1}} has been confirmed. Expected delivery: {{2}}"
14205
14223
  example:
14206
14224
  body_text: [["ORD-12345", "March 31"]]
14207
- - type: "FOOTER"
14225
+ - type: "footer"
14208
14226
  text: "Thank you for your purchase"
14209
- - type: "BUTTONS"
14227
+ - type: "buttons"
14210
14228
  buttons:
14211
- - type: "QUICK_REPLY"
14229
+ - type: "quick_reply"
14212
14230
  text: "Track Order"
14213
14231
  library:
14214
14232
  summary: Library template (pre-approved, no review)
@@ -14219,7 +14237,7 @@ paths:
14219
14237
  language: "en_US"
14220
14238
  library_template_name: "appointment_reminder"
14221
14239
  library_template_button_inputs:
14222
- - type: "URL"
14240
+ - type: "url"
14223
14241
  url:
14224
14242
  base_url: "https://myapp.com/appointments/{{1}}"
14225
14243
  responses:
@@ -14327,13 +14345,13 @@ paths:
14327
14345
  example:
14328
14346
  accountId: "507f1f77bcf86cd799439011"
14329
14347
  components:
14330
- - type: "BODY"
14348
+ - type: "body"
14331
14349
  text: "Updated: Your order {{1}} is confirmed. Delivery by {{2}}"
14332
14350
  example:
14333
14351
  body_text: [["ORD-12345", "April 1"]]
14334
- - type: "BUTTONS"
14352
+ - type: "buttons"
14335
14353
  buttons:
14336
- - type: "QUICK_REPLY"
14354
+ - type: "quick_reply"
14337
14355
  text: "Track Order"
14338
14356
  responses:
14339
14357
  '200':
@@ -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', ["QUICK_REPLY", "URL", "PHONE_NUMBER"])
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
@@ -83,4 +83,10 @@ describe Late::UpdatePostMetadataRequest do
83
83
  end
84
84
  end
85
85
 
86
+ describe 'test attribute "thumbnail_url"' do
87
+ it 'should work' do
88
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
89
+ end
90
+ end
91
+
86
92
  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', ["BODY"])
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', ["BUTTONS"])
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', ["FOOTER"])
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', ["HEADER"])
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', ["TEXT", "IMAGE", "VIDEO", "GIF", "DOCUMENT", "LOCATION"])
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', ["QUICK_REPLY", "URL", "PHONE_NUMBER", "OTP", "FLOW", "MPM", "CATALOG"])
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', ["COPY_CODE", "ONE_TAP", "ZERO_TAP"])
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: late-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.94
4
+ version: 0.0.96
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAPI-Generator
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-30 00:00:00.000000000 Z
11
+ date: 2026-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -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.94.gem
2250
+ - zernio-sdk-0.0.96.gem
2251
2251
  homepage: https://openapi-generator.tech
2252
2252
  licenses:
2253
2253
  - Unlicense
Binary file