module Convertkit::Client::Subscribers

Public Instance Methods

remove_tag_from_subscriber(subscriber_id, tag_id) click to toggle source
# File lib/convertkit/client/subscribers.rb, line 31
def remove_tag_from_subscriber(subscriber_id, tag_id)
  connection.delete("subscribers/#{subscriber_id}/tags/#{tag_id}")
end
subscriber(subscriber_id) click to toggle source
# File lib/convertkit/client/subscribers.rb, line 8
def subscriber(subscriber_id)
  connection.get("subscribers/#{subscriber_id}")
end
subscriber_tags(subscriber_id) click to toggle source
# File lib/convertkit/client/subscribers.rb, line 12
def subscriber_tags(subscriber_id)
  connection.get("subscribers/#{subscriber_id}/tags")
end
subscribers(options = {}) click to toggle source
# File lib/convertkit/client/subscribers.rb, line 4
def subscribers(options = {})
  connection.get("subscribers", options)
end
unsubscribe(email) click to toggle source
# File lib/convertkit/client/subscribers.rb, line 25
def unsubscribe(email)
  connection.put("unsubscribe") do |f|
    f.params['email'] = email
  end
end
update_subscriber(subscriber_id, options = {}) click to toggle source
# File lib/convertkit/client/subscribers.rb, line 16
def update_subscriber(subscriber_id, options = {})
  response = connection.put("subscribers/#{subscriber_id}") do |f|
    f.params["email_address"] = options[:email_address] if options[:email_address]
    f.params["fields"] = options[:fields] if options[:fields]
    f.params["first_name"] = options[:first_name] if options[:first_name]
  end
  response.body
end