Class: SendpulseClient::Addressbook
- Inherits:
-
Object
- Object
- SendpulseClient::Addressbook
- Defined in:
- lib/sendpulse_client/addressbook.rb
Constant Summary collapse
- URL =
'/addressbooks'.freeze
Class Method Summary collapse
- .add_clients(book_id, clients) ⇒ Object
- .all ⇒ Object
- .clients(book_id, offset = '', limit = '') ⇒ Object
- .create(name) ⇒ Object
- .delete_clients(emails) ⇒ Object
- .get_client(book_id, email) ⇒ Object
Class Method Details
.add_clients(book_id, clients) ⇒ Object
25 26 27 28 |
# File 'lib/sendpulse_client/addressbook.rb', line 25 def add_clients(book_id, clients) emails = JSON.generate(clients) Connection.post_request("#{URL}/#{book_id}/emails", emails: emails) end |
.all ⇒ Object
8 9 10 |
# File 'lib/sendpulse_client/addressbook.rb', line 8 def all Connection.get_request(URL) end |
.clients(book_id, offset = '', limit = '') ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/sendpulse_client/addressbook.rb', line 16 def clients(book_id, offset = '', limit = '') params = { offset: offset, limit: limit } Connection.get_request("#{URL}/#{book_id}/emails", params) end |
.create(name) ⇒ Object
12 13 14 |
# File 'lib/sendpulse_client/addressbook.rb', line 12 def create(name) Connection.post_request(URL, bookName: name) end |
.delete_clients(emails) ⇒ Object
30 31 32 |
# File 'lib/sendpulse_client/addressbook.rb', line 30 def delete_clients(emails) Connection.delete_request("#{URL}/emails", emails: JSON.generate(emails)) end |
.get_client(book_id, email) ⇒ Object
34 35 36 |
# File 'lib/sendpulse_client/addressbook.rb', line 34 def get_client(book_id, email) Connection.get_request("#{URL}/#{book_id}/emails/#{email}") end |