Class: Notiflows::Resources::Topics
- Inherits:
-
Object
- Object
- Notiflows::Resources::Topics
- Defined in:
- lib/notiflows/resources/topics.rb,
lib/notiflows/resources/topics/subscriptions.rb
Defined Under Namespace
Classes: Subscriptions
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#delete(id, request_options: {}) ⇒ nil
Delete a topic and all its subscriptions.
-
#initialize(client:) ⇒ Topics
constructor
private
A new instance of Topics.
-
#list(after: nil, before: nil, limit: nil, request_options: {}) ⇒ Notiflows::Internal::CursorPage<Notiflows::Models::Topic>
Retrieve a paginated list of all topics in your project.
-
#retrieve(id, request_options: {}) ⇒ Notiflows::Models::Topic
Retrieve a topic by name.
Constructor Details
#initialize(client:) ⇒ Topics
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Topics.
85 86 87 88 |
# File 'lib/notiflows/resources/topics.rb', line 85 def initialize(client:) @client = client @subscriptions = Subscriptions.new(client: client) end |
Instance Attribute Details
#subscriptions ⇒ Notiflows::Resources::Topics::Subscriptions (readonly)
7 8 9 |
# File 'lib/notiflows/resources/topics.rb', line 7 def subscriptions @subscriptions end |
Instance Method Details
#delete(id, request_options: {}) ⇒ nil
Delete a topic and all its subscriptions.
Warning: This removes all user subscriptions to this topic. Users will need to re-subscribe if the topic is recreated.
73 74 75 76 77 78 79 80 |
# File 'lib/notiflows/resources/topics.rb', line 73 def delete(id, params = {}) @client.request( method: :delete, path: ["topics/%1$s", id], model: NilClass, options: params[:request_options] ) end |
#list(after: nil, before: nil, limit: nil, request_options: {}) ⇒ Notiflows::Internal::CursorPage<Notiflows::Models::Topic>
Retrieve a paginated list of all topics in your project.
Topics are used for pub/sub notification patterns. Users subscribe to topics, and you can run notiflows for all subscribers of a topic.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/notiflows/resources/topics.rb', line 47 def list(params = {}) parsed, = ::Notiflows::TopicListParams.dump_request(params) @client.request( method: :get, path: "topics", query: parsed, page: ::Notiflows::Internal::CursorPage, model: ::Notiflows::Topic, options: ) end |
#retrieve(id, request_options: {}) ⇒ Notiflows::Models::Topic
Retrieve a topic by name.
20 21 22 23 24 25 26 27 |
# File 'lib/notiflows/resources/topics.rb', line 20 def retrieve(id, params = {}) @client.request( method: :get, path: ["topics/%1$s", id], model: ::Notiflows::Topic, options: params[:request_options] ) end |