Class: Forem::Badge
- Inherits:
-
APIResource
- Object
- ForemObject
- APIResource
- Forem::Badge
- Extended by:
- APIOperations::Create, APIOperations::List, APIOperations::Retrieve, APIOperations::Update
- Includes:
- APIOperations::Delete, APIOperations::Save
- Defined in:
- lib/forem/resources/badge.rb
Overview
Represents a badge that can be awarded to users on a Forem instance.
Badges are awards that can be given to users. Badges support full CRUD operations.
Available operations (via mixins):
- +List+ — GET /api/badges
- +Create+ — POST /api/badges
- +Retrieve+ — GET /api/badges/:id
- +Update+ — PUT /api/badges/:id
- +Delete+ — class- and instance-level delete (DELETE /api/badges/:id)
- +Save+ — instance-level save (create or update)
Badge Fields
id(Integer) — Assigned by the API; not writabletitle(String) — Badge title; unique across the instanceslug(String) — Generated fromtitleby the API; not writabledescription(String) — Badge descriptionbadge_image(String) — Badge image URL; set on write withremote_badge_image_urlcredits_awarded(Integer) — Credits granted alongside the badgeallow_multiple_awards(Boolean) — Whether the badge can be awarded to the same user more than oncecreated_at/updated_at(String) — ISO 8601 timestamps; not writable
Authentication
All badge endpoints require an admin API key, reads included.
Pagination
list returns a fixed 50 records per page.
Constant Summary collapse
- OBJECT_NAME =
"badge"- RESOURCE_PATH =
"/api/badges"
Instance Attribute Summary
Attributes inherited from ForemObject
Method Summary
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 included from APIOperations::Delete
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