Class: Forem::Page

Overview

Represents a custom static page on a Forem instance.

Pages are CMS-style content pages on a Forem instance (e.g., about pages, code of conduct).

Pages are standalone content items (not articles) used for things like an "About" page, a "Code of Conduct", or any other informational page that lives at a dedicated URL on the community site. Full CRUD operations are available, but managing pages requires an admin API key.

Available operations (via mixins):

- +List+     — GET /api/pages
- +Create+   — POST /api/pages
- +Retrieve+ — GET /api/pages/:id
- +Update+   — PUT /api/pages/:id
- +Delete+   — instance-level delete (DELETE /api/pages/:id)
- +Save+     — instance-level save (create or update)

Examples:

List all pages

pages = client.pages.list
pages.each { |p| puts "#{p.slug}: #{p.title}" }

Create a new page (flat params — no page: wrapper)

page = client.pages.create(
  title: "About Us",
  slug: "about",
  body_markdown: "We are a community of developers.",
  is_top_level_path: true
)

Retrieve a page by ID

page = client.pages.retrieve(3)
puts page.title

Delete a page

page = client.pages.retrieve(3)
page.delete

See Also:

Constant Summary collapse

OBJECT_NAME =
"page"
RESOURCE_PATH =
"/api/pages"

Instance Attribute Summary

Attributes inherited from ForemObject

#requestor

Method Summary

Methods included from APIOperations::Create

create

Methods included from APIOperations::List

list

Methods included from APIOperations::Retrieve

retrieve

Methods included from APIOperations::Update

update

Methods included from APIOperations::Save

#save

Methods included from APIOperations::Delete

#delete, included

Methods inherited from APIResource

#refresh, resource_path, #resource_url

Methods inherited from ForemObject

#==, #[], #[]=, construct_from, cursor_list, #initialize, #inspect, #method_missing, paginated_list, #respond_to_missing?, #to_hash

Methods included from APIOperations::Request

included, #request

Constructor Details

This class inherits a constructor from Forem::ForemObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Forem::ForemObject