Class: ActiveCampaignWrapper::Core::UserGateway
- Inherits:
-
Object
- Object
- ActiveCampaignWrapper::Core::UserGateway
- Defined in:
- lib/active_campaign_wrapper/core/user_gateway.rb
Instance Method Summary collapse
- #all(**params) ⇒ Object
- #create(params) ⇒ Object
- #delete(user_id) ⇒ Object
- #find(user_id) ⇒ Object
- #find_by_email(email) ⇒ Object
- #find_by_username(username) ⇒ Object
-
#initialize(client) ⇒ UserGateway
constructor
A new instance of UserGateway.
- #logged_in ⇒ Object
- #update(user_id, params) ⇒ Object
Constructor Details
#initialize(client) ⇒ UserGateway
Returns a new instance of UserGateway.
6 7 8 9 |
# File 'lib/active_campaign_wrapper/core/user_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/user_gateway.rb', line 11 def all(**params) @config.get('/users', query: params) end |
#create(params) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/active_campaign_wrapper/core/user_gateway.rb', line 15 def create(params) params = { user: params } @config.post( '/users', body: ActiveCampaignWrapper::Helpers.normalize_body(params) ) end |
#delete(user_id) ⇒ Object
23 24 25 |
# File 'lib/active_campaign_wrapper/core/user_gateway.rb', line 23 def delete(user_id) @config.delete("/users/#{user_id}") end |
#find(user_id) ⇒ Object
35 36 37 |
# File 'lib/active_campaign_wrapper/core/user_gateway.rb', line 35 def find(user_id) @config.get("/users/#{user_id}") end |
#find_by_email(email) ⇒ Object
39 40 41 |
# File 'lib/active_campaign_wrapper/core/user_gateway.rb', line 39 def find_by_email(email) @config.get("/users/email/#{email}") end |
#find_by_username(username) ⇒ Object
43 44 45 |
# File 'lib/active_campaign_wrapper/core/user_gateway.rb', line 43 def find_by_username(username) @config.get("/users/username/#{username}") end |
#logged_in ⇒ Object
47 48 49 |
# File 'lib/active_campaign_wrapper/core/user_gateway.rb', line 47 def logged_in @config.get('/users/me') end |
#update(user_id, params) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/active_campaign_wrapper/core/user_gateway.rb', line 27 def update(user_id, params) params = { user: params } @config.put( "/users/#{user_id}", body: ActiveCampaignWrapper::Helpers.normalize_body(params) ) end |