Class: Forem::Billboard
- Inherits:
-
APIResource
- Object
- ForemObject
- APIResource
- Forem::Billboard
- Extended by:
- APIOperations::Create, APIOperations::List, APIOperations::Retrieve, APIOperations::Update
- Includes:
- APIOperations::Save
- Defined in:
- lib/forem/resources/billboard.rb
Overview
Represents a Forem billboard (display advertisement).
Billboards are configurable ad units shown to readers on a Forem instance.
They support full CRUD operations plus an unpublish action that reverts
a live billboard back to draft status. Managing billboards requires an
admin API key.
Available operations (via mixins):
- +List+ — GET /api/billboards
- +Create+ — POST /api/billboards
- +Retrieve+ — GET /api/billboards/:id
- +Update+ — PUT /api/billboards/:id
- +Save+ — instance-level save (create or update)
Billboard Fields
name(String) — Internal name to distinguish adsbody_markdown(String, required) — The ad content in markdownapproved(Boolean) — Must be both published AND approved to appear in rotationpublished(Boolean) — Must be both published AND approved to appear in rotationexpires_at(String) — ISO 8601 timestamp; automatically unapproved after this timeplacement_area(String) — Which area of the site layout the ad appears intag_list(String) — Tags on which the ad can display (blank = all tags)exclude_article_ids(String) — Comma-separated Article IDs where ad should NOT appearaudience_segment_id(Integer) — Target a specific audience segmentaudience_segment_type(String) — Must matchaudience_segment_idif both providedtarget_geolocations(Array) — ISO 3166-2 country/region codes (blank = all locations)display_to(String) — Limits which visitors see the adtype_of(String) — One of:"in_house"(admin-created),"community"(entity content),"external"(everywhere)
Constant Summary collapse
- OBJECT_NAME =
"billboard"- RESOURCE_PATH =
"/api/billboards"
Instance Attribute Summary
Attributes inherited from ForemObject
Instance Method Summary collapse
-
#unpublish(opts = {}) ⇒ ForemResponse
Unpublish this billboard, reverting it to draft/inactive status.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::Retrieve
Methods included from APIOperations::Update
Methods included from APIOperations::Save
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
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
Instance Method Details
#unpublish(opts = {}) ⇒ ForemResponse
Unpublish this billboard, reverting it to draft/inactive status.
Marks the billboard as unpublished. A billboard must be both published AND approved to appear in rotation.
Sends a PUT request to /api/billboards/:id/unpublish.
Requires admin privileges.
72 73 74 |
# File 'lib/forem/resources/billboard.rb', line 72 def unpublish(opts = {}) request(:put, "#{resource_url}/unpublish", {}, opts) end |