mcmailer 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/mcmailer.rb +25 -2
- data/test/test_mcmailer.rb +2 -1
- metadata +3 -3
data/lib/mcmailer.rb
CHANGED
@@ -1,6 +1,29 @@
|
|
1
1
|
require_relative './mcmailer/mailchimp_client'
|
2
2
|
require_relative './mcmailer/mailchimp_notification_handler'
|
3
3
|
|
4
|
-
|
5
|
-
VERSION = "0.0.
|
4
|
+
module Mcmailer
|
5
|
+
VERSION = "0.0.2"
|
6
|
+
|
7
|
+
@config = {}
|
8
|
+
@valid_config_keys = ['test', 'development', 'production']
|
9
|
+
|
10
|
+
def self.config
|
11
|
+
@config
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.configure(opts={})
|
15
|
+
opts.each {|k,v| @config[k] = v if @valid_config_keys.include? k}
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.configure_with(yaml_file_path)
|
19
|
+
begin
|
20
|
+
config = YAML.load_file(yaml_file_path)
|
21
|
+
rescue Errno::ENOENT
|
22
|
+
log(:error, "YAML configuration file couldn't be found!")
|
23
|
+
rescue Psych::SyntaxError
|
24
|
+
log(:error, "YAML configuration file contains invalid syntax!")
|
25
|
+
end
|
26
|
+
|
27
|
+
configure(config)
|
28
|
+
end
|
6
29
|
end
|
data/test/test_mcmailer.rb
CHANGED
@@ -4,7 +4,8 @@ require "uuid"
|
|
4
4
|
require "yaml"
|
5
5
|
|
6
6
|
describe MailchimpClient do
|
7
|
-
|
7
|
+
Mcmailer.configure_with(File.expand_path('../../config/mcmailer.yml', __FILE__))
|
8
|
+
MAILCHIMP = Mcmailer.config['test']
|
8
9
|
|
9
10
|
def client
|
10
11
|
@client ||= MailchimpClient.new(MAILCHIMP['api_key'], MAILCHIMP['timeout'])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mcmailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: uuid
|
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
110
|
version: '0'
|
111
111
|
segments:
|
112
112
|
- 0
|
113
|
-
hash:
|
113
|
+
hash: 423936270451881262
|
114
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
115
|
none: false
|
116
116
|
requirements:
|