chimp_light 0.1

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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in chimp_light.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Alex Farrill
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,49 @@
1
+ # ChimpLight
2
+
3
+ A lightweight MailChimp API wrapper using libcurl
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'chimp_light'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install chimp_light
18
+
19
+ ## Usage
20
+
21
+ * Instantiate with your API key
22
+
23
+ $mail_chimp = ChimpLight::Api.new 'my_apikey'
24
+
25
+ * Now refer to the MailChimp API - http://apidocs.mailchimp.com/ and call any API command you need to like so:
26
+
27
+ $mail_chimp.listSubscribe :id => 'mylistid', :email_address => 'me@example.com'
28
+
29
+ ## Advanced configuration
30
+
31
+ * MailChimp API version - default is '1.3', to override:
32
+
33
+ $mail_chimp = ChimpLight::Api.new 'my_apikey', :version => '1.2'
34
+
35
+ * Data center - default is 'us1', to override:
36
+
37
+ $mail_chimp = ChimpLight::Api.new 'my_apikey', :dc => 'us2'
38
+
39
+ * SSL - default is off, to override:
40
+
41
+ $mail_chimp = ChimpLight::Api.new 'my_apikey', :ssl => true
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/chimp_light/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ['Alex Farrill']
6
+ gem.email = ['alex.farrill@gmail.com']
7
+ gem.description = %q{ A lightweight MailChimp API wrapper using libcurl }
8
+ gem.summary = %q{ A lightweight MailChimp API wrapper using libcurl }
9
+ gem.homepage = 'https://github.com/alexfarrill/chimp_light'
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = 'chimp_light'
15
+ gem.require_paths = ['lib']
16
+ gem.version = ChimpLight::VERSION
17
+
18
+ gem.add_dependency('curb', '>= 0.7.15')
19
+ end
@@ -0,0 +1,16 @@
1
+ module ChimpLight
2
+ class Api
3
+ def initialize( apikey, opts = {})
4
+ opts[:dc] ||= 'us1'
5
+ opts[:version] ||= '1.3'
6
+ opts[:protocol] = opts[:ssl] ? "https" : "http"
7
+
8
+ @apikey = apikey
9
+ @base_url = "%s://%s.api.mailchimp.com/%s/" % opts.values_at(:protocol, :dc, :version)
10
+ end
11
+
12
+ def method_missing(meth, opts = {})
13
+ Curl::Easy.http_post "%s?method=%s" % [@base_url, meth], CGI.escape( opts.reverse_merge( :apikey => @apikey ).to_json)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module ChimpLight
2
+ VERSION = '0.1'
3
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chimp_light
3
+ version: !ruby/object:Gem::Version
4
+ hash: 9
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ version: "0.1"
10
+ platform: ruby
11
+ authors:
12
+ - Alex Farrill
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-06-22 00:00:00 Z
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: curb
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 29
28
+ segments:
29
+ - 0
30
+ - 7
31
+ - 15
32
+ version: 0.7.15
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: " A lightweight MailChimp API wrapper using libcurl "
36
+ email:
37
+ - alex.farrill@gmail.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - LICENSE
48
+ - README.md
49
+ - Rakefile
50
+ - chimp_light.gemspec
51
+ - lib/chimp_light.rb
52
+ - lib/chimp_light/version.rb
53
+ homepage: https://github.com/alexfarrill/chimp_light
54
+ licenses: []
55
+
56
+ post_install_message:
57
+ rdoc_options: []
58
+
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ hash: 3
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirements: []
80
+
81
+ rubyforge_project:
82
+ rubygems_version: 1.8.24
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: A lightweight MailChimp API wrapper using libcurl
86
+ test_files: []
87
+