class MaropostApi::Contacts
Public Class Methods
new(request:, parser: Parser::EntityParser.new)
click to toggle source
# File lib/maropost_api/contacts.rb, line 3 def initialize(request:, parser: Parser::EntityParser.new) @request = request @parser = parser end
Public Instance Methods
add_to_list(list_ids:, params:)
click to toggle source
# File lib/maropost_api/contacts.rb, line 13 def add_to_list(list_ids:, params:) response = @request.post(endpoint: "/contacts.json?list_ids=#{list_ids}", params: params) Response.new(response: response, parser: @parser).call end
create(params:)
click to toggle source
# File lib/maropost_api/contacts.rb, line 18 def create(params:) response = @request.post(endpoint: "/contacts.json", params: params) Response.new(response: response, parser: @parser).call end
Also aliased as: upsert
find_by_email(email:)
click to toggle source
# File lib/maropost_api/contacts.rb, line 8 def find_by_email(email:) response = @request.get(endpoint: "/contacts/email.json?contact[email]=#{CGI.escape(email)}") Response.new(response: response, parser: @parser).call end
unsubscribe_all_lists(email:)
click to toggle source
# File lib/maropost_api/contacts.rb, line 28 def unsubscribe_all_lists(email:) response = @request.put(endpoint: "/contacts/unsubscribe_all.json?contact[email]=#{CGI.escape(email)}") Response.new(response: response, parser: @parser).call end
update(contact_id:, params:)
click to toggle source
# File lib/maropost_api/contacts.rb, line 23 def update(contact_id:, params:) response = @request.put(endpoint: "/contacts/#{contact_id}.json", params: params) Response.new(response: response, parser: @parser).call end