Class: Zernio::ValidateApi
- Inherits:
-
Object
- Object
- Zernio::ValidateApi
- Defined in:
- lib/zernio-sdk/api/validate_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ ValidateApi
constructor
A new instance of ValidateApi.
-
#validate_media(validate_media_request, opts = {}) ⇒ ValidateMedia200Response
Validate media URL Check if a media URL is accessible and return metadata (content type, file size) plus per-platform size limit comparisons.
-
#validate_media_with_http_info(validate_media_request, opts = {}) ⇒ Array<(ValidateMedia200Response, Integer, Hash)>
Validate media URL Check if a media URL is accessible and return metadata (content type, file size) plus per-platform size limit comparisons.
-
#validate_post(validate_post_request, opts = {}) ⇒ ValidatePost200Response
Validate post content Dry-run the full post validation pipeline without publishing.
-
#validate_post_length(validate_post_length_request, opts = {}) ⇒ ValidatePostLength200Response
Validate character count Check weighted character count per platform and whether the text is within each platform's limit.
-
#validate_post_length_with_http_info(validate_post_length_request, opts = {}) ⇒ Array<(ValidatePostLength200Response, Integer, Hash)>
Validate character count Check weighted character count per platform and whether the text is within each platform's limit.
-
#validate_post_with_http_info(validate_post_request, opts = {}) ⇒ Array<(ValidatePost200Response, Integer, Hash)>
Validate post content Dry-run the full post validation pipeline without publishing.
-
#validate_subreddit(name, opts = {}) ⇒ ValidateSubreddit200Response
Check subreddit existence Check if a subreddit exists and return basic info (title, subscriber count, NSFW status, post types allowed).
-
#validate_subreddit_with_http_info(name, opts = {}) ⇒ Array<(ValidateSubreddit200Response, Integer, Hash)>
Check subreddit existence Check if a subreddit exists and return basic info (title, subscriber count, NSFW status, post types allowed).
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ ValidateApi
Returns a new instance of ValidateApi.
19 20 21 |
# File 'lib/zernio-sdk/api/validate_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/zernio-sdk/api/validate_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#validate_media(validate_media_request, opts = {}) ⇒ ValidateMedia200Response
Validate media URL Check if a media URL is accessible and return metadata (content type, file size) plus per-platform size limit comparisons. Performs a HEAD request (with GET fallback) to detect content type and size. Rejects private/localhost URLs for SSRF protection. Platform limits are sourced from each platform's actual upload constraints.
27 28 29 30 |
# File 'lib/zernio-sdk/api/validate_api.rb', line 27 def validate_media(validate_media_request, opts = {}) data, _status_code, _headers = validate_media_with_http_info(validate_media_request, opts) data end |
#validate_media_with_http_info(validate_media_request, opts = {}) ⇒ Array<(ValidateMedia200Response, Integer, Hash)>
Validate media URL Check if a media URL is accessible and return metadata (content type, file size) plus per-platform size limit comparisons. Performs a HEAD request (with GET fallback) to detect content type and size. Rejects private/localhost URLs for SSRF protection. Platform limits are sourced from each platform's actual upload constraints.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/zernio-sdk/api/validate_api.rb', line 37 def validate_media_with_http_info(validate_media_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ValidateApi.validate_media ...' end # verify the required parameter 'validate_media_request' is set if @api_client.config.client_side_validation && validate_media_request.nil? fail ArgumentError, "Missing the required parameter 'validate_media_request' when calling ValidateApi.validate_media" end # resource path local_var_path = '/v1/tools/validate/media' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(validate_media_request) # return_type return_type = opts[:debug_return_type] || 'ValidateMedia200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"ValidateApi.validate_media", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ValidateApi#validate_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#validate_post(validate_post_request, opts = {}) ⇒ ValidatePost200Response
Validate post content Dry-run the full post validation pipeline without publishing. Catches issues like missing media for Instagram/TikTok/YouTube, hashtag limits, invalid thread formats, Facebook Reel requirements, and character limit violations. Accepts the same body as POST /v1/posts. Does NOT validate accounts, process media, or track usage. This is content-only validation. Returns errors for failures and warnings for near-limit content (>90% of character limit).
95 96 97 98 |
# File 'lib/zernio-sdk/api/validate_api.rb', line 95 def validate_post(validate_post_request, opts = {}) data, _status_code, _headers = validate_post_with_http_info(validate_post_request, opts) data end |
#validate_post_length(validate_post_length_request, opts = {}) ⇒ ValidatePostLength200Response
Validate character count Check weighted character count per platform and whether the text is within each platform's limit. Twitter/X uses weighted counting (URLs = 23 chars via t.co, emojis = 2 chars). All other platforms use plain character length. Returns counts and limits for all 15 supported platform variants.
163 164 165 166 |
# File 'lib/zernio-sdk/api/validate_api.rb', line 163 def validate_post_length(validate_post_length_request, opts = {}) data, _status_code, _headers = validate_post_length_with_http_info(validate_post_length_request, opts) data end |
#validate_post_length_with_http_info(validate_post_length_request, opts = {}) ⇒ Array<(ValidatePostLength200Response, Integer, Hash)>
Validate character count Check weighted character count per platform and whether the text is within each platform's limit. Twitter/X uses weighted counting (URLs = 23 chars via t.co, emojis = 2 chars). All other platforms use plain character length. Returns counts and limits for all 15 supported platform variants.
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/zernio-sdk/api/validate_api.rb', line 173 def validate_post_length_with_http_info(validate_post_length_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ValidateApi.validate_post_length ...' end # verify the required parameter 'validate_post_length_request' is set if @api_client.config.client_side_validation && validate_post_length_request.nil? fail ArgumentError, "Missing the required parameter 'validate_post_length_request' when calling ValidateApi.validate_post_length" end # resource path local_var_path = '/v1/tools/validate/post-length' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(validate_post_length_request) # return_type return_type = opts[:debug_return_type] || 'ValidatePostLength200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"ValidateApi.validate_post_length", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ValidateApi#validate_post_length\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#validate_post_with_http_info(validate_post_request, opts = {}) ⇒ Array<(ValidatePost200Response, Integer, Hash)>
Validate post content Dry-run the full post validation pipeline without publishing. Catches issues like missing media for Instagram/TikTok/YouTube, hashtag limits, invalid thread formats, Facebook Reel requirements, and character limit violations. Accepts the same body as POST /v1/posts. Does NOT validate accounts, process media, or track usage. This is content-only validation. Returns errors for failures and warnings for near-limit content (>90% of character limit).
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/zernio-sdk/api/validate_api.rb', line 105 def validate_post_with_http_info(validate_post_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ValidateApi.validate_post ...' end # verify the required parameter 'validate_post_request' is set if @api_client.config.client_side_validation && validate_post_request.nil? fail ArgumentError, "Missing the required parameter 'validate_post_request' when calling ValidateApi.validate_post" end # resource path local_var_path = '/v1/tools/validate/post' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(validate_post_request) # return_type return_type = opts[:debug_return_type] || 'ValidatePost200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"ValidateApi.validate_post", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ValidateApi#validate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#validate_subreddit(name, opts = {}) ⇒ ValidateSubreddit200Response
Check subreddit existence Check if a subreddit exists and return basic info (title, subscriber count, NSFW status, post types allowed). When accountId is provided, uses authenticated Reddit OAuth API with automatic token refresh (recommended). Falls back to Reddit's public JSON API, which may be unreliable from server IPs. Returns exists: false for private, banned, or nonexistent subreddits.
232 233 234 235 |
# File 'lib/zernio-sdk/api/validate_api.rb', line 232 def validate_subreddit(name, opts = {}) data, _status_code, _headers = validate_subreddit_with_http_info(name, opts) data end |
#validate_subreddit_with_http_info(name, opts = {}) ⇒ Array<(ValidateSubreddit200Response, Integer, Hash)>
Check subreddit existence Check if a subreddit exists and return basic info (title, subscriber count, NSFW status, post types allowed). When accountId is provided, uses authenticated Reddit OAuth API with automatic token refresh (recommended). Falls back to Reddit's public JSON API, which may be unreliable from server IPs. Returns exists: false for private, banned, or nonexistent subreddits.
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/zernio-sdk/api/validate_api.rb', line 243 def validate_subreddit_with_http_info(name, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ValidateApi.validate_subreddit ...' end # verify the required parameter 'name' is set if @api_client.config.client_side_validation && name.nil? fail ArgumentError, "Missing the required parameter 'name' when calling ValidateApi.validate_subreddit" end # resource path local_var_path = '/v1/tools/validate/subreddit' # query parameters query_params = opts[:query_params] || {} query_params[:'name'] = name query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ValidateSubreddit200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"ValidateApi.validate_subreddit", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ValidateApi#validate_subreddit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |