Class: PostForMe::Resources::SocialPosts

Inherits:
Object
  • Object
show all
Defined in:
lib/post_for_me/resources/social_posts.rb,
sig/post_for_me/resources/social_posts.rbs

Overview

Posts represent content that can be published across multiple social media platforms. Each post can have platform-specific content variations, allowing customization for different platforms and accounts. Content can be defined at three levels:

  1. Default content for all platforms
  2. Platform-specific content overrides
  3. Account-specific content overrides

The system will use the most specific content override available when publishing to each platform and account.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ SocialPosts

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SocialPosts.

Parameters:



173
174
175
# File 'lib/post_for_me/resources/social_posts.rb', line 173

def initialize(client:)
  @client = client
end

Instance Method Details

#create(caption:, social_accounts:, account_configurations: nil, external_id: nil, is_draft: nil, media: nil, platform_configurations: nil, scheduled_at: nil, request_options: {}) ⇒ PostForMe::Models::SocialPost

Some parameter documentations has been truncated, see Models::SocialPostCreateParams for more details.

Create Post

Parameters:

  • caption (String)

    Caption text for the post

  • social_accounts (Array<String>)

    Array of social account IDs for posting

  • account_configurations (Array<PostForMe::Models::AccountConfiguration>, nil)

    Account-specific configurations for the post

  • external_id (String, nil)

    Array of social account IDs for posting

  • is_draft (Boolean, nil)

    If isDraft is set then the post will not be processed

  • media (Array<PostForMe::Models::SocialPostMedia>, nil)

    Array of media associated with the post. If multiple media items are provided an

  • platform_configurations (PostForMe::Models::PlatformConfigurationsDto, nil)

    Platform-specific configurations for the post

  • scheduled_at (Time, nil)

    Scheduled date and time for the post, setting to null or undefined will post ins

  • request_options (PostForMe::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



45
46
47
48
49
50
51
52
53
54
# File 'lib/post_for_me/resources/social_posts.rb', line 45

def create(params)
  parsed, options = PostForMe::SocialPostCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/social-posts",
    body: parsed,
    model: PostForMe::SocialPost,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ PostForMe::Models::DeleteEntityResponse

Delete Post

Parameters:

Returns:

See Also:



161
162
163
164
165
166
167
168
# File 'lib/post_for_me/resources/social_posts.rb', line 161

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["v1/social-posts/%1$s", id],
    model: PostForMe::DeleteEntityResponse,
    options: params[:request_options]
  )
end

#list(external_id: nil, limit: nil, offset: nil, platform: nil, social_account_id: nil, status: nil, request_options: {}) ⇒ PostForMe::Models::SocialPostListResponse

Get a paginated result for posts based on the applied filters

Parameters:

  • external_id (Array<String>)

    Filter by external ID. Multiple values imply OR logic.

  • limit (Float)

    Number of items to return

  • offset (Float)

    Number of items to skip

  • platform (Array<Symbol, PostForMe::Models::SocialPostListParams::Platform>)

    Filter by platforms. Multiple values imply OR logic.

  • social_account_id (Array<String>)

    Filter by social account ID. Multiple values imply OR logic.

  • status (Array<Symbol, PostForMe::Models::SocialPostListParams::Status>)

    Filter by post status. Multiple values imply OR logic.

  • request_options (PostForMe::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



138
139
140
141
142
143
144
145
146
147
148
# File 'lib/post_for_me/resources/social_posts.rb', line 138

def list(params = {})
  parsed, options = PostForMe::SocialPostListParams.dump_request(params)
  query = PostForMe::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v1/social-posts",
    query: query,
    model: PostForMe::Models::SocialPostListResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ PostForMe::Models::SocialPost

Get Post by ID

Parameters:

Returns:

See Also:



67
68
69
70
71
72
73
74
# File 'lib/post_for_me/resources/social_posts.rb', line 67

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["v1/social-posts/%1$s", id],
    model: PostForMe::SocialPost,
    options: params[:request_options]
  )
end

#update(id, caption:, social_accounts:, account_configurations: nil, external_id: nil, is_draft: nil, media: nil, platform_configurations: nil, scheduled_at: nil, request_options: {}) ⇒ PostForMe::Models::SocialPost

Some parameter documentations has been truncated, see Models::SocialPostUpdateParams for more details.

Update Post

Parameters:

  • id (String)

    Post ID

  • caption (String)

    Caption text for the post

  • social_accounts (Array<String>)

    Array of social account IDs for posting

  • account_configurations (Array<PostForMe::Models::AccountConfiguration>, nil)

    Account-specific configurations for the post

  • external_id (String, nil)

    Array of social account IDs for posting

  • is_draft (Boolean, nil)

    If isDraft is set then the post will not be processed

  • media (Array<PostForMe::Models::SocialPostMedia>, nil)

    Array of media associated with the post. If multiple media items are provided an

  • platform_configurations (PostForMe::Models::PlatformConfigurationsDto, nil)

    Platform-specific configurations for the post

  • scheduled_at (Time, nil)

    Scheduled date and time for the post, setting to null or undefined will post ins

  • request_options (PostForMe::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



106
107
108
109
110
111
112
113
114
115
# File 'lib/post_for_me/resources/social_posts.rb', line 106

def update(id, params)
  parsed, options = PostForMe::SocialPostUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["v1/social-posts/%1$s", id],
    body: parsed,
    model: PostForMe::SocialPost,
    options: options
  )
end