lib/mad_mimi/audience.rb in mad_mimi-0.0.1 vs lib/mad_mimi/audience.rb in mad_mimi-0.0.2
- old
+ new
@@ -1,9 +1,24 @@
require File.expand_path('../request', __FILE__)
+
module MadMimi #:nodoc
class Audience #:nodoc
include Request
+ # Search
+ #
+ # Performs an audience search and returns the up to the first 100 results.
+ #
+ # == Optional parameters are:
+ # * <tt>:query</tt> -- The query parameter can be any search criteria you can use in the interface. A common use would be to use this function to get all of a member’s details by sending the email address as the query.
+ # * <tt>:raw</tt> -- if you want to return all users, regardless of suppression status, add the raw=true parameter on the end of your query.
+ # * <tt>:add_list</tt> -- You can add the results of the search to a new or existing list by passing an additional add_list parameter with the name of the list.
+ #
+ # See {Search}[http://madmimi.com/developer/lists/search]
+ def search(options = {})
+ response = get('/audience_members/search.xml', options)
+ response ? response["audience"]["member"] : response
+ end
# Get Audience Members
#
# Returns audience members paged in XML format.
#
@@ -12,21 +27,21 @@
# * <tt>:per_page</tt> -- the number of audience members returned per page. Must be between 1 and 100
# * <tt>:order</tt> -- the ordering. Must be one of email, first_name, last_name and created_at
#
# See {Get Audience Members}[http://madmimi.com/developer/lists]
def members(options = {})
- members = get('/audience_members')
- members ? members["audience"]["member"] : members
+ response = get('/audience_members')
+ response ? response["audience"]["member"] : response
end
# Get all Audience Lists
#
# Returns all audience lists
#
# See {Get all Audience Lists}[http://madmimi.com/developer/lists/get-all-audience-lists]
def lists
- lists = get('/audience_lists/lists.xml')
- lists ? lists["lists"]["list"] : lists
+ response = get('/audience_lists/lists.xml')
+ response ? response["lists"]["list"] : response
end
# Add Audience List Membership
#
# This will add an existing member to a list or create a new audience member with that
\ No newline at end of file