Class: ActiveCampaignWrapper::Core::ContactGateway
- Inherits:
-
Object
- Object
- ActiveCampaignWrapper::Core::ContactGateway
- Defined in:
- lib/active_campaign_wrapper/core/contact_gateway.rb
Instance Method Summary collapse
- #all(**params) ⇒ Object
- #bulk_import(params) ⇒ Object
- #create(params) ⇒ Object
- #delete(contact_id) ⇒ Object
- #find(contact_id) ⇒ Object
-
#initialize(client) ⇒ ContactGateway
constructor
A new instance of ContactGateway.
- #sync(params) ⇒ Object
- #update(contact_id, params) ⇒ Object
- #update_list_status(params) ⇒ Object
Constructor Details
#initialize(client) ⇒ ContactGateway
Returns a new instance of ContactGateway.
6 7 8 9 |
# File 'lib/active_campaign_wrapper/core/contact_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/contact_gateway.rb', line 11 def all(**params) @config.get('/contacts', query: params) end |
#bulk_import(params) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/active_campaign_wrapper/core/contact_gateway.rb', line 39 def bulk_import(params) @config.post( '/import/bulk_import', body: ActiveCampaignWrapper::Helpers.normalize_body( params, ActiveCampaignWrapper::Api::Contact::Arguments::SNAKE_CASED[:bulk_import] ) ) end |
#create(params) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/active_campaign_wrapper/core/contact_gateway.rb', line 15 def create(params) params = { contact: params } @config.post( '/contacts', body: ActiveCampaignWrapper::Helpers.normalize_body(params) ) end |
#delete(contact_id) ⇒ Object
49 50 51 |
# File 'lib/active_campaign_wrapper/core/contact_gateway.rb', line 49 def delete(contact_id) @config.delete("/contacts/#{contact_id}") end |
#find(contact_id) ⇒ Object
61 62 63 |
# File 'lib/active_campaign_wrapper/core/contact_gateway.rb', line 61 def find(contact_id) @config.get("/contacts/#{contact_id}") end |
#sync(params) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/active_campaign_wrapper/core/contact_gateway.rb', line 23 def sync(params) params = { contact: params } @config.post( '/contact/sync', body: ActiveCampaignWrapper::Helpers.normalize_body(params) ) end |
#update(contact_id, params) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/active_campaign_wrapper/core/contact_gateway.rb', line 53 def update(contact_id, params) params = { contact: params } @config.put( "/contacts/#{contact_id}", body: ActiveCampaignWrapper::Helpers.normalize_body(params) ) end |
#update_list_status(params) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/active_campaign_wrapper/core/contact_gateway.rb', line 31 def update_list_status(params) params = { contact_list: params } @config.post( '/contactLists', body: ActiveCampaignWrapper::Helpers.normalize_body(params) ) end |