Module: Chimpactions::Setup

Defined in:
lib/chimpactions/setup.rb

Overview

Utility class for ensuring everythign is ready for Chimpactions to do its work

Constant Summary collapse

@@errors =
ActiveSupport::OrderedHash.new

Class Method Summary collapse

Class Method Details

.ensure_initializationObject

Make sure we have the right info to proceed.



9
10
11
12
13
14
15
# File 'lib/chimpactions/setup.rb', line 9

def self.ensure_initialization
  @@errors = ActiveSupport::OrderedHash.new
  self.error(:api_key, "Is not set!") if Chimpactions.mailchimp_api_key == "your_mailchimp_api_key" || Chimpactions.mailchimp_api_key.nil?
  self.error(:ses_key, "Is not set!") if Chimpactions.mailchimp_ses_key == "your_mailchimp_ses_key" || Chimpactions.mailchimp_ses_key.nil?
 # self.verify_api_key
  @@message = "Chimpactions::Setup.initialize"
end

.ok?Boolean

Were there errors in the setup ?

Returns:

  • (Boolean)


18
19
20
# File 'lib/chimpactions/setup.rb', line 18

def self.ok?
  errors.empty?
end

.verifyObject

Check the gibbon connection to MailChimp Verify that the API key is good.



24
25
26
27
28
29
30
31
# File 'lib/chimpactions/setup.rb', line 24

def self.verify
  begin
    Chimpactions.socket.chimpChatter()
  rescue Exception => e
    self.error(:api_key,"BAD API KEY::" << e.message)
    false
  end
end