Module: Fopost

Defined in:
lib/fopost.rb,
lib/fopost/model.rb,
lib/fopost/unset.rb,
lib/fopost/client.rb,
lib/fopost/errors.rb,
lib/fopost/models.rb,
lib/fopost/version.rb,
lib/fopost/platforms.rb,
lib/fopost/http/client.rb,
lib/fopost/resources/ai.rb,
lib/fopost/http/response.rb,
lib/fopost/http/transport.rb,
lib/fopost/resources/base.rb,
lib/fopost/resources/posts.rb,
lib/fopost/resources/labels.rb,
lib/fopost/resources/accounts.rb,
lib/fopost/resources/workspaces.rb,
lib/fopost/http/net_http_transport.rb

Overview

Official Ruby SDK for the FoPost API.

require 'fopost'

client = Fopost.new(api_key: 'fp_...')
workspace = client.workspaces.list.first
accounts = client.accounts.list(workspace_id: workspace.id)

post = client.posts.create(
workspace_id: workspace.id,
content: 'Hello from Ruby',
accounts: accounts.map(&:id)
)
client.posts.publish(post.id)

Defined Under Namespace

Modules: ErrorFactory, HTTP, Resources Classes: AiCreditBalance, AiCredits, AuthenticationError, CaptionResult, Client, ConfigurationError, ContentBlock, Delivery, Error, Label, MediaItem, Model, NotFoundError, Page, PageMeta, PaymentRequiredError, PermissionDeniedError, Post, PostAccount, RateLimitError, RepurposeResult, RewriteResult, RewriteVariant, SocialAccount, ValidationError, Workspace

Constant Summary collapse

DEFAULT_BASE_URL =
Client::DEFAULT_BASE_URL
UNSET =

Sentinel for "the caller did not pass this", so an explicit nil can still clear a field on a partial update.

Object.new
VERSION =
'0.1.0'
PLATFORMS =

Every platform the API can publish to. Model fields stay plain strings, so a platform added server-side still parses on an older SDK.

%w[
  twitter
  linkedin
  facebook
  instagram
  instagram-business
  telegram
  twitch
  discord
  slack
  reddit
  pinterest
  tumblr
  dribbble
  mewe
  tiktok
  youtube
  bluesky
  threads
  mastodon
  lemmy
  devto
  hashnode
  medium
  substack
  google-business
  kick
  listmonk
  wordpress
  nostr
  whop
  skool
].freeze
POST_STATUSES =
%w[
  draft
  pending_approval
  scheduled
  publishing
  published
  failed
  cancelled
].freeze

Class Method Summary collapse

Class Method Details

.new(**options) ⇒ Object

Shorthand for Fopost::Client.new.



33
34
35
# File 'lib/fopost.rb', line 33

def self.new(**options)
  Client.new(**options)
end