late-sdk 0.0.948 → 0.0.950

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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -0
  3. data/docs/CreateInboxConversation400Response.md +11 -3
  4. data/docs/CreateInboxConversation400ResponseAnyOf.md +20 -0
  5. data/docs/CreateInboxConversation404Response.md +11 -3
  6. data/docs/CreateInboxConversation404ResponseAnyOf.md +20 -0
  7. data/docs/CreateInboxConversation422Response.md +11 -3
  8. data/docs/CreateInboxConversation422ResponseAnyOf.md +20 -0
  9. data/docs/CreateInboxConversation429Response.md +11 -3
  10. data/docs/CreateInboxConversation429ResponseAnyOf.md +20 -0
  11. data/docs/ListTikTokCommercialMusic200ResponseTracksInner.md +3 -1
  12. data/docs/ListTikTokCommercialMusic200ResponseTracksInnerClip.md +2 -0
  13. data/docs/MessagesApi.md +2 -2
  14. data/docs/SendInboxMessage400Response.md +1 -1
  15. data/docs/SendInboxMessage502Response.md +30 -0
  16. data/docs/TikTokPlatformDataMusicSoundInfo.md +1 -1
  17. data/docs/WhatsAppTemplateLookupError.md +28 -0
  18. data/docs/WhatsAppTemplateLookupErrorDetails.md +24 -0
  19. data/docs/WhatsAppTemplateLookupErrorDetailsProviderHeaders.md +22 -0
  20. data/docs/WhatsAppTemplateLookupErrorPlatformError.md +22 -0
  21. data/docs/WhatsAppTemplateLookupErrorPlatformErrorErrorData.md +18 -0
  22. data/lib/zernio-sdk/api/messages_api.rb +4 -4
  23. data/lib/zernio-sdk/models/create_inbox_conversation400_response.rb +73 -160
  24. data/lib/zernio-sdk/models/create_inbox_conversation400_response_any_of.rb +190 -0
  25. data/lib/zernio-sdk/models/create_inbox_conversation404_response.rb +73 -160
  26. data/lib/zernio-sdk/models/create_inbox_conversation404_response_any_of.rb +190 -0
  27. data/lib/zernio-sdk/models/create_inbox_conversation422_response.rb +73 -160
  28. data/lib/zernio-sdk/models/create_inbox_conversation422_response_any_of.rb +190 -0
  29. data/lib/zernio-sdk/models/create_inbox_conversation429_response.rb +73 -160
  30. data/lib/zernio-sdk/models/create_inbox_conversation429_response_any_of.rb +190 -0
  31. data/lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner.rb +12 -2
  32. data/lib/zernio-sdk/models/list_tik_tok_commercial_music200_response_tracks_inner_clip.rb +11 -2
  33. data/lib/zernio-sdk/models/send_inbox_message400_response.rb +3 -3
  34. data/lib/zernio-sdk/models/send_inbox_message400_response_platform_error.rb +1 -1
  35. data/lib/zernio-sdk/models/send_inbox_message502_response.rb +103 -0
  36. data/lib/zernio-sdk/models/tik_tok_platform_data_music_sound_info.rb +1 -1
  37. data/lib/zernio-sdk/models/whats_app_template_lookup_error.rb +305 -0
  38. data/lib/zernio-sdk/models/whats_app_template_lookup_error_details.rb +233 -0
  39. data/lib/zernio-sdk/models/whats_app_template_lookup_error_details_provider_headers.rb +166 -0
  40. data/lib/zernio-sdk/models/whats_app_template_lookup_error_platform_error.rb +166 -0
  41. data/lib/zernio-sdk/models/whats_app_template_lookup_error_platform_error_error_data.rb +147 -0
  42. data/lib/zernio-sdk/version.rb +1 -1
  43. data/lib/zernio-sdk.rb +10 -0
  44. data/openapi.yaml +105 -25
  45. data/spec/api/messages_api_spec.rb +2 -2
  46. data/spec/models/create_inbox_conversation400_response_any_of_spec.rb +46 -0
  47. data/spec/models/create_inbox_conversation400_response_spec.rb +0 -25
  48. data/spec/models/create_inbox_conversation404_response_any_of_spec.rb +46 -0
  49. data/spec/models/create_inbox_conversation404_response_spec.rb +0 -25
  50. data/spec/models/create_inbox_conversation422_response_any_of_spec.rb +46 -0
  51. data/spec/models/create_inbox_conversation422_response_spec.rb +0 -25
  52. data/spec/models/create_inbox_conversation429_response_any_of_spec.rb +46 -0
  53. data/spec/models/create_inbox_conversation429_response_spec.rb +0 -25
  54. data/spec/models/list_tik_tok_commercial_music200_response_tracks_inner_clip_spec.rb +6 -0
  55. data/spec/models/list_tik_tok_commercial_music200_response_tracks_inner_spec.rb +6 -0
  56. data/spec/models/send_inbox_message400_response_spec.rb +1 -1
  57. data/spec/models/send_inbox_message502_response_spec.rb +21 -0
  58. data/spec/models/whats_app_template_lookup_error_details_provider_headers_spec.rb +48 -0
  59. data/spec/models/whats_app_template_lookup_error_details_spec.rb +58 -0
  60. data/spec/models/whats_app_template_lookup_error_platform_error_error_data_spec.rb +36 -0
  61. data/spec/models/whats_app_template_lookup_error_platform_error_spec.rb +48 -0
  62. data/spec/models/whats_app_template_lookup_error_spec.rb +78 -0
  63. data/zernio-sdk-0.0.950.gem +0 -0
  64. metadata +42 -2
  65. data/zernio-sdk-0.0.948.gem +0 -0
@@ -14,177 +14,90 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Zernio
17
- class CreateInboxConversation400Response < ApiModelBase
18
- attr_accessor :error
19
-
20
- attr_accessor :code
21
-
22
- class EnumAttributeValidator
23
- attr_reader :datatype
24
- attr_reader :allowable_values
25
-
26
- def initialize(datatype, allowable_values)
27
- @allowable_values = allowable_values.map do |value|
28
- case datatype.to_s
29
- when /Integer/i
30
- value.to_i
31
- when /Float/i
32
- value.to_f
33
- else
34
- value
35
- end
36
- end
37
- end
38
-
39
- def valid?(value)
40
- !value || allowable_values.include?(value)
41
- end
42
- end
43
-
44
- # Attribute mapping from ruby-style variable name to JSON key.
45
- def self.attribute_map
46
- {
47
- :'error' => :'error',
48
- :'code' => :'code'
49
- }
50
- end
51
-
52
- # Returns attribute mapping this model knows about
53
- def self.acceptable_attribute_map
54
- attribute_map
55
- end
56
-
57
- # Returns all the JSON keys this model knows about
58
- def self.acceptable_attributes
59
- acceptable_attribute_map.values
60
- end
61
-
62
- # Attribute type mapping.
63
- def self.openapi_types
64
- {
65
- :'error' => :'String',
66
- :'code' => :'String'
67
- }
68
- end
69
-
70
- # List of attributes with nullable: true
71
- def self.openapi_nullable
72
- Set.new([
73
- ])
74
- end
75
-
76
- # Initializes the object
77
- # @param [Hash] attributes Model attributes in the form of hash
78
- def initialize(attributes = {})
79
- if (!attributes.is_a?(Hash))
80
- fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CreateInboxConversation400Response` initialize method"
17
+ module CreateInboxConversation400Response
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'CreateInboxConversation400ResponseAnyOf',
23
+ :'WhatsAppTemplateLookupError'
24
+ ]
81
25
  end
82
26
 
83
- # check to see if the attribute exists and convert string to symbol for hash key
84
- acceptable_attribute_map = self.class.acceptable_attribute_map
85
- attributes = attributes.each_with_object({}) { |(k, v), h|
86
- if (!acceptable_attribute_map.key?(k.to_sym))
87
- fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CreateInboxConversation400Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of anyOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_any_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ return find_and_cast_into_type(klass, data)
41
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
42
+ end
88
43
  end
89
- h[k.to_sym] = v
90
- }
91
-
92
- if attributes.key?(:'error')
93
- self.error = attributes[:'error']
94
- end
95
44
 
96
- if attributes.key?(:'code')
97
- self.code = attributes[:'code']
45
+ openapi_any_of.include?(:AnyType) ? data : nil
98
46
  end
99
- end
100
-
101
- # Show invalid properties with the reasons. Usually used together with valid?
102
- # @return Array for valid properties with the reasons
103
- def list_invalid_properties
104
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
105
- invalid_properties = Array.new
106
- invalid_properties
107
- end
108
-
109
- # Check to see if the all the properties in the model are valid
110
- # @return true if the model is valid
111
- def valid?
112
- warn '[DEPRECATED] the `valid?` method is obsolete'
113
- code_validator = EnumAttributeValidator.new('String', ["PLATFORM_NOT_SUPPORTED", "PLATFORM_LIMITATION", "TEMPLATE_REQUIRED", "INVALID_TEMPLATE_PARAMS", "INVALID_TEMPLATE_BUTTON_PARAM", "INVALID_TEMPLATE_CARD_PARAM", "DIRECT_SEND_NOT_ELIGIBLE", "DIRECT_SEND_LIMITED", "DIRECT_SEND_BLOCKED"])
114
- return false unless code_validator.valid?(@code)
115
- true
116
- end
117
-
118
- # Custom attribute writer method checking allowed values (enum).
119
- # @param [Object] code Object to be assigned
120
- def code=(code)
121
- validator = EnumAttributeValidator.new('String', ["PLATFORM_NOT_SUPPORTED", "PLATFORM_LIMITATION", "TEMPLATE_REQUIRED", "INVALID_TEMPLATE_PARAMS", "INVALID_TEMPLATE_BUTTON_PARAM", "INVALID_TEMPLATE_CARD_PARAM", "DIRECT_SEND_NOT_ELIGIBLE", "DIRECT_SEND_LIMITED", "DIRECT_SEND_BLOCKED"])
122
- unless validator.valid?(code)
123
- fail ArgumentError, "invalid value for \"code\", must be one of #{validator.allowable_values}."
124
- end
125
- @code = code
126
- end
127
-
128
- # Checks equality by comparing each attribute.
129
- # @param [Object] Object to be compared
130
- def ==(o)
131
- return true if self.equal?(o)
132
- self.class == o.class &&
133
- error == o.error &&
134
- code == o.code
135
- end
136
47
 
137
- # @see the `==` method
138
- # @param [Object] Object to be compared
139
- def eql?(o)
140
- self == o
141
- end
142
-
143
- # Calculates hash code according to all attributes.
144
- # @return [Integer] Hash code
145
- def hash
146
- [error, code].hash
147
- end
148
-
149
- # Builds the object from hash
150
- # @param [Hash] attributes Model attributes in the form of hash
151
- # @return [Object] Returns the model itself
152
- def self.build_from_hash(attributes)
153
- return nil unless attributes.is_a?(Hash)
154
- attributes = attributes.transform_keys(&:to_sym)
155
- transformed_hash = {}
156
- openapi_types.each_pair do |key, type|
157
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
158
- transformed_hash["#{key}"] = nil
159
- elsif type =~ /\AArray<(.*)>/i
160
- # check to ensure the input is an array given that the attribute
161
- # is documented as an array but the input is not
162
- if attributes[attribute_map[key]].is_a?(Array)
163
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
48
+ private
49
+
50
+ SchemaMismatchError = Class.new(StandardError)
51
+
52
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
53
+ def find_and_cast_into_type(klass, data)
54
+ return if data.nil?
55
+
56
+ case klass.to_s
57
+ when 'Boolean'
58
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
59
+ when 'Float'
60
+ return data if data.instance_of?(Float)
61
+ when 'Integer'
62
+ return data if data.instance_of?(Integer)
63
+ when 'Time'
64
+ return Time.parse(data)
65
+ when 'Date'
66
+ return Date.iso8601(data)
67
+ when 'String'
68
+ return data if data.instance_of?(String)
69
+ when 'Object' # "type: object"
70
+ return data if data.instance_of?(Hash)
71
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
72
+ if data.instance_of?(Array)
73
+ sub_type = Regexp.last_match[:sub_type]
74
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
75
+ end
76
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
77
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
78
+ sub_type = Regexp.last_match[:sub_type]
79
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
80
+ end
81
+ else # model
82
+ const = Zernio.const_get(klass)
83
+ if const
84
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
85
+ model = const.build(data)
86
+ return model if model
87
+ else
88
+ # raise if data contains keys that are not known to the model
89
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
90
+ model = const.build_from_hash(data)
91
+ return model if model
92
+ end
164
93
  end
165
- elsif !attributes[attribute_map[key]].nil?
166
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
167
- end
168
- end
169
- new(transformed_hash)
170
- end
171
-
172
- # Returns the object in the form of hash
173
- # @return [Hash] Returns the object in the form of hash
174
- def to_hash
175
- hash = {}
176
- self.class.attribute_map.each_pair do |attr, param|
177
- value = self.send(attr)
178
- if value.nil?
179
- is_nullable = self.class.openapi_nullable.include?(attr)
180
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
181
94
  end
182
95
 
183
- hash[param] = _to_hash(value)
96
+ raise # if no match by now, raise
97
+ rescue
98
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
184
99
  end
185
- hash
186
100
  end
187
-
188
101
  end
189
102
 
190
103
  end
@@ -0,0 +1,190 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ class CreateInboxConversation400ResponseAnyOf < ApiModelBase
18
+ attr_accessor :error
19
+
20
+ attr_accessor :code
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'error' => :'error',
48
+ :'code' => :'code'
49
+ }
50
+ end
51
+
52
+ # Returns attribute mapping this model knows about
53
+ def self.acceptable_attribute_map
54
+ attribute_map
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ acceptable_attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'error' => :'String',
66
+ :'code' => :'String'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CreateInboxConversation400ResponseAnyOf` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CreateInboxConversation400ResponseAnyOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'error')
93
+ self.error = attributes[:'error']
94
+ end
95
+
96
+ if attributes.key?(:'code')
97
+ self.code = attributes[:'code']
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
105
+ invalid_properties = Array.new
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ warn '[DEPRECATED] the `valid?` method is obsolete'
113
+ code_validator = EnumAttributeValidator.new('String', ["PLATFORM_NOT_SUPPORTED", "PLATFORM_LIMITATION", "TEMPLATE_REQUIRED", "INVALID_TEMPLATE_PARAMS", "INVALID_TEMPLATE_BUTTON_PARAM", "INVALID_TEMPLATE_HEADER", "INVALID_TEMPLATE_CARD_PARAM", "DIRECT_SEND_NOT_ELIGIBLE", "DIRECT_SEND_LIMITED", "DIRECT_SEND_BLOCKED"])
114
+ return false unless code_validator.valid?(@code)
115
+ true
116
+ end
117
+
118
+ # Custom attribute writer method checking allowed values (enum).
119
+ # @param [Object] code Object to be assigned
120
+ def code=(code)
121
+ validator = EnumAttributeValidator.new('String', ["PLATFORM_NOT_SUPPORTED", "PLATFORM_LIMITATION", "TEMPLATE_REQUIRED", "INVALID_TEMPLATE_PARAMS", "INVALID_TEMPLATE_BUTTON_PARAM", "INVALID_TEMPLATE_HEADER", "INVALID_TEMPLATE_CARD_PARAM", "DIRECT_SEND_NOT_ELIGIBLE", "DIRECT_SEND_LIMITED", "DIRECT_SEND_BLOCKED"])
122
+ unless validator.valid?(code)
123
+ fail ArgumentError, "invalid value for \"code\", must be one of #{validator.allowable_values}."
124
+ end
125
+ @code = code
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ error == o.error &&
134
+ code == o.code
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [error, code].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ attributes = attributes.transform_keys(&:to_sym)
155
+ transformed_hash = {}
156
+ openapi_types.each_pair do |key, type|
157
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
158
+ transformed_hash["#{key}"] = nil
159
+ elsif type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[attribute_map[key]].is_a?(Array)
163
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
164
+ end
165
+ elsif !attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
167
+ end
168
+ end
169
+ new(transformed_hash)
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ if value.nil?
179
+ is_nullable = self.class.openapi_nullable.include?(attr)
180
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
181
+ end
182
+
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ end
189
+
190
+ end