Class: ActiveCampaignWrapper::Core::ListGateway
- Inherits:
-
Object
- Object
- ActiveCampaignWrapper::Core::ListGateway
- Defined in:
- lib/active_campaign_wrapper/core/list_gateway.rb
Instance Method Summary collapse
- #all(**params) ⇒ Object
- #create(params) ⇒ Object
- #delete(list_id) ⇒ Object
- #find(list_id) ⇒ Object
-
#initialize(client) ⇒ ListGateway
constructor
A new instance of ListGateway.
- #update(list_id, params) ⇒ Object
Constructor Details
#initialize(client) ⇒ ListGateway
Returns a new instance of ListGateway.
6 7 8 9 |
# File 'lib/active_campaign_wrapper/core/list_gateway.rb', line 6 def initialize(client) @client = client @config = client.config end |
Instance Method Details
#all(**params) ⇒ Object
11 12 13 |
# File 'lib/active_campaign_wrapper/core/list_gateway.rb', line 11 def all(**params) @config.get('/lists', query: params) end |
#create(params) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/active_campaign_wrapper/core/list_gateway.rb', line 15 def create(params) params = { list: params } @config.post( '/lists', body: ActiveCampaignWrapper::Helpers.normalize_body( params, ActiveCampaignWrapper::Api::List::Arguments::SNAKE_CASED[:create] ) ) end |
#delete(list_id) ⇒ Object
26 27 28 |
# File 'lib/active_campaign_wrapper/core/list_gateway.rb', line 26 def delete(list_id) @config.delete("/lists/#{list_id}") end |
#find(list_id) ⇒ Object
41 42 43 |
# File 'lib/active_campaign_wrapper/core/list_gateway.rb', line 41 def find(list_id) @config.get("/lists/#{list_id}") end |
#update(list_id, params) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/active_campaign_wrapper/core/list_gateway.rb', line 30 def update(list_id, params) params = { list: params } @config.put( "/lists/#{list_id}", body: ActiveCampaignWrapper::Helpers.normalize_body( params, ActiveCampaignWrapper::Api::List::Arguments::SNAKE_CASED[:create] ) ) end |