Class: Forem::BadgeAchievement
- Inherits:
-
APIResource
- Object
- ForemObject
- APIResource
- Forem::BadgeAchievement
- Extended by:
- APIOperations::Create, APIOperations::List, APIOperations::Retrieve
- Includes:
- APIOperations::Delete
- Defined in:
- lib/forem/resources/badge_achievement.rb
Overview
Represents a badge awarded to a specific user.
Creating a badge achievement awards a badge; deleting one revokes it. There is no update endpoint.
Available operations (via mixins):
- +List+ — GET /api/badge_achievements
- +Create+ — POST /api/badge_achievements
- +Retrieve+ — GET /api/badge_achievements/:id
- +Delete+ — class- and instance-level delete (DELETE /api/badge_achievements/:id)
BadgeAchievement Fields
id(Integer) — Assigned by the API; not writableuser_id(Integer) — The user the badge was awarded tobadge_id(Integer) — The badge that was awardedrewarder_id(Integer) — The awarding user; not writable, so alwaysnullon achievements created through the APIrewarding_context_message_markdown(String) — Message shown with the award, in markdownrewarding_context_message(String) — Rendered fromrewarding_context_message_markdownby the API; not writableinclude_default_description(Boolean) — Whether the badge description accompanies the messagemetadata(ForemObject) — Arbitrary key/value data supplied for context. Defaults to{}.created_at/updated_at(String) — ISO 8601 timestamps; not writable
Authentication
All badge achievement endpoints require an admin API key, reads included.
Pagination
list returns a fixed 50 records per page.
Constant Summary collapse
- OBJECT_NAME =
"badge_achievement"- RESOURCE_PATH =
"/api/badge_achievements"
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::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