Class: LetMeSendEmail::Resources::EmailTopics
- Defined in:
- lib/letmesendemail/resources/email_topics.rb
Overview
Email Topics API operations.
Instance Method Summary collapse
-
#create(name:, slug:, auto_subscribe: nil, public: nil, description: nil, domain_id: nil) ⇒ Models::Model
Creates an email topic.
-
#delete(id) ⇒ Models::Model
Deletes an email topic.
-
#get(id) ⇒ Models::Model
Retrieves an email topic.
-
#list(per_page: nil, after: nil, before: nil) ⇒ Models::Model
Lists one cursor page of email topics.
-
#update(id, name: nil, slug: nil, description: nil, public: nil, auto_subscribe: nil) ⇒ Models::Model
Updates an email topic.
Methods inherited from Base
Constructor Details
This class inherits a constructor from LetMeSendEmail::Resources::Base
Instance Method Details
#create(name:, slug:, auto_subscribe: nil, public: nil, description: nil, domain_id: nil) ⇒ Models::Model
Creates an email topic.
9 10 11 12 13 14 15 16 17 |
# File 'lib/letmesendemail/resources/email_topics.rb', line 9 def create(name:, slug:, auto_subscribe: nil, public: nil, description: nil, domain_id: nil) body = { name: name, slug: slug } body[:auto_subscribe] = auto_subscribe unless auto_subscribe.nil? body[:public] = public unless public.nil? body[:description] = description if description body[:domain] = { id: domain_id } if domain_id @client.request(:post, '/email-topics', body: body) end |
#delete(id) ⇒ Models::Model
Deletes an email topic.
48 49 50 |
# File 'lib/letmesendemail/resources/email_topics.rb', line 48 def delete(id) @client.request(:delete, path_for('email-topics', id)) end |
#get(id) ⇒ Models::Model
Retrieves an email topic.
28 29 30 |
# File 'lib/letmesendemail/resources/email_topics.rb', line 28 def get(id) @client.request(:get, path_for('email-topics', id)) end |
#list(per_page: nil, after: nil, before: nil) ⇒ Models::Model
Lists one cursor page of email topics.
21 22 23 |
# File 'lib/letmesendemail/resources/email_topics.rb', line 21 def list(per_page: nil, after: nil, before: nil) @client.request(:get, list_path('email-topics', per_page: per_page, after: after, before: before)) end |
#update(id, name: nil, slug: nil, description: nil, public: nil, auto_subscribe: nil) ⇒ Models::Model
Updates an email topic.
35 36 37 38 39 40 41 42 43 |
# File 'lib/letmesendemail/resources/email_topics.rb', line 35 def update(id, name: nil, slug: nil, description: nil, public: nil, auto_subscribe: nil) body = {} body[:name] = name if name body[:slug] = slug if slug body[:description] = description if description body[:public] = public unless public.nil? body[:auto_subscribe] = auto_subscribe unless auto_subscribe.nil? @client.request(:put, path_for('email-topics', id), body: body) end |