Class: Forem::Services::SegmentService
- Inherits:
-
BaseService
- Object
- BaseService
- Forem::Services::SegmentService
- Defined in:
- lib/forem/services/segment_service.rb
Overview
Service for interacting with the Forem Segments API.
Segments are user-defined audience groups used for targeted content and billboard campaigns. Access via Client#segments. All methods inject the client's requestor automatically so no additional configuration is required.
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Forem::Segment
Create a new audience segment.
-
#delete(id, opts = {}) ⇒ nil
Delete an audience segment.
-
#list(params = {}, opts = {}) ⇒ Forem::ListObject<Forem::Segment>
List all audience segments.
-
#retrieve(id, opts = {}) ⇒ Segment
Retrieve a single audience segment by its numeric ID.
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from Forem::Services::BaseService
Instance Method Details
#create(params = {}, opts = {}) ⇒ Forem::Segment
Create a new audience segment.
The Forem API does not accept any parameters on this endpoint —
newly-created segments are always type_of: "manual" and do not
carry a name. Manage membership separately via Forem::Segment#add_users
and Forem::Segment#remove_users.
50 51 52 |
# File 'lib/forem/services/segment_service.rb', line 50 def create(params = {}, opts = {}) Segment.create(params, opts_with_requestor(opts)) end |
#delete(id, opts = {}) ⇒ nil
Delete an audience segment.
78 79 80 |
# File 'lib/forem/services/segment_service.rb', line 78 def delete(id, opts = {}) Segment.delete(id, opts_with_requestor(opts)) end |
#list(params = {}, opts = {}) ⇒ Forem::ListObject<Forem::Segment>
List all audience segments.
30 31 32 |
# File 'lib/forem/services/segment_service.rb', line 30 def list(params = {}, opts = {}) Segment.list(params, opts_with_requestor(opts)) end |