gibbon 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gibbon might be problematic. Click here for more details.
- data/Gemfile +1 -0
- data/Gemfile.lock +5 -3
- data/README.markdown +8 -8
- data/VERSION +1 -1
- data/gibbon.gemspec +5 -2
- data/lib/gibbon.rb +1 -0
- data/test/test_gibbon.rb +17 -17
- metadata +26 -15
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
activesupport (3.0.9)
|
4
5
|
crack (0.1.8)
|
5
6
|
git (1.2.5)
|
6
|
-
httparty (0.7.
|
7
|
+
httparty (0.7.8)
|
7
8
|
crack (= 0.1.8)
|
8
9
|
jeweler (1.5.2)
|
9
10
|
bundler (~> 1.0.0)
|
10
11
|
git (>= 1.2.5)
|
11
12
|
rake
|
12
|
-
json (1.5.
|
13
|
+
json (1.5.3)
|
13
14
|
mocha (0.9.12)
|
14
|
-
rake (0.
|
15
|
+
rake (0.9.2)
|
15
16
|
rcov (0.9.9)
|
16
17
|
shoulda (2.11.3)
|
17
18
|
|
@@ -19,6 +20,7 @@ PLATFORMS
|
|
19
20
|
ruby
|
20
21
|
|
21
22
|
DEPENDENCIES
|
23
|
+
activesupport (>= 3.0.0)
|
22
24
|
bundler (~> 1.0.0)
|
23
25
|
httparty (> 0.6.0)
|
24
26
|
jeweler (~> 1.5.1)
|
data/README.markdown
CHANGED
@@ -5,7 +5,7 @@ Gibbon is a simple API wrapper for interacting with [MailChimp API](http://www.m
|
|
5
5
|
##Installation
|
6
6
|
|
7
7
|
$ gem install gibbon
|
8
|
-
|
8
|
+
|
9
9
|
##Requirements
|
10
10
|
|
11
11
|
A MailChimp account and API key. You can see your API keys [here](http://admin.mailchimp.com/account/api).
|
@@ -16,7 +16,7 @@ Create an instance of the API wrapper:
|
|
16
16
|
|
17
17
|
gb = Gibbon::API.new(api_key)
|
18
18
|
|
19
|
-
Fetching data is as simple as calling API methods directly on the wrapper object.
|
19
|
+
Fetching data is as simple as calling API methods directly on the wrapper object.
|
20
20
|
Check the API [documentation](http://www.mailchimp.com/api/1.3) for details.
|
21
21
|
|
22
22
|
### Fetching Campaigns
|
@@ -24,13 +24,13 @@ Check the API [documentation](http://www.mailchimp.com/api/1.3) for details.
|
|
24
24
|
For example, to fetch your first 100 campaigns (page 0):
|
25
25
|
|
26
26
|
campaigns = gb.campaigns({:start => 0, :limit => 100})
|
27
|
-
|
27
|
+
|
28
28
|
### Fetching Lists
|
29
29
|
|
30
30
|
Similarly, to fetch your first 100 lists:
|
31
31
|
|
32
32
|
lists = gb.lists({:start => 0, :limit=> 100})
|
33
|
-
|
33
|
+
|
34
34
|
### More Advanced Examples
|
35
35
|
|
36
36
|
Getting batch member information for subscribers looks like this:
|
@@ -40,7 +40,7 @@ Getting batch member information for subscribers looks like this:
|
|
40
40
|
or
|
41
41
|
|
42
42
|
info = gb.listMemberInfo({:id => list_id, :email_address => email_array})
|
43
|
-
|
43
|
+
|
44
44
|
Fetch open and click detail for recipients of a particular campaign:
|
45
45
|
|
46
46
|
email_stats = gb.campaign_email_stats_aim({:cid => campaign_id, :email_address => email_array})
|
@@ -57,8 +57,8 @@ Gibbon defaults to a 30 second timeout. You can optionally set your own timeout
|
|
57
57
|
|
58
58
|
### Notes
|
59
59
|
|
60
|
-
As of 0.1.6, gibbon uses ActiveSupport::JSON.decode(). This means code that checked for weird API responses (like "true"
|
61
|
-
on a successful call to "listSubscribe" or similar) will need to be tweaked to handle the boolean JSON.decode() returns
|
60
|
+
As of 0.1.6, gibbon uses ActiveSupport::JSON.decode(). This means code that checked for weird API responses (like "true"
|
61
|
+
on a successful call to "listSubscribe" or similar) will need to be tweaked to handle the boolean JSON.decode() returns
|
62
62
|
as opposed to the string the MailChimp API returns. I understand the extra dependency might be a pain for some.
|
63
63
|
|
64
64
|
##Thanks
|
@@ -66,7 +66,7 @@ as opposed to the string the MailChimp API returns. I understand the extra depen
|
|
66
66
|
* [Justin Ip](https://github.com/ippy04)
|
67
67
|
* [elshimone](https://github.com/elshimone)
|
68
68
|
* [jlxw](https://github.com/jlxw)
|
69
|
-
|
69
|
+
* [Jon McCartie](https://github.com/jmccartie)
|
70
70
|
* Rails for camelize gsub
|
71
71
|
|
72
72
|
##Copyrights
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
data/gibbon.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gibbon}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Amro Mousa"]
|
12
|
-
s.date = %q{2011-06-
|
12
|
+
s.date = %q{2011-06-25}
|
13
13
|
s.description = %q{Gibbon is a simple API wrapper for interacting with MailChimp API version 1.3.}
|
14
14
|
s.email = %q{amromousa@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -50,6 +50,7 @@ Gem::Specification.new do |s|
|
|
50
50
|
s.add_development_dependency(%q<json>, ["> 1.4.0"])
|
51
51
|
s.add_development_dependency(%q<httparty>, ["> 0.6.0"])
|
52
52
|
s.add_development_dependency(%q<mocha>, ["> 0.9.11"])
|
53
|
+
s.add_development_dependency(%q<activesupport>, [">= 3.0.0"])
|
53
54
|
s.add_runtime_dependency(%q<httparty>, ["> 0.6.0"])
|
54
55
|
s.add_runtime_dependency(%q<activesupport>, ["> 3.0.0"])
|
55
56
|
s.add_runtime_dependency(%q<json>, ["> 1.4.0"])
|
@@ -64,6 +65,7 @@ Gem::Specification.new do |s|
|
|
64
65
|
s.add_dependency(%q<json>, ["> 1.4.0"])
|
65
66
|
s.add_dependency(%q<httparty>, ["> 0.6.0"])
|
66
67
|
s.add_dependency(%q<mocha>, ["> 0.9.11"])
|
68
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
67
69
|
s.add_dependency(%q<httparty>, ["> 0.6.0"])
|
68
70
|
s.add_dependency(%q<activesupport>, ["> 3.0.0"])
|
69
71
|
s.add_dependency(%q<json>, ["> 1.4.0"])
|
@@ -79,6 +81,7 @@ Gem::Specification.new do |s|
|
|
79
81
|
s.add_dependency(%q<json>, ["> 1.4.0"])
|
80
82
|
s.add_dependency(%q<httparty>, ["> 0.6.0"])
|
81
83
|
s.add_dependency(%q<mocha>, ["> 0.9.11"])
|
84
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
82
85
|
s.add_dependency(%q<httparty>, ["> 0.6.0"])
|
83
86
|
s.add_dependency(%q<activesupport>, ["> 3.0.0"])
|
84
87
|
s.add_dependency(%q<json>, ["> 1.4.0"])
|
data/lib/gibbon.rb
CHANGED
data/test/test_gibbon.rb
CHANGED
@@ -3,23 +3,23 @@ require 'helper'
|
|
3
3
|
class TestGibbon < Test::Unit::TestCase
|
4
4
|
|
5
5
|
context "build api url" do
|
6
|
-
|
6
|
+
|
7
7
|
setup do
|
8
8
|
@gibbon = Gibbon::API.new
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
should "handle empty api key" do
|
12
12
|
expect_post("https://api.mailchimp.com/1.3/?method=sayHello", {"apikey" => nil})
|
13
13
|
|
14
14
|
@gibbon.say_hello
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
should "handle timeout" do
|
18
18
|
expect_post("https://api.mailchimp.com/1.3/?method=sayHello", {"apikey" => nil}, 120)
|
19
19
|
@gibbon.timeout=120
|
20
20
|
@gibbon.say_hello
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
should "handle api key with dc" do
|
24
24
|
@gibbon.apikey="TESTKEY-us1"
|
25
25
|
expect_post("https://us1.api.mailchimp.com/1.3/?method=sayHello", {"apikey" => "TESTKEY-us1"})
|
@@ -27,7 +27,7 @@ class TestGibbon < Test::Unit::TestCase
|
|
27
27
|
@gibbon.say_hello
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
context "build api body" do
|
32
32
|
setup do
|
33
33
|
@key = "TESTKEY-us1"
|
@@ -39,36 +39,36 @@ class TestGibbon < Test::Unit::TestCase
|
|
39
39
|
expect_post(@url, {"apikey" => @key, "message" => "simon+says"})
|
40
40
|
@gibbon.say_hello(:message => "simon says")
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
should "escape string parameters in an array" do
|
44
44
|
expect_post(@url, {"apikey" => @key, "messages" => ["simon+says", "do+this"]})
|
45
45
|
@gibbon.say_hello(:messages => ["simon says", "do this"])
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
should "escape string parameters in a hash" do
|
49
49
|
expect_post(@url, {"apikey" => @key, "messages" => {"simon+says" => "do+this"}})
|
50
50
|
@gibbon.say_hello(:messages => {"simon says" => "do this"})
|
51
51
|
end
|
52
|
-
|
53
|
-
should "escape nested string parameters" do
|
52
|
+
|
53
|
+
should "escape nested string parameters" do
|
54
54
|
expect_post(@url, {"apikey" => @key, "messages" => {"simon+says" => ["do+this", "and+this"]}})
|
55
55
|
@gibbon.say_hello(:messages => {"simon says" => ["do this", "and this"]})
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
should "pass through non string parameters" do
|
59
59
|
expect_post(@url, {"apikey" => @key, "fee" => 99})
|
60
60
|
@gibbon.say_hello(:fee => 99)
|
61
|
-
end
|
62
|
-
|
61
|
+
end
|
62
|
+
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
private
|
66
|
-
|
66
|
+
|
67
67
|
def expect_post(expected_url, expected_body, expected_timeout=nil)
|
68
68
|
Gibbon::API.expects(:post).with do |url, opts|
|
69
|
-
url == expected_url &&
|
70
|
-
JSON.parse(opts[:body]) == expected_body &&
|
69
|
+
url == expected_url &&
|
70
|
+
JSON.parse(URI::decode(opts[:body])) == expected_body &&
|
71
71
|
opts[:timeout] == expected_timeout
|
72
72
|
end.returns(Struct.new(:body).new("") )
|
73
|
-
end
|
73
|
+
end
|
74
74
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gibbon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Amro Mousa
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-25 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -91,8 +91,19 @@ dependencies:
|
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: *id007
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
|
-
name:
|
94
|
+
name: activesupport
|
95
95
|
requirement: &id008 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 3.0.0
|
101
|
+
type: :development
|
102
|
+
prerelease: false
|
103
|
+
version_requirements: *id008
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: httparty
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
96
107
|
none: false
|
97
108
|
requirements:
|
98
109
|
- - ">"
|
@@ -100,10 +111,10 @@ dependencies:
|
|
100
111
|
version: 0.6.0
|
101
112
|
type: :runtime
|
102
113
|
prerelease: false
|
103
|
-
version_requirements: *
|
114
|
+
version_requirements: *id009
|
104
115
|
- !ruby/object:Gem::Dependency
|
105
116
|
name: activesupport
|
106
|
-
requirement: &
|
117
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
107
118
|
none: false
|
108
119
|
requirements:
|
109
120
|
- - ">"
|
@@ -111,10 +122,10 @@ dependencies:
|
|
111
122
|
version: 3.0.0
|
112
123
|
type: :runtime
|
113
124
|
prerelease: false
|
114
|
-
version_requirements: *
|
125
|
+
version_requirements: *id010
|
115
126
|
- !ruby/object:Gem::Dependency
|
116
127
|
name: json
|
117
|
-
requirement: &
|
128
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
118
129
|
none: false
|
119
130
|
requirements:
|
120
131
|
- - ">"
|
@@ -122,10 +133,10 @@ dependencies:
|
|
122
133
|
version: 1.4.0
|
123
134
|
type: :runtime
|
124
135
|
prerelease: false
|
125
|
-
version_requirements: *
|
136
|
+
version_requirements: *id011
|
126
137
|
- !ruby/object:Gem::Dependency
|
127
138
|
name: httparty
|
128
|
-
requirement: &
|
139
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
129
140
|
none: false
|
130
141
|
requirements:
|
131
142
|
- - ">"
|
@@ -133,10 +144,10 @@ dependencies:
|
|
133
144
|
version: 0.6.0
|
134
145
|
type: :development
|
135
146
|
prerelease: false
|
136
|
-
version_requirements: *
|
147
|
+
version_requirements: *id012
|
137
148
|
- !ruby/object:Gem::Dependency
|
138
149
|
name: json
|
139
|
-
requirement: &
|
150
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
140
151
|
none: false
|
141
152
|
requirements:
|
142
153
|
- - ">"
|
@@ -144,10 +155,10 @@ dependencies:
|
|
144
155
|
version: 1.4.0
|
145
156
|
type: :development
|
146
157
|
prerelease: false
|
147
|
-
version_requirements: *
|
158
|
+
version_requirements: *id013
|
148
159
|
- !ruby/object:Gem::Dependency
|
149
160
|
name: mocha
|
150
|
-
requirement: &
|
161
|
+
requirement: &id014 !ruby/object:Gem::Requirement
|
151
162
|
none: false
|
152
163
|
requirements:
|
153
164
|
- - ">"
|
@@ -155,7 +166,7 @@ dependencies:
|
|
155
166
|
version: 0.9.11
|
156
167
|
type: :development
|
157
168
|
prerelease: false
|
158
|
-
version_requirements: *
|
169
|
+
version_requirements: *id014
|
159
170
|
description: Gibbon is a simple API wrapper for interacting with MailChimp API version 1.3.
|
160
171
|
email: amromousa@gmail.com
|
161
172
|
executables: []
|
@@ -191,7 +202,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
191
202
|
requirements:
|
192
203
|
- - ">="
|
193
204
|
- !ruby/object:Gem::Version
|
194
|
-
hash: -
|
205
|
+
hash: -3319054220923287570
|
195
206
|
segments:
|
196
207
|
- 0
|
197
208
|
version: "0"
|