Class: Mailchimp::Vip

Inherits:
Object
  • Object
show all
Defined in:
lib/mailchimp/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Vip

Returns a new instance of Vip.



1768
1769
1770
# File 'lib/mailchimp/api.rb', line 1768

def initialize(master)
    @master = master
end

Instance Attribute Details

#masterObject

Returns the value of attribute master.



1766
1767
1768
# File 'lib/mailchimp/api.rb', line 1766

def master
  @master
end

Instance Method Details

#activityArray

Retrieve all Activity (opens/clicks) for VIPs over the past 10 days

Returns:

  • (Array)

    structs for each activity recorded.

    • [String] action The action taken - either "open" or "click"
    • [String] timestamp The datetime the action occurred in GMT
    • [String] url IF the action is a click, the url that was clicked
    • [String] unique_id The campaign_id of the List the Member appears on
    • [String] title The campaign title
    • [String] list_name The name of the List the Member appears on
    • [String] list_id The id of the List the Member appears on
    • [String] email The email address of the member
    • [String] fname IF a FNAME merge field exists on the list, that value for the member
    • [String] lname IF a LNAME merge field exists on the list, that value for the member
    • [Int] member_rating the rating of the subscriber. This will be 1 - 5 as described here
    • [String] member_since the datetime the member was added and/or confirmed
    • [Hash] geo the geographic information if we have it. including:
      - [String] latitude the latitude
      - [String] longitude the longitude
      - [String] gmtoff GMT offset
      - [String] dstoff GMT offset during daylight savings (if DST not observered, will be same as gmtoff
      - [String] timezone the timezone we've place them in
      - [String] cc 2 digit ISO-3166 country code
      - [String] region generally state, province, or similar


1794
1795
1796
1797
# File 'lib/mailchimp/api.rb', line 1794

def activity()
    _params = {}
    return @master.call 'vip/activity', _params
end

#add(id, emails) ⇒ Hash

Add VIPs (previously called Golden Monkeys)

Parameters:

  • id (String)

    the list id to connect to. Get by calling lists/list()

  • emails (Array)

    an array of up to 50 email address structs to add, each with with one of the following keys

    • [String] email an email address - for new subscribers obviously this should be used
    • [String] euid the unique id for an email address (not list related) - the email "id" returned from listMemberInfo, Webhooks, Campaigns, etc.
    • [String] leid the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes

Returns:

  • (Hash)

    of data and success/error counts

    • [Int] success_count the number of successful adds
    • [Int] error_count the number of unsuccessful adds
    • [Array] errors array of error structs including:
      - [Hash] email whatever was passed in the email parameter
        - [String] email the email address added
        - [String] euid the email unique id
        - [String] leid the list member's truly unique id
      - [String] code the error code
      - [String] error the error message
      
    • [Array] data array of structs for each member added
      • [Hash] email whatever was passed in the email parameter
        • [String] email the email address added
        • [String] euid the email unique id
        • [String] leid the list member's truly unique id


1820
1821
1822
1823
# File 'lib/mailchimp/api.rb', line 1820

def add(id, emails)
    _params = {:id => id, :emails => emails}
    return @master.call 'vip/add', _params
end

#del(id, emails) ⇒ Hash

Remove VIPs - this does not affect list membership

Parameters:

  • id (String)

    the list id to connect to. Get by calling lists/list()

  • emails (Array)

    an array of up to 50 email address structs to remove, each with with one of the following keys

    • [String] email an email address - for new subscribers obviously this should be used
    • [String] euid the unique id for an email address (not list related) - the email "id" returned from listMemberInfo, Webhooks, Campaigns, etc.
    • [String] leid the list email id (previously called web_id) for a list-member-info type call. this doesn't change when the email address changes

Returns:

  • (Hash)

    of data and success/error counts

    • [Int] success_count the number of successful deletions
    • [Int] error_count the number of unsuccessful deletions
    • [Array] errors array of error structs including:
      - [Hash] email whatever was passed in the email parameter
        - [String] email the email address
        - [String] euid the email unique id
        - [String] leid the list member's truly unique id
      - [String] code the error code
      - [String] msg the error message
      
    • [Array] data array of structs for each member deleted
      • [Hash] email whatever was passed in the email parameter
        • [String] email the email address
        • [String] euid the email unique id
        • [String] leid the list member's truly unique id


1846
1847
1848
1849
# File 'lib/mailchimp/api.rb', line 1846

def del(id, emails)
    _params = {:id => id, :emails => emails}
    return @master.call 'vip/del', _params
end

#membersArray

Retrieve all Golden Monkey(s) for an account

Returns:

  • (Array)

    structs for each Golden Monkey, including:

    • [String] list_id The id of the List the Member appears on
    • [String] list_name The name of the List the Member appears on
    • [String] email The email address of the member
    • [String] fname IF a FNAME merge field exists on the list, that value for the member
    • [String] lname IF a LNAME merge field exists on the list, that value for the member
    • [Int] member_rating the rating of the subscriber. This will be 1 - 5 as described here
    • [String] member_since the datetime the member was added and/or confirmed


1860
1861
1862
1863
# File 'lib/mailchimp/api.rb', line 1860

def members()
    _params = {}
    return @master.call 'vip/members', _params
end