Class: Notisend::Resources::Organizations

Inherits:
Base
  • Object
show all
Defined in:
lib/notisend/resources/organizations.rb

Overview

Sender organizations: /email/organizations

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Notisend::Resources::Base

Instance Method Details

#create(name:, address:, country:, city:, phone:, zip:) ⇒ Object



7
8
9
# File 'lib/notisend/resources/organizations.rb', line 7

def create(name:, address:, country:, city:, phone:, zip:)
  client.post(email_path('organizations'), { name:, address:, country:, city:, phone:, zip: })
end

#currentObject



19
20
21
# File 'lib/notisend/resources/organizations.rb', line 19

def current
  client.get(email_path('organizations', 'current'))
end

#delete(id:) ⇒ Object



32
33
34
# File 'lib/notisend/resources/organizations.rb', line 32

def delete(id:)
  client.delete(email_path('organizations', id))
end

#get(id:) ⇒ Object



15
16
17
# File 'lib/notisend/resources/organizations.rb', line 15

def get(id:)
  client.get(email_path('organizations', id))
end

#list(page_number: nil, page_size: nil) ⇒ Object



11
12
13
# File 'lib/notisend/resources/organizations.rb', line 11

def list(page_number: nil, page_size: nil)
  paginated(email_path('organizations'), page_params(page_number:, page_size:))
end

#set_current(id:) ⇒ Object



23
24
25
# File 'lib/notisend/resources/organizations.rb', line 23

def set_current(id:)
  client.patch(email_path('organizations', id, 'current'))
end

#update(id:, name: nil, address: nil, country: nil, city: nil, phone: nil, zip: nil) ⇒ Object



27
28
29
30
# File 'lib/notisend/resources/organizations.rb', line 27

def update(id:, name: nil, address: nil, country: nil, city: nil, phone: nil, zip: nil)
  payload = { name:, address:, country:, city:, phone:, zip: }.compact
  client.patch(email_path('organizations', id), payload)
end