late-sdk 0.0.92 → 0.0.94

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -0
  3. data/docs/CreateWhatsAppTemplateRequest.md +1 -1
  4. data/docs/UpdateWhatsAppTemplateRequest.md +1 -1
  5. data/docs/WhatsAppApi.md +1 -1
  6. data/docs/WhatsAppBodyComponent.md +24 -0
  7. data/docs/WhatsAppBodyComponentExample.md +18 -0
  8. data/docs/WhatsAppButtonsComponent.md +20 -0
  9. data/docs/WhatsAppFooterComponent.md +22 -0
  10. data/docs/WhatsAppHeaderComponent.md +24 -0
  11. data/docs/WhatsAppHeaderComponentExample.md +20 -0
  12. data/docs/WhatsAppTemplateButton.md +44 -0
  13. data/docs/WhatsAppTemplateComponent.md +53 -0
  14. data/lib/late-sdk/models/create_whats_app_template_request.rb +21 -2
  15. data/lib/late-sdk/models/update_whats_app_template_request.rb +10 -1
  16. data/lib/late-sdk/models/whats_app_body_component.rb +234 -0
  17. data/lib/late-sdk/models/whats_app_body_component_example.rb +150 -0
  18. data/lib/late-sdk/models/whats_app_buttons_component.rb +225 -0
  19. data/lib/late-sdk/models/whats_app_footer_component.rb +227 -0
  20. data/lib/late-sdk/models/whats_app_header_component.rb +235 -0
  21. data/lib/late-sdk/models/whats_app_header_component_example.rb +190 -0
  22. data/lib/late-sdk/models/whats_app_template_button.rb +340 -0
  23. data/lib/late-sdk/models/whats_app_template_component.rb +106 -0
  24. data/lib/late-sdk/version.rb +1 -1
  25. data/lib/late-sdk.rb +8 -0
  26. data/openapi.yaml +147 -5
  27. data/spec/models/whats_app_body_component_example_spec.rb +36 -0
  28. data/spec/models/whats_app_body_component_spec.rb +58 -0
  29. data/spec/models/whats_app_buttons_component_spec.rb +46 -0
  30. data/spec/models/whats_app_footer_component_spec.rb +52 -0
  31. data/spec/models/whats_app_header_component_example_spec.rb +42 -0
  32. data/spec/models/whats_app_header_component_spec.rb +62 -0
  33. data/spec/models/whats_app_template_button_spec.rb +122 -0
  34. data/spec/models/whats_app_template_component_spec.rb +32 -0
  35. data/zernio-sdk-0.0.94.gem +0 -0
  36. metadata +34 -2
  37. data/zernio-sdk-0.0.92.gem +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99911c95c4758a0d8b07c697e627c2dd48921a735c1b7a55813d6e71614180f7
4
- data.tar.gz: 42e3daa9e1fde234fca4508730a21edd77bb1c970647709b144f539146e5c470
3
+ metadata.gz: df932c23e88e3e6675ca38fcaefff7052a4da59d3eb923526297e4d9a2c1e3a6
4
+ data.tar.gz: 4a7c1e5fb67076512e24cc667f13cbbe49e13872c615b0cb76ba63079d7ab1f7
5
5
  SHA512:
6
- metadata.gz: 93bbe08403efd491b5bfc347482f66d2ded6f1e63da9562387d615db977acfbc1529c1509934befcbb7847fc52bafdda49b1eb03628360867164dd4a4b004bf3
7
- data.tar.gz: dcbd6d1e318655c4691d378b897b115901cc55382d2291060b8e3afd79981894826089e6491f8788593ef2bb8f7c338f9894b911ac6dcfaa0b10599e6d7cc258
6
+ metadata.gz: fdf054f2ab97d4977f16f783c266969c59ff7d9fdc182570760ff43d744bf950c4bc3b6b8b702a6f094452bd01ae0a9b2d93c1fc0a9aeb17a9b4d01fc789efa1
7
+ data.tar.gz: 6cae037881482b4b672c25c987e3cd271202787d32745fc9b17c7c1d7dd6191a609a278cbfb0e04fbe8cfd734c684ef8d12d922733e530fc232d16028308b902
data/README.md CHANGED
@@ -985,6 +985,14 @@ Class | Method | HTTP request | Description
985
985
  - [Late::WebhookPayloadPostPost](docs/WebhookPayloadPostPost.md)
986
986
  - [Late::WebhookPayloadPostPostPlatformsInner](docs/WebhookPayloadPostPostPlatformsInner.md)
987
987
  - [Late::WebhookPayloadTest](docs/WebhookPayloadTest.md)
988
+ - [Late::WhatsAppBodyComponent](docs/WhatsAppBodyComponent.md)
989
+ - [Late::WhatsAppBodyComponentExample](docs/WhatsAppBodyComponentExample.md)
990
+ - [Late::WhatsAppButtonsComponent](docs/WhatsAppButtonsComponent.md)
991
+ - [Late::WhatsAppFooterComponent](docs/WhatsAppFooterComponent.md)
992
+ - [Late::WhatsAppHeaderComponent](docs/WhatsAppHeaderComponent.md)
993
+ - [Late::WhatsAppHeaderComponentExample](docs/WhatsAppHeaderComponentExample.md)
994
+ - [Late::WhatsAppTemplateButton](docs/WhatsAppTemplateButton.md)
995
+ - [Late::WhatsAppTemplateComponent](docs/WhatsAppTemplateComponent.md)
988
996
  - [Late::YouTubeDailyViewsResponse](docs/YouTubeDailyViewsResponse.md)
989
997
  - [Late::YouTubeDailyViewsResponseDailyViewsInner](docs/YouTubeDailyViewsResponseDailyViewsInner.md)
990
998
  - [Late::YouTubeDailyViewsResponseDateRange](docs/YouTubeDailyViewsResponseDateRange.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<Object>** | 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] |
@@ -5,7 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **account_id** | **String** | WhatsApp social account ID | |
8
- | **components** | **Array<Object>** | Updated template components | |
8
+ | **components** | [**Array<WhatsAppTemplateComponent>**](WhatsAppTemplateComponent.md) | Updated template components | |
9
9
 
10
10
  ## Example
11
11
 
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: [3.56]}) # 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
@@ -0,0 +1,24 @@
1
+ # Late::WhatsAppBodyComponent
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **type** | **String** | | |
8
+ | **text** | **String** | Body text with optional {{n}} variables | |
9
+ | **add_security_recommendation** | **Boolean** | Add security recommendation text (authentication templates only) | [optional] |
10
+ | **example** | [**WhatsAppBodyComponentExample**](WhatsAppBodyComponentExample.md) | | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'late-sdk'
16
+
17
+ instance = Late::WhatsAppBodyComponent.new(
18
+ type: null,
19
+ text: null,
20
+ add_security_recommendation: null,
21
+ example: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,18 @@
1
+ # Late::WhatsAppBodyComponentExample
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **body_text** | **Array<Array<String>>** | Sample values for body variables (array of arrays) | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'late-sdk'
13
+
14
+ instance = Late::WhatsAppBodyComponentExample.new(
15
+ body_text: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,20 @@
1
+ # Late::WhatsAppButtonsComponent
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **type** | **String** | | |
8
+ | **buttons** | [**Array<WhatsAppTemplateButton>**](WhatsAppTemplateButton.md) | | |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'late-sdk'
14
+
15
+ instance = Late::WhatsAppButtonsComponent.new(
16
+ type: null,
17
+ buttons: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,22 @@
1
+ # Late::WhatsAppFooterComponent
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **type** | **String** | | |
8
+ | **text** | **String** | Static footer text | [optional] |
9
+ | **code_expiration_minutes** | **Integer** | OTP code expiry in minutes (authentication templates only) | [optional] |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'late-sdk'
15
+
16
+ instance = Late::WhatsAppFooterComponent.new(
17
+ type: null,
18
+ text: null,
19
+ code_expiration_minutes: null
20
+ )
21
+ ```
22
+
@@ -0,0 +1,24 @@
1
+ # Late::WhatsAppHeaderComponent
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **type** | **String** | | |
8
+ | **format** | **String** | | |
9
+ | **text** | **String** | Header text (may include {{1}} variable). Used when format is TEXT. | [optional] |
10
+ | **example** | [**WhatsAppHeaderComponentExample**](WhatsAppHeaderComponentExample.md) | | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'late-sdk'
16
+
17
+ instance = Late::WhatsAppHeaderComponent.new(
18
+ type: null,
19
+ format: null,
20
+ text: null,
21
+ example: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,20 @@
1
+ # Late::WhatsAppHeaderComponentExample
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
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] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'late-sdk'
14
+
15
+ instance = Late::WhatsAppHeaderComponentExample.new(
16
+ header_text: null,
17
+ header_handle: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,44 @@
1
+ # Late::WhatsAppTemplateButton
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **type** | **String** | | |
8
+ | **text** | **String** | | |
9
+ | **url** | **String** | Required when type is URL | [optional] |
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] |
13
+ | **autofill_text** | **String** | | [optional] |
14
+ | **package_name** | **String** | | [optional] |
15
+ | **signature_hash** | **String** | | [optional] |
16
+ | **flow_id** | **String** | | [optional] |
17
+ | **flow_name** | **String** | | [optional] |
18
+ | **flow_json** | **String** | | [optional] |
19
+ | **flow_action** | **String** | | [optional] |
20
+ | **navigate_screen** | **String** | | [optional] |
21
+
22
+ ## Example
23
+
24
+ ```ruby
25
+ require 'late-sdk'
26
+
27
+ instance = Late::WhatsAppTemplateButton.new(
28
+ type: null,
29
+ text: null,
30
+ url: null,
31
+ example: null,
32
+ phone_number: null,
33
+ otp_type: null,
34
+ autofill_text: null,
35
+ package_name: null,
36
+ signature_hash: null,
37
+ flow_id: null,
38
+ flow_name: null,
39
+ flow_json: null,
40
+ flow_action: null,
41
+ navigate_screen: null
42
+ )
43
+ ```
44
+
@@ -0,0 +1,53 @@
1
+ # Late::WhatsAppTemplateComponent
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 'late-sdk'
13
+
14
+ Late::WhatsAppTemplateComponent.openapi_one_of
15
+ # =>
16
+ # [
17
+ # :'WhatsAppBodyComponent',
18
+ # :'WhatsAppButtonsComponent',
19
+ # :'WhatsAppFooterComponent',
20
+ # :'WhatsAppHeaderComponent'
21
+ # ]
22
+ ```
23
+
24
+ ### build
25
+
26
+ Find the appropriate object from the `openapi_one_of` list and casts the data into it.
27
+
28
+ #### Example
29
+
30
+ ```ruby
31
+ require 'late-sdk'
32
+
33
+ Late::WhatsAppTemplateComponent.build(data)
34
+ # => #<WhatsAppBodyComponent:0x00007fdd4aab02a0>
35
+
36
+ Late::WhatsAppTemplateComponent.build(data_that_doesnt_match)
37
+ # => nil
38
+ ```
39
+
40
+ #### Parameters
41
+
42
+ | Name | Type | Description |
43
+ | ---- | ---- | ----------- |
44
+ | **data** | **Mixed** | data to be matched against the list of oneOf items |
45
+
46
+ #### Return type
47
+
48
+ - `WhatsAppBodyComponent`
49
+ - `WhatsAppButtonsComponent`
50
+ - `WhatsAppFooterComponent`
51
+ - `WhatsAppHeaderComponent`
52
+ - `nil` (if no type matches)
53
+
@@ -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.
@@ -92,7 +92,7 @@ module Late
92
92
  :'name' => :'String',
93
93
  :'category' => :'String',
94
94
  :'language' => :'String',
95
- :'components' => :'Array<Object>',
95
+ :'components' => :'Array<WhatsAppTemplateComponent>',
96
96
  :'library_template_name' => :'String',
97
97
  :'library_template_body_inputs' => :'Object',
98
98
  :'library_template_button_inputs' => :'Array<CreateWhatsAppTemplateRequestLibraryTemplateButtonInputsInner>'
@@ -192,6 +192,10 @@ module Late
192
192
  invalid_properties.push('invalid value for "language", language cannot be nil.')
193
193
  end
194
194
 
195
+ if !@components.nil? && @components.length < 1
196
+ invalid_properties.push('invalid value for "components", number of items must be greater than or equal to 1.')
197
+ end
198
+
195
199
  invalid_properties
196
200
  end
197
201
 
@@ -206,6 +210,7 @@ module Late
206
210
  category_validator = EnumAttributeValidator.new('String', ["AUTHENTICATION", "MARKETING", "UTILITY"])
207
211
  return false unless category_validator.valid?(@category)
208
212
  return false if @language.nil?
213
+ return false if !@components.nil? && @components.length < 1
209
214
  true
210
215
  end
211
216
 
@@ -254,6 +259,20 @@ module Late
254
259
  @language = language
255
260
  end
256
261
 
262
+ # Custom attribute writer method with validation
263
+ # @param [Object] components Value to be assigned
264
+ def components=(components)
265
+ if components.nil?
266
+ fail ArgumentError, 'components cannot be nil'
267
+ end
268
+
269
+ if components.length < 1
270
+ fail ArgumentError, 'invalid value for "components", number of items must be greater than or equal to 1.'
271
+ end
272
+
273
+ @components = components
274
+ end
275
+
257
276
  # Checks equality by comparing each attribute.
258
277
  # @param [Object] Object to be compared
259
278
  def ==(o)
@@ -43,7 +43,7 @@ module Late
43
43
  def self.openapi_types
44
44
  {
45
45
  :'account_id' => :'String',
46
- :'components' => :'Array<Object>'
46
+ :'components' => :'Array<WhatsAppTemplateComponent>'
47
47
  }
48
48
  end
49
49
 
@@ -97,6 +97,10 @@ module Late
97
97
  invalid_properties.push('invalid value for "components", components cannot be nil.')
98
98
  end
99
99
 
100
+ if @components.length < 1
101
+ invalid_properties.push('invalid value for "components", number of items must be greater than or equal to 1.')
102
+ end
103
+
100
104
  invalid_properties
101
105
  end
102
106
 
@@ -106,6 +110,7 @@ module Late
106
110
  warn '[DEPRECATED] the `valid?` method is obsolete'
107
111
  return false if @account_id.nil?
108
112
  return false if @components.nil?
113
+ return false if @components.length < 1
109
114
  true
110
115
  end
111
116
 
@@ -126,6 +131,10 @@ module Late
126
131
  fail ArgumentError, 'components cannot be nil'
127
132
  end
128
133
 
134
+ if components.length < 1
135
+ fail ArgumentError, 'invalid value for "components", number of items must be greater than or equal to 1.'
136
+ end
137
+
129
138
  @components = components
130
139
  end
131
140
 
@@ -0,0 +1,234 @@
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.1
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 Late
17
+ class WhatsAppBodyComponent < ApiModelBase
18
+ attr_accessor :type
19
+
20
+ # Body text with optional {{n}} variables
21
+ attr_accessor :text
22
+
23
+ # Add security recommendation text (authentication templates only)
24
+ attr_accessor :add_security_recommendation
25
+
26
+ attr_accessor :example
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'type' => :'type',
54
+ :'text' => :'text',
55
+ :'add_security_recommendation' => :'add_security_recommendation',
56
+ :'example' => :'example'
57
+ }
58
+ end
59
+
60
+ # Returns attribute mapping this model knows about
61
+ def self.acceptable_attribute_map
62
+ attribute_map
63
+ end
64
+
65
+ # Returns all the JSON keys this model knows about
66
+ def self.acceptable_attributes
67
+ acceptable_attribute_map.values
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.openapi_types
72
+ {
73
+ :'type' => :'String',
74
+ :'text' => :'String',
75
+ :'add_security_recommendation' => :'Boolean',
76
+ :'example' => :'WhatsAppBodyComponentExample'
77
+ }
78
+ end
79
+
80
+ # List of attributes with nullable: true
81
+ def self.openapi_nullable
82
+ Set.new([
83
+ ])
84
+ end
85
+
86
+ # Initializes the object
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ def initialize(attributes = {})
89
+ if (!attributes.is_a?(Hash))
90
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Late::WhatsAppBodyComponent` initialize method"
91
+ end
92
+
93
+ # check to see if the attribute exists and convert string to symbol for hash key
94
+ acceptable_attribute_map = self.class.acceptable_attribute_map
95
+ attributes = attributes.each_with_object({}) { |(k, v), h|
96
+ if (!acceptable_attribute_map.key?(k.to_sym))
97
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Late::WhatsAppBodyComponent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
98
+ end
99
+ h[k.to_sym] = v
100
+ }
101
+
102
+ if attributes.key?(:'type')
103
+ self.type = attributes[:'type']
104
+ else
105
+ self.type = nil
106
+ end
107
+
108
+ if attributes.key?(:'text')
109
+ self.text = attributes[:'text']
110
+ else
111
+ self.text = nil
112
+ end
113
+
114
+ if attributes.key?(:'add_security_recommendation')
115
+ self.add_security_recommendation = attributes[:'add_security_recommendation']
116
+ end
117
+
118
+ if attributes.key?(:'example')
119
+ self.example = attributes[:'example']
120
+ end
121
+ end
122
+
123
+ # Show invalid properties with the reasons. Usually used together with valid?
124
+ # @return Array for valid properties with the reasons
125
+ def list_invalid_properties
126
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
127
+ invalid_properties = Array.new
128
+ if @type.nil?
129
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
130
+ end
131
+
132
+ if @text.nil?
133
+ invalid_properties.push('invalid value for "text", text cannot be nil.')
134
+ end
135
+
136
+ invalid_properties
137
+ end
138
+
139
+ # Check to see if the all the properties in the model are valid
140
+ # @return true if the model is valid
141
+ def valid?
142
+ warn '[DEPRECATED] the `valid?` method is obsolete'
143
+ return false if @type.nil?
144
+ type_validator = EnumAttributeValidator.new('String', ["BODY"])
145
+ return false unless type_validator.valid?(@type)
146
+ return false if @text.nil?
147
+ true
148
+ end
149
+
150
+ # Custom attribute writer method checking allowed values (enum).
151
+ # @param [Object] type Object to be assigned
152
+ def type=(type)
153
+ validator = EnumAttributeValidator.new('String', ["BODY"])
154
+ unless validator.valid?(type)
155
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
156
+ end
157
+ @type = type
158
+ end
159
+
160
+ # Custom attribute writer method with validation
161
+ # @param [Object] text Value to be assigned
162
+ def text=(text)
163
+ if text.nil?
164
+ fail ArgumentError, 'text cannot be nil'
165
+ end
166
+
167
+ @text = text
168
+ end
169
+
170
+ # Checks equality by comparing each attribute.
171
+ # @param [Object] Object to be compared
172
+ def ==(o)
173
+ return true if self.equal?(o)
174
+ self.class == o.class &&
175
+ type == o.type &&
176
+ text == o.text &&
177
+ add_security_recommendation == o.add_security_recommendation &&
178
+ example == o.example
179
+ end
180
+
181
+ # @see the `==` method
182
+ # @param [Object] Object to be compared
183
+ def eql?(o)
184
+ self == o
185
+ end
186
+
187
+ # Calculates hash code according to all attributes.
188
+ # @return [Integer] Hash code
189
+ def hash
190
+ [type, text, add_security_recommendation, example].hash
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def self.build_from_hash(attributes)
197
+ return nil unless attributes.is_a?(Hash)
198
+ attributes = attributes.transform_keys(&:to_sym)
199
+ transformed_hash = {}
200
+ openapi_types.each_pair do |key, type|
201
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
202
+ transformed_hash["#{key}"] = nil
203
+ elsif type =~ /\AArray<(.*)>/i
204
+ # check to ensure the input is an array given that the attribute
205
+ # is documented as an array but the input is not
206
+ if attributes[attribute_map[key]].is_a?(Array)
207
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
208
+ end
209
+ elsif !attributes[attribute_map[key]].nil?
210
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
211
+ end
212
+ end
213
+ new(transformed_hash)
214
+ end
215
+
216
+ # Returns the object in the form of hash
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_hash
219
+ hash = {}
220
+ self.class.attribute_map.each_pair do |attr, param|
221
+ value = self.send(attr)
222
+ if value.nil?
223
+ is_nullable = self.class.openapi_nullable.include?(attr)
224
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
225
+ end
226
+
227
+ hash[param] = _to_hash(value)
228
+ end
229
+ hash
230
+ end
231
+
232
+ end
233
+
234
+ end