madmimi 1.0.8 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -1
- data/VERSION +1 -1
- data/lib/madmimi.rb +1 -2
- data/madmimi.gemspec +16 -7
- data/test/fixtures/lists.xml +7 -0
- data/test/fixtures/promotions.xml +10 -0
- data/test/fixtures/search.xml +38 -0
- data/test/helper.rb +28 -0
- data/test/test_madmimi.rb +22 -2
- metadata +52 -8
data/Rakefile
CHANGED
@@ -10,7 +10,9 @@ begin
|
|
10
10
|
gem.email = "nicholas@madmimi.com"
|
11
11
|
gem.homepage = "http://github.com/madmimi/madmimi-gem"
|
12
12
|
gem.authors = ["Nicholas Young", "Marc Heiligers"]
|
13
|
-
gem.
|
13
|
+
gem.add_dependency "crack", "0.1.7"
|
14
|
+
gem.add_development_dependency "jeweler", "1.4.0"
|
15
|
+
gem.add_development_dependency "fakeweb", "1.2.8"
|
14
16
|
gem.add_development_dependency "shoulda", "2.10.3"
|
15
17
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
18
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.10
|
data/lib/madmimi.rb
CHANGED
data/madmimi.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{madmimi}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nicholas Young", "Marc Heiligers"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-31}
|
13
13
|
s.description = %q{Send emails, track statistics, and manage your subscriber base with ease.}
|
14
14
|
s.email = %q{nicholas@madmimi.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -24,13 +24,16 @@ Gem::Specification.new do |s|
|
|
24
24
|
"VERSION",
|
25
25
|
"lib/madmimi.rb",
|
26
26
|
"madmimi.gemspec",
|
27
|
+
"test/fixtures/lists.xml",
|
28
|
+
"test/fixtures/promotions.xml",
|
29
|
+
"test/fixtures/search.xml",
|
27
30
|
"test/helper.rb",
|
28
31
|
"test/test_madmimi.rb"
|
29
32
|
]
|
30
33
|
s.homepage = %q{http://github.com/madmimi/madmimi-gem}
|
31
34
|
s.rdoc_options = ["--charset=UTF-8"]
|
32
35
|
s.require_paths = ["lib"]
|
33
|
-
s.rubygems_version = %q{1.3.
|
36
|
+
s.rubygems_version = %q{1.3.7}
|
34
37
|
s.summary = %q{Mad Mimi API wrapper for Ruby}
|
35
38
|
s.test_files = [
|
36
39
|
"test/helper.rb",
|
@@ -41,15 +44,21 @@ Gem::Specification.new do |s|
|
|
41
44
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
42
45
|
s.specification_version = 3
|
43
46
|
|
44
|
-
if Gem::Version.new(Gem::
|
45
|
-
s.
|
47
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
|
+
s.add_runtime_dependency(%q<crack>, ["= 0.1.7"])
|
49
|
+
s.add_development_dependency(%q<jeweler>, ["= 1.4.0"])
|
50
|
+
s.add_development_dependency(%q<fakeweb>, ["= 1.2.8"])
|
46
51
|
s.add_development_dependency(%q<shoulda>, ["= 2.10.3"])
|
47
52
|
else
|
48
|
-
s.add_dependency(%q<crack>, ["
|
53
|
+
s.add_dependency(%q<crack>, ["= 0.1.7"])
|
54
|
+
s.add_dependency(%q<jeweler>, ["= 1.4.0"])
|
55
|
+
s.add_dependency(%q<fakeweb>, ["= 1.2.8"])
|
49
56
|
s.add_dependency(%q<shoulda>, ["= 2.10.3"])
|
50
57
|
end
|
51
58
|
else
|
52
|
-
s.add_dependency(%q<crack>, ["
|
59
|
+
s.add_dependency(%q<crack>, ["= 0.1.7"])
|
60
|
+
s.add_dependency(%q<jeweler>, ["= 1.4.0"])
|
61
|
+
s.add_dependency(%q<fakeweb>, ["= 1.2.8"])
|
53
62
|
s.add_dependency(%q<shoulda>, ["= 2.10.3"])
|
54
63
|
end
|
55
64
|
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<lists>
|
2
|
+
<list subscriber_count="0" name="Funky List" id="90920"/>
|
3
|
+
<list subscriber_count="0" name="New Test" id="90913"/>
|
4
|
+
<list subscriber_count="0" name="New Test List" id="93852"/>
|
5
|
+
<list subscriber_count="0" name="Other test" id="89621"/>
|
6
|
+
<list subscriber_count="0" name="Test List" id="88803"/>
|
7
|
+
</lists>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<promotions>
|
2
|
+
<promotion updated_at="Mon May 24 19:58:02 -0400 2010" mimio="1bee3" name="HTML Test" id="257713">
|
3
|
+
</promotion>
|
4
|
+
<promotion updated_at="Mon May 24 13:20:14 -0400 2010" mimio="69ce3" name="Untitled Promotion" id="257174">
|
5
|
+
<mailing id="1274713">
|
6
|
+
<started_send>Mon May 24 13:20:03 -0400 2010</started_send>
|
7
|
+
<finished_send>Mon May 24 13:20:06 -0400 2010</finished_send>
|
8
|
+
</mailing>
|
9
|
+
</promotion>
|
10
|
+
</promotions>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<audience>
|
2
|
+
<member suppressed="false">
|
3
|
+
<first_name></first_name>
|
4
|
+
<last_name></last_name>
|
5
|
+
<email>nicholas@madmimi.com</email>
|
6
|
+
<created_at>Mon May 24 13:19:59 -0400 2010</created_at>
|
7
|
+
<city></city>
|
8
|
+
<phone></phone>
|
9
|
+
<company></company>
|
10
|
+
<title></title>
|
11
|
+
<address></address>
|
12
|
+
<state></state>
|
13
|
+
<zip></zip>
|
14
|
+
<country></country>
|
15
|
+
<confirmed></confirmed>
|
16
|
+
<music></music>
|
17
|
+
<lists>
|
18
|
+
</lists>
|
19
|
+
</member>
|
20
|
+
<member suppressed="false">
|
21
|
+
<first_name></first_name>
|
22
|
+
<last_name></last_name>
|
23
|
+
<email>nicholas@nicholaswyoung.com</email>
|
24
|
+
<created_at>Mon May 24 20:17:30 -0400 2010</created_at>
|
25
|
+
<city></city>
|
26
|
+
<phone></phone>
|
27
|
+
<company></company>
|
28
|
+
<title></title>
|
29
|
+
<address></address>
|
30
|
+
<state></state>
|
31
|
+
<zip></zip>
|
32
|
+
<country></country>
|
33
|
+
<confirmed></confirmed>
|
34
|
+
<music></music>
|
35
|
+
<lists>
|
36
|
+
</lists>
|
37
|
+
</member>
|
38
|
+
</audience>
|
data/test/helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'test/unit'
|
3
3
|
require 'shoulda'
|
4
|
+
require 'fakeweb'
|
4
5
|
|
5
6
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
7
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
@@ -8,3 +9,30 @@ require 'madmimi'
|
|
8
9
|
|
9
10
|
class Test::Unit::TestCase
|
10
11
|
end
|
12
|
+
|
13
|
+
def fixture_file(filename)
|
14
|
+
return '' if filename == ''
|
15
|
+
file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
|
16
|
+
File.read(file_path)
|
17
|
+
end
|
18
|
+
|
19
|
+
def madmimi_url(url, https = false)
|
20
|
+
if https = false
|
21
|
+
url =~ /^http/ ? url : "http://api.madmimi.com#{url}"
|
22
|
+
else
|
23
|
+
url =~ /^https/ ? url : "https://api.madmimi.com#{url}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def stub_get(url, filename, status = nil)
|
28
|
+
options = { :body => fixture_file(filename) }
|
29
|
+
options.merge!({ :status => status }) unless status.nil?
|
30
|
+
FakeWeb.register_uri(:get, madmimi_url(url), options)
|
31
|
+
end
|
32
|
+
|
33
|
+
# In the process of tweaking this. - Nicholas
|
34
|
+
def stub_post(url, filename = nil, status = nil)
|
35
|
+
options = { :body => "" }
|
36
|
+
options.merge!({ :status => status }) unless status.nil?
|
37
|
+
FakeWeb.register_url(:get, madmimi_url(url), options)
|
38
|
+
end
|
data/test/test_madmimi.rb
CHANGED
@@ -1,7 +1,27 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
class TestMadmimi < Test::Unit::TestCase
|
4
|
-
|
5
|
-
|
4
|
+
context "A API call" do
|
5
|
+
setup do
|
6
|
+
@mimi = MadMimi.new('email@example.com', 'testapikey')
|
7
|
+
end
|
8
|
+
|
9
|
+
should "retrieve a hash of promotions" do
|
10
|
+
stub_get('/promotions.xml', 'promotions.xml')
|
11
|
+
response = @mimi.promotions
|
12
|
+
flunk unless response.kind_of?(Hash) || !response.empty?
|
13
|
+
end
|
14
|
+
|
15
|
+
should "retrieve a hash of lists" do
|
16
|
+
stub_get('/audience_lists/lists.xml', 'lists.xml')
|
17
|
+
response = @mimi.lists
|
18
|
+
flunk "Doesn't return any lists." unless response.kind_of?(Hash) || !response.empty?
|
19
|
+
end
|
20
|
+
|
21
|
+
should "retrieve a hash of users found with the search term nicholas" do
|
22
|
+
stub_get('/audience_members/search.xml?query=nicholas', 'search.xml')
|
23
|
+
response = @mimi.audience_search('nicholas')
|
24
|
+
flunk "No users found" unless response.kind_of?(Hash) || !response.empty?
|
25
|
+
end
|
6
26
|
end
|
7
27
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: madmimi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
9
|
+
- 10
|
10
|
+
version: 1.0.10
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Nicholas Young
|
@@ -15,37 +16,73 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-05-
|
19
|
+
date: 2010-05-31 00:00:00 -05:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: crack
|
23
24
|
prerelease: false
|
24
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
25
27
|
requirements:
|
26
|
-
- - "
|
28
|
+
- - "="
|
27
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 21
|
28
31
|
segments:
|
29
32
|
- 0
|
30
33
|
- 1
|
31
34
|
- 7
|
32
35
|
version: 0.1.7
|
33
|
-
type: :
|
36
|
+
type: :runtime
|
34
37
|
version_requirements: *id001
|
35
38
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
39
|
+
name: jeweler
|
37
40
|
prerelease: false
|
38
41
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - "="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 7
|
47
|
+
segments:
|
48
|
+
- 1
|
49
|
+
- 4
|
50
|
+
- 0
|
51
|
+
version: 1.4.0
|
52
|
+
type: :development
|
53
|
+
version_requirements: *id002
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: fakeweb
|
56
|
+
prerelease: false
|
57
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - "="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
hash: 15
|
63
|
+
segments:
|
64
|
+
- 1
|
65
|
+
- 2
|
66
|
+
- 8
|
67
|
+
version: 1.2.8
|
68
|
+
type: :development
|
69
|
+
version_requirements: *id003
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: shoulda
|
72
|
+
prerelease: false
|
73
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
39
75
|
requirements:
|
40
76
|
- - "="
|
41
77
|
- !ruby/object:Gem::Version
|
78
|
+
hash: 33
|
42
79
|
segments:
|
43
80
|
- 2
|
44
81
|
- 10
|
45
82
|
- 3
|
46
83
|
version: 2.10.3
|
47
84
|
type: :development
|
48
|
-
version_requirements: *
|
85
|
+
version_requirements: *id004
|
49
86
|
description: Send emails, track statistics, and manage your subscriber base with ease.
|
50
87
|
email: nicholas@madmimi.com
|
51
88
|
executables: []
|
@@ -63,6 +100,9 @@ files:
|
|
63
100
|
- VERSION
|
64
101
|
- lib/madmimi.rb
|
65
102
|
- madmimi.gemspec
|
103
|
+
- test/fixtures/lists.xml
|
104
|
+
- test/fixtures/promotions.xml
|
105
|
+
- test/fixtures/search.xml
|
66
106
|
- test/helper.rb
|
67
107
|
- test/test_madmimi.rb
|
68
108
|
has_rdoc: true
|
@@ -75,23 +115,27 @@ rdoc_options:
|
|
75
115
|
require_paths:
|
76
116
|
- lib
|
77
117
|
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
78
119
|
requirements:
|
79
120
|
- - ">="
|
80
121
|
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
81
123
|
segments:
|
82
124
|
- 0
|
83
125
|
version: "0"
|
84
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
85
128
|
requirements:
|
86
129
|
- - ">="
|
87
130
|
- !ruby/object:Gem::Version
|
131
|
+
hash: 3
|
88
132
|
segments:
|
89
133
|
- 0
|
90
134
|
version: "0"
|
91
135
|
requirements: []
|
92
136
|
|
93
137
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.3.
|
138
|
+
rubygems_version: 1.3.7
|
95
139
|
signing_key:
|
96
140
|
specification_version: 3
|
97
141
|
summary: Mad Mimi API wrapper for Ruby
|