bgetting-hominid 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 [Brian Getting]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |s|
8
+ s.name = "hominid"
9
+ s.summary = "Hominid is a Rails GemPlugin for interacting with the Mailchimp API"
10
+ s.email = "brian@terra-firma-design.com"
11
+ s.homepage = "http://github.com/bgetting/hominid"
12
+ s.description = "Hominid is a Rails GemPlugin for interacting with the Mailchimp API"
13
+ s.authors = ["Brian Getting"]
14
+ end
15
+ rescue LoadError
16
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
17
+ end
18
+
19
+ desc 'Default: run unit tests.'
20
+ task :default => :test
21
+
22
+ desc 'Test the hominid plugin.'
23
+ Rake::TestTask.new(:test) do |t|
24
+ t.libs << 'lib'
25
+ t.libs << 'test'
26
+ t.pattern = 'test/**/*_test.rb'
27
+ t.verbose = true
28
+ end
29
+
30
+ desc 'Generate documentation for the hominid plugin.'
31
+ Rake::RDocTask.new(:rdoc) do |rdoc|
32
+ rdoc.rdoc_dir = 'rdoc'
33
+ rdoc.title = 'Hominid'
34
+ rdoc.options << '--line-numbers' << '--inline-source'
35
+ rdoc.rdoc_files.include('README')
36
+ rdoc.rdoc_files.include('lib/**/*.rb')
37
+ end
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 1
4
- :patch: 2
4
+ :patch: 3
data/hominid.gemspec ADDED
@@ -0,0 +1,49 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{hominid}
5
+ s.version = "1.1.3"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Brian Getting"]
9
+ s.date = %q{2009-07-08}
10
+ s.description = %q{Hominid is a Rails GemPlugin for interacting with the Mailchimp API}
11
+ s.email = %q{brian@terra-firma-design.com}
12
+ s.extra_rdoc_files = [
13
+ "README.textile"
14
+ ]
15
+ s.files = [
16
+ "MIT-LICENSE",
17
+ "README.textile",
18
+ "Rakefile",
19
+ "VERSION.yml",
20
+ "hominid.gemspec",
21
+ "hominid.yml.tpl",
22
+ "init.rb",
23
+ "install.rb",
24
+ "lib/hominid.rb",
25
+ "rails/init.rb",
26
+ "test/hominid_test.rb",
27
+ "test/test_helper.rb",
28
+ "uninstall.rb"
29
+ ]
30
+ s.homepage = %q{http://github.com/bgetting/hominid}
31
+ s.rdoc_options = ["--charset=UTF-8"]
32
+ s.require_paths = ["lib"]
33
+ s.rubygems_version = %q{1.3.4}
34
+ s.summary = %q{Hominid is a Rails GemPlugin for interacting with the Mailchimp API}
35
+ s.test_files = [
36
+ "test/hominid_test.rb",
37
+ "test/test_helper.rb"
38
+ ]
39
+
40
+ if s.respond_to? :specification_version then
41
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
45
+ else
46
+ end
47
+ else
48
+ end
49
+ end
data/hominid.yml.tpl ADDED
@@ -0,0 +1,24 @@
1
+ # Get your API key at http://admin.mailchimp.com/account/api/
2
+ development:
3
+ username:
4
+ password:
5
+ api_key:
6
+ send_goodbye: false
7
+ send_notify: false
8
+ double_opt: false
9
+
10
+ test:
11
+ username:
12
+ password:
13
+ api_key:
14
+ send_goodbye: false
15
+ send_notify: false
16
+ double_opt: false
17
+
18
+ production:
19
+ username:
20
+ password:
21
+ api_key:
22
+ send_goodbye: false
23
+ send_notify: false
24
+ double_opt: false
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require File.dirname(__FILE__) + "/rails/init"
data/install.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'fileutils'
2
+ monkeyBrains = File.dirname(__FILE__) + '/../../../config/hominid.yml'
3
+ FileUtils.cp File.dirname(__FILE__) + '/hominid.yml.tpl', monkeyBrains unless File.exist?(monkeyBrains)
4
+ puts IO.read(File.join(File.dirname(__FILE__), 'README'))
data/lib/hominid.rb CHANGED
@@ -5,14 +5,14 @@ class Hominid
5
5
  # MailChimp API Documentation: http://www.mailchimp.com/api/1.2/
6
6
  MAILCHIMP_API = "http://api.mailchimp.com/1.2/"
7
7
 
8
- def initialize
9
- load_monkey_brains
8
+ def initialize(config=nil)
9
+ load_monkey_brains(config)
10
10
  @chimpApi ||= XMLRPC::Client.new2(MAILCHIMP_API)
11
11
  return self
12
12
  end
13
13
 
14
- def load_monkey_brains
15
- config = YAML.load(File.open("#{RAILS_ROOT}/config/hominid.yml"))[RAILS_ENV].symbolize_keys
14
+ def load_monkey_brains(config)
15
+ config = YAML.load(File.open("#{RAILS_ROOT}/config/hominid.yml"))[RAILS_ENV].symbolize_keys unless config
16
16
  @chimpUsername = config[:username].to_s
17
17
  @chimpPassword = config[:password].to_s
18
18
  @api_key = config[:api_key]
@@ -277,10 +277,10 @@ class Hominid
277
277
  end
278
278
  end
279
279
 
280
- def subscribe(list_id, email, user_info = {}, email_type = "html", update_existing = true, replace_interests = true)
280
+ def subscribe(list_id, email, user_info = {}, email_type = "html", update_existing = true, replace_interests = true, double_opt_in = nil)
281
281
  # Subscribe a member
282
282
  begin
283
- @chimpApi.call("listSubscribe", @api_key, list_id, email, user_info, email_type, @double_opt, update_existing, replace_interests)
283
+ @chimpApi.call("listSubscribe", @api_key, list_id, email, user_info, email_type, double_opt_in || @double_opt, update_existing, replace_interests)
284
284
  rescue
285
285
  false
286
286
  end
data/rails/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'hominid'
data/uninstall.rb ADDED
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bgetting-hominid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Getting
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-28 00:00:00 -07:00
12
+ date: 2009-07-08 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,16 +22,23 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - README.textile
24
24
  files:
25
+ - MIT-LICENSE
25
26
  - README.textile
27
+ - Rakefile
26
28
  - VERSION.yml
29
+ - hominid.gemspec
30
+ - hominid.yml.tpl
31
+ - init.rb
32
+ - install.rb
27
33
  - lib/hominid.rb
34
+ - rails/init.rb
28
35
  - test/hominid_test.rb
29
36
  - test/test_helper.rb
30
- has_rdoc: true
37
+ - uninstall.rb
38
+ has_rdoc: false
31
39
  homepage: http://github.com/bgetting/hominid
32
40
  post_install_message:
33
41
  rdoc_options:
34
- - --inline-source
35
42
  - --charset=UTF-8
36
43
  require_paths:
37
44
  - lib
@@ -52,7 +59,8 @@ requirements: []
52
59
  rubyforge_project:
53
60
  rubygems_version: 1.2.0
54
61
  signing_key:
55
- specification_version: 2
62
+ specification_version: 3
56
63
  summary: Hominid is a Rails GemPlugin for interacting with the Mailchimp API
57
- test_files: []
58
-
64
+ test_files:
65
+ - test/hominid_test.rb
66
+ - test/test_helper.rb