lib/hominid.rb in bgetting-hominid-1.1.2 vs lib/hominid.rb in bgetting-hominid-1.1.3

- old
+ new

@@ -3,18 +3,18 @@ class Hominid # MailChimp API Documentation: http://www.mailchimp.com/api/1.2/ MAILCHIMP_API = "http://api.mailchimp.com/1.2/" - def initialize - load_monkey_brains + def initialize(config=nil) + load_monkey_brains(config) @chimpApi ||= XMLRPC::Client.new2(MAILCHIMP_API) return self end - def load_monkey_brains - config = YAML.load(File.open("#{RAILS_ROOT}/config/hominid.yml"))[RAILS_ENV].symbolize_keys + def load_monkey_brains(config) + config = YAML.load(File.open("#{RAILS_ROOT}/config/hominid.yml"))[RAILS_ENV].symbolize_keys unless config @chimpUsername = config[:username].to_s @chimpPassword = config[:password].to_s @api_key = config[:api_key] @send_goodbye = config[:send_goodbye] @send_notify = config[:send_notify] @@ -275,13 +275,13 @@ rescue return nil end end - def subscribe(list_id, email, user_info = {}, email_type = "html", update_existing = true, replace_interests = true) + def subscribe(list_id, email, user_info = {}, email_type = "html", update_existing = true, replace_interests = true, double_opt_in = nil) # Subscribe a member begin - @chimpApi.call("listSubscribe", @api_key, list_id, email, user_info, email_type, @double_opt, update_existing, replace_interests) + @chimpApi.call("listSubscribe", @api_key, list_id, email, user_info, email_type, double_opt_in || @double_opt, update_existing, replace_interests) rescue false end end \ No newline at end of file