module MailerLite::Clients::Subscribers

MailerLite Subscribers

Public Instance Methods

create_subscriber(params = {}) click to toggle source

Create subscriber

@see developers.mailerlite.com/v2/reference#create-a-subscriber

@param identifier [Integer,String] ID or email of subscriber. @param params [Hash] Params list. See more in MailerLite docs. @option options [String] :email Required. Email of new subscriber. @option options [String] :name Subscriber name.

@return [Hash] Response from API.

# File lib/mailerlite/clients/subscribers.rb, line 41
def create_subscriber(params = {})
  connection.post('subscribers', params)
end
search_subscribers(query, options = {}) click to toggle source

Search for subscribers

@see developers.mailerlite.com/v2/reference#search-for-subscribers

@param query [String] Search query @param options [Hash] A customizable set of options. @option options [Integer] :offset @option options [Integer] :limit @option options [Boolean] :minimized

@return [Array] Response from API.

# File lib/mailerlite/clients/subscribers.rb, line 73
def search_subscribers(query, options = {})
  options[:query] = query
  connection.get('subscribers/search', options)
end
subscriber(identifier) click to toggle source

Get single subscriber

@see developers.mailerlite.com/v2/reference#single-subscriber

@param identifier [Integer,String] ID or email of subscriber.

@return [Hash] Response from API.

# File lib/mailerlite/clients/subscribers.rb, line 27
def subscriber(identifier)
  connection.get("subscribers/#{identifier}")
end
subscriber_activities(identifier) click to toggle source

Get activity (clicks, opens, etc) of selected subscriber

@see developers.mailerlite.com/v2/reference#activity-of-single-subscriber

@param identifier [Integer,String] ID or email of subscriber.

@return [Array] Response from API.

# File lib/mailerlite/clients/subscribers.rb, line 96
def subscriber_activities(identifier)
  connection.get("subscribers/#{identifier}/activity")
end
Also aliased as: subscriber_activity
subscriber_activity(identifier)
subscriber_groups(identifier) click to toggle source

Get groups subscriber belongs to

@see developers.mailerlite.com/v2/reference#groups-subscriber-belongs-to

@param identifier [Integer,String] ID or email of subscriber.

@return [Array] Response from API.

# File lib/mailerlite/clients/subscribers.rb, line 85
def subscriber_groups(identifier)
  connection.get("subscribers/#{identifier}/groups")
end
subscribers(options = {}) click to toggle source

Get subscribers

@see developers.mailerlite.com/v2/reference#subscribers

@param options [Hash] Options list. See more in MailerLite docs. @option options [Integer] :offset @option options [Integer] :limit

@return [Hash] Response from API.

# File lib/mailerlite/clients/subscribers.rb, line 16
def subscribers(options = {})
  connection.get('subscribers', options)
end
update_subscriber(identifier, options = {}) click to toggle source

Update single subscriber

@see developers.mailerlite.com/v2/reference#update-subscriber

@param identifier [Integer,String] ID or email of subscriber. @param options [Hash] A customizable set of options. @option options [Array] :fields Associated array where key is the same

as field key.

@option options [String] :type Available values: unsubscribed, active @option options [Boolean] :resend_autoresponders Defines if it is

needed to resend autoresponders

@return [Hash] Response from API.

# File lib/mailerlite/clients/subscribers.rb, line 58
def update_subscriber(identifier, options = {})
  connection.put("subscribers/#{identifier}", options)
end