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