Class: Posthubify::ToolsResource
- Inherits:
-
Object
- Object
- Posthubify::ToolsResource
- Defined in:
- lib/posthubify/resources/posts.rb
Overview
Validation tools — post-length/media/subreddit pre-checks (Node sdk .tools).
Instance Method Summary collapse
-
#initialize(http) ⇒ ToolsResource
constructor
A new instance of ToolsResource.
-
#validate_media(url) ⇒ Object
Media URL pre-check (accessibility/type/size; private network addresses are rejected).
-
#validate_post_length(text) ⇒ Object
Per-platform weighted character report (X: URL=23).
-
#validate_subreddit(subreddit) ⇒ Object
Whether the subreddit exists + basic info (subscriber count, NSFW, post type).
Constructor Details
#initialize(http) ⇒ ToolsResource
Returns a new instance of ToolsResource.
83 84 85 |
# File 'lib/posthubify/resources/posts.rb', line 83 def initialize(http) @http = http end |
Instance Method Details
#validate_media(url) ⇒ Object
Media URL pre-check (accessibility/type/size; private network addresses are rejected).
93 94 95 |
# File 'lib/posthubify/resources/posts.rb', line 93 def validate_media(url) @http.data('POST', '/tools/validate/media', body: { 'url' => url }) end |
#validate_post_length(text) ⇒ Object
Per-platform weighted character report (X: URL=23).
88 89 90 |
# File 'lib/posthubify/resources/posts.rb', line 88 def validate_post_length(text) @http.data('POST', '/tools/validate/post-length', body: { 'text' => text }) end |
#validate_subreddit(subreddit) ⇒ Object
Whether the subreddit exists + basic info (subscriber count, NSFW, post type).
98 99 100 |
# File 'lib/posthubify/resources/posts.rb', line 98 def validate_subreddit(subreddit) @http.data('GET', '/tools/validate/subreddit', query: { 'subreddit' => subreddit }) end |