Class: PostForMe::Resources::SocialAccounts
- Inherits:
-
Object
- Object
- PostForMe::Resources::SocialAccounts
- Defined in:
- lib/post_for_me/resources/social_accounts.rb,
sig/post_for_me/resources/social_accounts.rbs
Overview
Social accounts represent platform-specific accounts (e.g. Twitter, LinkedIn,
Facebook) that are used for publishing posts. Each social account has a unique
id that can be referenced when creating or scheduling posts to specify which
platforms the content should be published to.
Instance Method Summary collapse
-
#create(access_token:, access_token_expires_at:, platform:, user_id:, external_id: nil, metadata: nil, refresh_token: nil, refresh_token_expires_at: nil, username: nil, request_options: {}) ⇒ PostForMe::Models::SocialAccount
If a social account with the same platform and user_id already exists, it will be updated.
-
#create_auth_url(platform:, external_id: nil, permissions: nil, platform_data: nil, redirect_url_override: nil, request_options: {}) ⇒ PostForMe::Models::SocialAccountCreateAuthURLResponse
Some parameter documentations has been truncated, see Models::SocialAccountCreateAuthURLParams for more details.
-
#disconnect(id, request_options: {}) ⇒ PostForMe::Models::SocialAccountDisconnectResponse
Disconnecting an account with remove all auth tokens and mark the account as disconnected.
-
#initialize(client:) ⇒ SocialAccounts
constructor
private
A new instance of SocialAccounts.
-
#list(id: nil, external_id: nil, limit: nil, offset: nil, platform: nil, status: nil, username: nil, request_options: {}) ⇒ PostForMe::Models::SocialAccountListResponse
Some parameter documentations has been truncated, see Models::SocialAccountListParams for more details.
-
#retrieve(id, request_options: {}) ⇒ PostForMe::Models::SocialAccount
Get social account by ID.
-
#update(id, external_id: nil, username: nil, request_options: {}) ⇒ PostForMe::Models::SocialAccount
Update social account.
Constructor Details
#initialize(client:) ⇒ SocialAccounts
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 SocialAccounts.
197 198 199 |
# File 'lib/post_for_me/resources/social_accounts.rb', line 197 def initialize(client:) @client = client end |
Instance Method Details
#create(access_token:, access_token_expires_at:, platform:, user_id:, external_id: nil, metadata: nil, refresh_token: nil, refresh_token_expires_at: nil, username: nil, request_options: {}) ⇒ PostForMe::Models::SocialAccount
If a social account with the same platform and user_id already exists, it will be updated. If not, a new social account will be created.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/post_for_me/resources/social_accounts.rb', line 38 def create(params) parsed, = PostForMe::SocialAccountCreateParams.dump_request(params) @client.request( method: :post, path: "v1/social-accounts", body: parsed, model: PostForMe::SocialAccount, options: ) end |
#create_auth_url(platform:, external_id: nil, permissions: nil, platform_data: nil, redirect_url_override: nil, request_options: {}) ⇒ PostForMe::Models::SocialAccountCreateAuthURLResponse
Some parameter documentations has been truncated, see Models::SocialAccountCreateAuthURLParams for more details.
Generates a URL that initiates the authentication flow for a user's social media account. When visited, the user is redirected to the selected social platform's login/authorization page. Upon successful authentication, they are redirected back to your application.
For Quickstart projects using Post for Me system credentials,
redirect_url_override is not accepted. Configure the project redirect URL in
the dashboard instead.
162 163 164 165 166 167 168 169 170 171 |
# File 'lib/post_for_me/resources/social_accounts.rb', line 162 def create_auth_url(params) parsed, = PostForMe::SocialAccountCreateAuthURLParams.dump_request(params) @client.request( method: :post, path: "v1/social-accounts/auth-url", body: parsed, model: PostForMe::Models::SocialAccountCreateAuthURLResponse, options: ) end |
#disconnect(id, request_options: {}) ⇒ PostForMe::Models::SocialAccountDisconnectResponse
Disconnecting an account with remove all auth tokens and mark the account as disconnected. The record of the account will be kept and can be retrieved and reconnected by the owner of the account.
185 186 187 188 189 190 191 192 |
# File 'lib/post_for_me/resources/social_accounts.rb', line 185 def disconnect(id, params = {}) @client.request( method: :post, path: ["v1/social-accounts/%1$s/disconnect", id], model: PostForMe::Models::SocialAccountDisconnectResponse, options: params[:request_options] ) end |
#list(id: nil, external_id: nil, limit: nil, offset: nil, platform: nil, status: nil, username: nil, request_options: {}) ⇒ PostForMe::Models::SocialAccountListResponse
Some parameter documentations has been truncated, see Models::SocialAccountListParams for more details.
Get a paginated result for social accounts based on the applied filters
121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/post_for_me/resources/social_accounts.rb', line 121 def list(params = {}) parsed, = PostForMe::SocialAccountListParams.dump_request(params) query = PostForMe::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/social-accounts", query: query, model: PostForMe::Models::SocialAccountListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ PostForMe::Models::SocialAccount
Get social account by ID
60 61 62 63 64 65 66 67 |
# File 'lib/post_for_me/resources/social_accounts.rb', line 60 def retrieve(id, params = {}) @client.request( method: :get, path: ["v1/social-accounts/%1$s", id], model: PostForMe::SocialAccount, options: params[:request_options] ) end |
#update(id, external_id: nil, username: nil, request_options: {}) ⇒ PostForMe::Models::SocialAccount
Update social account
84 85 86 87 88 89 90 91 92 93 |
# File 'lib/post_for_me/resources/social_accounts.rb', line 84 def update(id, params = {}) parsed, = PostForMe::SocialAccountUpdateParams.dump_request(params) @client.request( method: :patch, path: ["v1/social-accounts/%1$s", id], body: parsed, model: PostForMe::SocialAccount, options: ) end |