late-sdk 0.0.855 → 0.0.857

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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -2
  3. data/docs/AdCampaignsApi.md +364 -6
  4. data/docs/{ListAdKeywords200ResponseKeywordsInner.md → AdKeyword.md} +7 -3
  5. data/docs/AdKeywordMetrics.md +30 -0
  6. data/docs/AddAdKeywords201Response.md +18 -0
  7. data/docs/AddAdKeywordsRequest.md +24 -0
  8. data/docs/AddAdKeywordsRequestKeywordsInner.md +20 -0
  9. data/docs/AddAdKeywordsRequestKeywordsInnerAnyOf.md +20 -0
  10. data/docs/ConnectApi.md +2 -2
  11. data/docs/CreatePostRequest.md +6 -6
  12. data/docs/CreateStandaloneAdRequest.md +4 -2
  13. data/docs/CreateTrackingTagRequest.md +3 -1
  14. data/docs/KeywordEntry.md +49 -0
  15. data/docs/ListAdKeywords200Response.md +1 -1
  16. data/docs/ListCampaignNegativeKeywords200Response.md +18 -0
  17. data/docs/ListCampaignNegativeKeywords200ResponseKeywordsInner.md +22 -0
  18. data/docs/PostsApi.md +1 -1
  19. data/docs/RemoveAdKeyword200Response.md +20 -0
  20. data/docs/ReplaceCampaignNegativeKeywords200Response.md +22 -0
  21. data/docs/ReplaceCampaignNegativeKeywordsRequest.md +20 -0
  22. data/docs/TrackingTagsApi.md +1 -1
  23. data/docs/UpdateAdKeyword200Response.md +18 -0
  24. data/docs/{UpdateAdStatusRequest.md → UpdateAdKeywordRequest.md} +2 -2
  25. data/docs/WebhooksApi.md +2 -2
  26. data/lib/zernio-sdk/api/ad_campaigns_api.rb +358 -9
  27. data/lib/zernio-sdk/api/connect_api.rb +2 -2
  28. data/lib/zernio-sdk/api/posts_api.rb +2 -2
  29. data/lib/zernio-sdk/api/tracking_tags_api.rb +2 -2
  30. data/lib/zernio-sdk/api/webhooks_api.rb +4 -4
  31. data/lib/zernio-sdk/models/{list_ad_keywords200_response_keywords_inner.rb → ad_keyword.rb} +28 -8
  32. data/lib/zernio-sdk/models/ad_keyword_metrics.rb +207 -0
  33. data/lib/zernio-sdk/models/add_ad_keywords201_response.rb +149 -0
  34. data/lib/zernio-sdk/models/add_ad_keywords_request.rb +250 -0
  35. data/lib/zernio-sdk/models/add_ad_keywords_request_keywords_inner.rb +103 -0
  36. data/lib/zernio-sdk/models/add_ad_keywords_request_keywords_inner_any_of.rb +225 -0
  37. data/lib/zernio-sdk/models/create_post_request.rb +6 -0
  38. data/lib/zernio-sdk/models/create_standalone_ad_request.rb +55 -5
  39. data/lib/zernio-sdk/models/create_tracking_tag_request.rb +48 -4
  40. data/lib/zernio-sdk/models/keyword_entry.rb +105 -0
  41. data/lib/zernio-sdk/models/list_ad_keywords200_response.rb +1 -1
  42. data/lib/zernio-sdk/models/list_campaign_negative_keywords200_response.rb +149 -0
  43. data/lib/zernio-sdk/models/list_campaign_negative_keywords200_response_keywords_inner.rb +199 -0
  44. data/lib/zernio-sdk/models/remove_ad_keyword200_response.rb +157 -0
  45. data/lib/zernio-sdk/models/replace_campaign_negative_keywords200_response.rb +170 -0
  46. data/lib/zernio-sdk/models/replace_campaign_negative_keywords_request.rb +219 -0
  47. data/lib/zernio-sdk/models/update_ad_keyword200_response.rb +147 -0
  48. data/lib/zernio-sdk/models/{update_ad_status_request.rb → update_ad_keyword_request.rb} +3 -3
  49. data/lib/zernio-sdk/version.rb +1 -1
  50. data/lib/zernio-sdk.rb +14 -2
  51. data/openapi.yaml +299 -32
  52. data/spec/api/ad_campaigns_api_spec.rb +64 -1
  53. data/spec/api/connect_api_spec.rb +1 -1
  54. data/spec/api/posts_api_spec.rb +1 -1
  55. data/spec/api/tracking_tags_api_spec.rb +1 -1
  56. data/spec/api/webhooks_api_spec.rb +2 -2
  57. data/spec/models/ad_keyword_metrics_spec.rb +72 -0
  58. data/spec/models/{list_ad_keywords200_response_keywords_inner_spec.rb → ad_keyword_spec.rb} +18 -6
  59. data/spec/models/add_ad_keywords201_response_spec.rb +36 -0
  60. data/spec/models/add_ad_keywords_request_keywords_inner_any_of_spec.rb +46 -0
  61. data/spec/models/add_ad_keywords_request_keywords_inner_spec.rb +21 -0
  62. data/spec/models/add_ad_keywords_request_spec.rb +54 -0
  63. data/spec/models/create_standalone_ad_request_spec.rb +6 -0
  64. data/spec/models/create_tracking_tag_request_spec.rb +10 -0
  65. data/spec/models/keyword_entry_spec.rb +32 -0
  66. data/spec/models/list_campaign_negative_keywords200_response_keywords_inner_spec.rb +52 -0
  67. data/spec/models/list_campaign_negative_keywords200_response_spec.rb +36 -0
  68. data/spec/models/remove_ad_keyword200_response_spec.rb +42 -0
  69. data/spec/models/replace_campaign_negative_keywords200_response_spec.rb +48 -0
  70. data/spec/models/replace_campaign_negative_keywords_request_spec.rb +46 -0
  71. data/spec/models/update_ad_keyword200_response_spec.rb +36 -0
  72. data/spec/models/{update_ad_status_request_spec.rb → update_ad_keyword_request_spec.rb} +6 -6
  73. data/zernio-sdk-0.0.857.gem +0 -0
  74. metadata +58 -10
  75. data/zernio-sdk-0.0.855.gem +0 -0
@@ -0,0 +1,250 @@
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 AddAdKeywordsRequest < ApiModelBase
18
+ # Social account ID (Google Ads)
19
+ attr_accessor :account_id
20
+
21
+ # Google ad group ID to add the keywords to
22
+ attr_accessor :ad_set_id
23
+
24
+ attr_accessor :keywords
25
+
26
+ # Add as ad-group-level negatives instead of positive keywords
27
+ attr_accessor :negative
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'account_id' => :'accountId',
33
+ :'ad_set_id' => :'adSetId',
34
+ :'keywords' => :'keywords',
35
+ :'negative' => :'negative'
36
+ }
37
+ end
38
+
39
+ # Returns attribute mapping this model knows about
40
+ def self.acceptable_attribute_map
41
+ attribute_map
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ acceptable_attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'account_id' => :'String',
53
+ :'ad_set_id' => :'String',
54
+ :'keywords' => :'Array<AddAdKeywordsRequestKeywordsInner>',
55
+ :'negative' => :'Boolean'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::AddAdKeywordsRequest` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ acceptable_attribute_map = self.class.acceptable_attribute_map
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!acceptable_attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::AddAdKeywordsRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'account_id')
82
+ self.account_id = attributes[:'account_id']
83
+ else
84
+ self.account_id = nil
85
+ end
86
+
87
+ if attributes.key?(:'ad_set_id')
88
+ self.ad_set_id = attributes[:'ad_set_id']
89
+ else
90
+ self.ad_set_id = nil
91
+ end
92
+
93
+ if attributes.key?(:'keywords')
94
+ if (value = attributes[:'keywords']).is_a?(Array)
95
+ self.keywords = value
96
+ end
97
+ else
98
+ self.keywords = nil
99
+ end
100
+
101
+ if attributes.key?(:'negative')
102
+ self.negative = attributes[:'negative']
103
+ else
104
+ self.negative = false
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
112
+ invalid_properties = Array.new
113
+ if @account_id.nil?
114
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
115
+ end
116
+
117
+ if @ad_set_id.nil?
118
+ invalid_properties.push('invalid value for "ad_set_id", ad_set_id cannot be nil.')
119
+ end
120
+
121
+ if @keywords.nil?
122
+ invalid_properties.push('invalid value for "keywords", keywords cannot be nil.')
123
+ end
124
+
125
+ if @keywords.length > 1000
126
+ invalid_properties.push('invalid value for "keywords", number of items must be less than or equal to 1000.')
127
+ end
128
+
129
+ if @keywords.length < 1
130
+ invalid_properties.push('invalid value for "keywords", number of items must be greater than or equal to 1.')
131
+ end
132
+
133
+ invalid_properties
134
+ end
135
+
136
+ # Check to see if the all the properties in the model are valid
137
+ # @return true if the model is valid
138
+ def valid?
139
+ warn '[DEPRECATED] the `valid?` method is obsolete'
140
+ return false if @account_id.nil?
141
+ return false if @ad_set_id.nil?
142
+ return false if @keywords.nil?
143
+ return false if @keywords.length > 1000
144
+ return false if @keywords.length < 1
145
+ true
146
+ end
147
+
148
+ # Custom attribute writer method with validation
149
+ # @param [Object] account_id Value to be assigned
150
+ def account_id=(account_id)
151
+ if account_id.nil?
152
+ fail ArgumentError, 'account_id cannot be nil'
153
+ end
154
+
155
+ @account_id = account_id
156
+ end
157
+
158
+ # Custom attribute writer method with validation
159
+ # @param [Object] ad_set_id Value to be assigned
160
+ def ad_set_id=(ad_set_id)
161
+ if ad_set_id.nil?
162
+ fail ArgumentError, 'ad_set_id cannot be nil'
163
+ end
164
+
165
+ @ad_set_id = ad_set_id
166
+ end
167
+
168
+ # Custom attribute writer method with validation
169
+ # @param [Object] keywords Value to be assigned
170
+ def keywords=(keywords)
171
+ if keywords.nil?
172
+ fail ArgumentError, 'keywords cannot be nil'
173
+ end
174
+
175
+ if keywords.length > 1000
176
+ fail ArgumentError, 'invalid value for "keywords", number of items must be less than or equal to 1000.'
177
+ end
178
+
179
+ if keywords.length < 1
180
+ fail ArgumentError, 'invalid value for "keywords", number of items must be greater than or equal to 1.'
181
+ end
182
+
183
+ @keywords = keywords
184
+ end
185
+
186
+ # Checks equality by comparing each attribute.
187
+ # @param [Object] Object to be compared
188
+ def ==(o)
189
+ return true if self.equal?(o)
190
+ self.class == o.class &&
191
+ account_id == o.account_id &&
192
+ ad_set_id == o.ad_set_id &&
193
+ keywords == o.keywords &&
194
+ negative == o.negative
195
+ end
196
+
197
+ # @see the `==` method
198
+ # @param [Object] Object to be compared
199
+ def eql?(o)
200
+ self == o
201
+ end
202
+
203
+ # Calculates hash code according to all attributes.
204
+ # @return [Integer] Hash code
205
+ def hash
206
+ [account_id, ad_set_id, keywords, negative].hash
207
+ end
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def self.build_from_hash(attributes)
213
+ return nil unless attributes.is_a?(Hash)
214
+ attributes = attributes.transform_keys(&:to_sym)
215
+ transformed_hash = {}
216
+ openapi_types.each_pair do |key, type|
217
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
218
+ transformed_hash["#{key}"] = nil
219
+ elsif type =~ /\AArray<(.*)>/i
220
+ # check to ensure the input is an array given that the attribute
221
+ # is documented as an array but the input is not
222
+ if attributes[attribute_map[key]].is_a?(Array)
223
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
224
+ end
225
+ elsif !attributes[attribute_map[key]].nil?
226
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
227
+ end
228
+ end
229
+ new(transformed_hash)
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ if value.nil?
239
+ is_nullable = self.class.openapi_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ end
249
+
250
+ end
@@ -0,0 +1,103 @@
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
+ module AddAdKeywordsRequestKeywordsInner
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'AddAdKeywordsRequestKeywordsInnerAnyOf',
23
+ :'String'
24
+ ]
25
+ end
26
+
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
43
+ end
44
+
45
+ openapi_any_of.include?(:AnyType) ? data : nil
46
+ end
47
+
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
93
+ end
94
+ end
95
+
96
+ raise # if no match by now, raise
97
+ rescue
98
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
99
+ end
100
+ end
101
+ end
102
+
103
+ end
@@ -0,0 +1,225 @@
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 AddAdKeywordsRequestKeywordsInnerAnyOf < ApiModelBase
18
+ attr_accessor :text
19
+
20
+ attr_accessor :match_type
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
+ :'text' => :'text',
48
+ :'match_type' => :'matchType'
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
+ :'text' => :'String',
66
+ :'match_type' => :'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::AddAdKeywordsRequestKeywordsInnerAnyOf` 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::AddAdKeywordsRequestKeywordsInnerAnyOf`. 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?(:'text')
93
+ self.text = attributes[:'text']
94
+ else
95
+ self.text = nil
96
+ end
97
+
98
+ if attributes.key?(:'match_type')
99
+ self.match_type = attributes[:'match_type']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
107
+ invalid_properties = Array.new
108
+ if @text.nil?
109
+ invalid_properties.push('invalid value for "text", text cannot be nil.')
110
+ end
111
+
112
+ if @text.to_s.length > 80
113
+ invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 80.')
114
+ end
115
+
116
+ if @text.to_s.length < 1
117
+ invalid_properties.push('invalid value for "text", the character length must be greater than or equal to 1.')
118
+ end
119
+
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ warn '[DEPRECATED] the `valid?` method is obsolete'
127
+ return false if @text.nil?
128
+ return false if @text.to_s.length > 80
129
+ return false if @text.to_s.length < 1
130
+ match_type_validator = EnumAttributeValidator.new('String', ["exact", "phrase", "broad"])
131
+ return false unless match_type_validator.valid?(@match_type)
132
+ true
133
+ end
134
+
135
+ # Custom attribute writer method with validation
136
+ # @param [Object] text Value to be assigned
137
+ def text=(text)
138
+ if text.nil?
139
+ fail ArgumentError, 'text cannot be nil'
140
+ end
141
+
142
+ if text.to_s.length > 80
143
+ fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 80.'
144
+ end
145
+
146
+ if text.to_s.length < 1
147
+ fail ArgumentError, 'invalid value for "text", the character length must be greater than or equal to 1.'
148
+ end
149
+
150
+ @text = text
151
+ end
152
+
153
+ # Custom attribute writer method checking allowed values (enum).
154
+ # @param [Object] match_type Object to be assigned
155
+ def match_type=(match_type)
156
+ validator = EnumAttributeValidator.new('String', ["exact", "phrase", "broad"])
157
+ unless validator.valid?(match_type)
158
+ fail ArgumentError, "invalid value for \"match_type\", must be one of #{validator.allowable_values}."
159
+ end
160
+ @match_type = match_type
161
+ end
162
+
163
+ # Checks equality by comparing each attribute.
164
+ # @param [Object] Object to be compared
165
+ def ==(o)
166
+ return true if self.equal?(o)
167
+ self.class == o.class &&
168
+ text == o.text &&
169
+ match_type == o.match_type
170
+ end
171
+
172
+ # @see the `==` method
173
+ # @param [Object] Object to be compared
174
+ def eql?(o)
175
+ self == o
176
+ end
177
+
178
+ # Calculates hash code according to all attributes.
179
+ # @return [Integer] Hash code
180
+ def hash
181
+ [text, match_type].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def self.build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+ attributes = attributes.transform_keys(&:to_sym)
190
+ transformed_hash = {}
191
+ openapi_types.each_pair do |key, type|
192
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
193
+ transformed_hash["#{key}"] = nil
194
+ elsif type =~ /\AArray<(.*)>/i
195
+ # check to ensure the input is an array given that the attribute
196
+ # is documented as an array but the input is not
197
+ if attributes[attribute_map[key]].is_a?(Array)
198
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
199
+ end
200
+ elsif !attributes[attribute_map[key]].nil?
201
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
202
+ end
203
+ end
204
+ new(transformed_hash)
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ end
224
+
225
+ end
@@ -21,18 +21,22 @@ module Zernio
21
21
  # Post caption/text. Optional when media is attached, all platforms have customContent, every platform entry is an X Article (platformSpecificData.article), or every platform entry is a LinkedIn text-free reshare (platformSpecificData.reshareUrl with no text). Required for other text-only posts.
22
22
  attr_accessor :content
23
23
 
24
+ # Media attached to every platform in the request (a platform entry can override it with `customMedia`). Each entry needs a publicly reachable HTTPS `url`; `type` (image, video, gif, document) is inferred from the URL extension when omitted and a `type` that contradicts the extension is rejected with 400. Upload files with `POST /v1/media/presign` first; per-platform size, duration and format limits are listed on each platform schema.
24
25
  attr_accessor :media_items
25
26
 
26
27
  # Target platforms and accounts for this post. Required for non-draft posts (returns 400 if empty). Drafts can omit platforms.
27
28
  attr_accessor :platforms
28
29
 
30
+ # When to publish. Required unless `publishNow` is true, `queuedFromProfile` is set, or the post is a draft. An ISO 8601 value with a `Z` or offset (`2026-01-15T10:00:00Z`, `2026-01-15T11:00:00+01:00`) is taken as-is; a value without one (`2026-01-15T10:00:00` or `2026-01-15 10:00`) is read as local time in `timezone`. A value already in the past is published synchronously in the same request. Ignored when `publishNow` is true.
29
31
  attr_accessor :scheduled_for
30
32
 
33
+ # Publish to every platform synchronously in this request instead of scheduling; the response then carries each platform result and `platformPostUrl`, with HTTP 207 when some platforms failed. Takes precedence over `scheduledFor`; ignored when `isDraft` is true.
31
34
  attr_accessor :publish_now
32
35
 
33
36
  # When true, saves the post as a draft. When none of scheduledFor, publishNow, or queuedFromProfile are provided, the post defaults to draft automatically.
34
37
  attr_accessor :is_draft
35
38
 
39
+ # IANA timezone (`Europe/Madrid`, `America/New_York`) used to interpret a `scheduledFor` (root or per-platform) that carries no `Z` or offset. Has no effect on values that already carry one. An unknown name returns 400 when `scheduledFor` is set.
36
40
  attr_accessor :timezone
37
41
 
38
42
  # Tags/keywords. YouTube constraints: each tag max 100 chars, combined max 500 chars, duplicates auto-removed.
@@ -44,8 +48,10 @@ module Zernio
44
48
  # Stored for reference only. This field does NOT automatically create @mentions when publishing. For LinkedIn @mentions, use the /v1/accounts/{accountId}/linkedin-mentions endpoint to resolve profile URLs to URNs, then embed the returned mentionFormat directly in the post content field.
45
49
  attr_accessor :mentions
46
50
 
51
+ # Stored on the post and echoed back on reads. Publishing does not branch on it: every entry in `platforms` is published regardless, so treat it as a label for your own tooling.
47
52
  attr_accessor :crossposting_enabled
48
53
 
54
+ # Free-form key/value pairs of your own, stored on the post and returned on reads and in webhook payloads. Zernio also writes the bookkeeping keys `usageCounted`, `usageRefunded` and `hidden` into this object; do not set them, and they are stripped from webhook payloads.
49
55
  attr_accessor :metadata
50
56
 
51
57
  # Root-level TikTok settings applied to the TikTok platforms sent in the same request. Merged into each platform's platformSpecificData, with platform-specific settings taking precedence.