Class: Mailchimpv3::List
- Inherits:
-
Object
- Object
- Mailchimpv3::List
- Defined in:
- lib/mailchimpv3/list.rb
Instance Attribute Summary collapse
-
#campaign_defaults ⇒ Object
Returns the value of attribute campaign_defaults.
-
#contact ⇒ Object
Returns the value of attribute contact.
-
#email_type_option ⇒ Object
Returns the value of attribute email_type_option.
-
#id ⇒ Object
Returns the value of attribute id.
-
#master ⇒ Object
Returns the value of attribute master.
-
#member_count ⇒ Object
Returns the value of attribute member_count.
-
#name ⇒ Object
Returns the value of attribute name.
-
#permission_reminder ⇒ Object
Returns the value of attribute permission_reminder.
-
#saved ⇒ Object
Returns the value of attribute saved.
Instance Method Summary collapse
- #addmember(email_address, status) ⇒ Object
- #find(id, params = {fields: 'lists.id, lists.name, lists.contact, lists.permission_reminder,lists.campaign_defaults, lists.email_type_option,lists.stats.member_count'}) ⇒ Object
-
#initialize(master = nil, id = "", name = "", contact = {}, permission_reminder = "", campaign_defaults = {}, member_count = 0, email_type_option = true) ⇒ List
constructor
A new instance of List.
- #save ⇒ Object
Constructor Details
#initialize(master = nil, id = "", name = "", contact = {}, permission_reminder = "", campaign_defaults = {}, member_count = 0, email_type_option = true) ⇒ List
Returns a new instance of List.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mailchimpv3/list.rb', line 6 def initialize(master=nil,id="", name="", contact={}, ="", campaign_defaults={},member_count=0, email_type_option=true) @master = master @id = id @name = name @contact = contact = @campaign_defaults = campaign_defaults @email_type_option = email_type_option @member_count = member_count @saved = false end |
Instance Attribute Details
#campaign_defaults ⇒ Object
Returns the value of attribute campaign_defaults.
3 4 5 |
# File 'lib/mailchimpv3/list.rb', line 3 def campaign_defaults @campaign_defaults end |
#contact ⇒ Object
Returns the value of attribute contact.
3 4 5 |
# File 'lib/mailchimpv3/list.rb', line 3 def contact @contact end |
#email_type_option ⇒ Object
Returns the value of attribute email_type_option.
3 4 5 |
# File 'lib/mailchimpv3/list.rb', line 3 def email_type_option @email_type_option end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/mailchimpv3/list.rb', line 3 def id @id end |
#master ⇒ Object
Returns the value of attribute master.
3 4 5 |
# File 'lib/mailchimpv3/list.rb', line 3 def master @master end |
#member_count ⇒ Object
Returns the value of attribute member_count.
3 4 5 |
# File 'lib/mailchimpv3/list.rb', line 3 def member_count @member_count end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/mailchimpv3/list.rb', line 3 def name @name end |
#permission_reminder ⇒ Object
Returns the value of attribute permission_reminder.
3 4 5 |
# File 'lib/mailchimpv3/list.rb', line 3 def end |
#saved ⇒ Object
Returns the value of attribute saved.
3 4 5 |
# File 'lib/mailchimpv3/list.rb', line 3 def saved @saved end |
Instance Method Details
#addmember(email_address, status) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/mailchimpv3/list.rb', line 48 def addmember(email_address, status) response = @master.post("/lists/#{@id}/members", { :email_address => email_address, :status => status }) @member_count = @member_count + 1 response end |
#find(id, params = {fields: 'lists.id, lists.name, lists.contact, lists.permission_reminder,lists.campaign_defaults, lists.email_type_option,lists.stats.member_count'}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/mailchimpv3/list.rb', line 19 def find(id, params={fields: 'lists.id, lists.name, lists.contact, lists.permission_reminder,lists.campaign_defaults, lists.email_type_option,lists.stats.member_count'}) response = @master.get("/lists/#{id}", params) @id = response["id"] @name = response["name"] @contact = response["contact"] = response["permission_reminder"] @campaign_defaults = response["campaign_defaults"], @member_count = response["member_count"].to_i @email_type_option = ["email_type_option"] @saved = true self end |
#save ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/mailchimpv3/list.rb', line 35 def save() response = @master.post("/lists", { :name => @name, :contact => @contact, :permission_reminder => , :campaign_defaults => @campaign_defaults, :email_type_option => @email_type_option }) @saved = true @id = response["id"] self end |