mailee 0.2.0 → 0.2.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.
- data/VERSION +1 -1
- data/lib/mailee.rb +1 -1
- data/mailee.gemspec +7 -3
- data/spec/ar_spec_helper.rb +36 -0
- data/spec/mailee-api-ar.rb +42 -0
- data/spec/mailee-api.rb +24 -24
- data/spec/spec_helper.rb +1 -1
- metadata +8 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/mailee.rb
CHANGED
data/mailee.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mailee}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Juan Maiz"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-06}
|
13
13
|
s.description = %q{Permite sincronizar automaticamente seus modelos com o Mailee.me, inclusive com gerenciamento de optin.}
|
14
14
|
s.email = %q{suporte@mailee.me}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -31,6 +31,8 @@ Gem::Specification.new do |s|
|
|
31
31
|
"pkg/mailee-0.1.0.gem",
|
32
32
|
"pkg/mailee-0.1.1.gem",
|
33
33
|
"pkg/mailee-0.1.2.gem",
|
34
|
+
"spec/ar_spec_helper.rb",
|
35
|
+
"spec/mailee-api-ar.rb",
|
34
36
|
"spec/mailee-api.rb",
|
35
37
|
"spec/spec.opts",
|
36
38
|
"spec/spec_helper.rb",
|
@@ -42,7 +44,9 @@ Gem::Specification.new do |s|
|
|
42
44
|
s.rubygems_version = %q{1.3.7}
|
43
45
|
s.summary = %q{Gem de integração do Mailee.me}
|
44
46
|
s.test_files = [
|
45
|
-
"spec/
|
47
|
+
"spec/ar_spec_helper.rb",
|
48
|
+
"spec/mailee-api-ar.rb",
|
49
|
+
"spec/mailee-api.rb",
|
46
50
|
"spec/spec_helper.rb"
|
47
51
|
]
|
48
52
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'sqlite3'
|
4
|
+
require 'active_record'
|
5
|
+
require 'mailee'
|
6
|
+
require 'spec'
|
7
|
+
require 'spec/autorun'
|
8
|
+
|
9
|
+
Spec::Runner.configure do |config|
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
db = "mailee-api-test.db"
|
14
|
+
File.unlink(db) rescue nil
|
15
|
+
SQLite3::Database.new(db)
|
16
|
+
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => db)
|
17
|
+
|
18
|
+
ActiveRecord::Base.connection.create_table(:foos) do |t|
|
19
|
+
t.column :email, :string
|
20
|
+
t.column :name, :string
|
21
|
+
t.column :news, :boolean
|
22
|
+
end
|
23
|
+
|
24
|
+
ActiveRecord::Base.connection.create_table(:bars) do |t|
|
25
|
+
t.column :other_email, :string
|
26
|
+
t.column :other_name, :string
|
27
|
+
t.column :other_news, :boolean
|
28
|
+
end
|
29
|
+
|
30
|
+
class Foo < ActiveRecord::Base
|
31
|
+
sync_with_mailee
|
32
|
+
end
|
33
|
+
|
34
|
+
class Bar < ActiveRecord::Base
|
35
|
+
sync_with_mailee :email => :other_email, :name => :other_name, :news => :other_news
|
36
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/ar_spec_helper')
|
2
|
+
|
3
|
+
describe "Mailee" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
Mailee::Config.site = "http://api.bdb28c0a0a4a3.softa.server:3000"
|
7
|
+
@moment = Time.now.strftime('%Y%m%d%H%M%S')
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should create if news is checked" do
|
11
|
+
foo = Foo.create :name => "rest_test_foo_#{@moment}", :email => "rest_test_foo_#{@moment}@test.com", :news => true
|
12
|
+
found = Mailee::Contact.find_by_email("rest_test_foo_#{@moment}@test.com")
|
13
|
+
found.internal_id.to_i.should be foo.id
|
14
|
+
# ==
|
15
|
+
bar = Bar.create :other_name => "rest_test_bar_#{@moment}", :other_email => "rest_test_bar_#{@moment}@test.com", :other_news => true
|
16
|
+
found = Mailee::Contact.find_by_email("rest_test_bar_#{@moment}@test.com")
|
17
|
+
found.internal_id.to_i.should be bar.id
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should not create if news is not checked" do
|
21
|
+
foo = Foo.create :name => "rest_test_foo_#{@moment}", :email => "rest_test_foo_#{@moment}@test.com", :news => false
|
22
|
+
found = Mailee::Contact.find_by_email("rest_test_foo_#{@moment}@test.com")
|
23
|
+
found.should be nil
|
24
|
+
# ==
|
25
|
+
bar = Bar.create :other_name => "rest_test_bar_#{@moment}", :other_email => "rest_test_bar_#{@moment}@test.com", :other_news => false
|
26
|
+
found = Mailee::Contact.find_by_email("rest_test_bar_#{@moment}@test.com")
|
27
|
+
found.should be nil
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should create if news is updated" do
|
31
|
+
foo = Foo.create :name => "rest_test_foo_#{@moment}", :email => "rest_test_foo_#{@moment}@test.com", :news => false
|
32
|
+
foo.update_attribute :news, true
|
33
|
+
found = Mailee::Contact.find_by_email("rest_test_foo_#{@moment}@test.com")
|
34
|
+
found.internal_id.to_i.should be foo.id
|
35
|
+
# ==
|
36
|
+
bar = Bar.create :other_name => "rest_test_bar_#{@moment}", :other_email => "rest_test_bar_#{@moment}@test.com", :other_news => false
|
37
|
+
bar.update_attribute :other_news, true
|
38
|
+
found = Mailee::Contact.find_by_email("rest_test_bar_#{@moment}@test.com")
|
39
|
+
found.internal_id.to_i.should be bar.id
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
data/spec/mailee-api.rb
CHANGED
@@ -8,12 +8,12 @@ describe "Mailee" do
|
|
8
8
|
Mailee::Config.site = "http://api.bdb28c0a0a4a3.softa.server:3000"
|
9
9
|
@moment = Time.now.strftime('%Y%m%d%H%M%S')
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
it "should import (quick)" do
|
13
13
|
result = Mailee::Quick.create :contacts => "rest_test_#{@moment}@test.com\nrest_test_2_#{@moment}@test.com\nrest_test_3_#{@moment}@test.com"
|
14
|
-
result.
|
14
|
+
result.should_not be nil
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it "should have appropriate classes" do
|
18
18
|
Mailee.should
|
19
19
|
Mailee::Config.should
|
@@ -27,12 +27,12 @@ describe "Mailee" do
|
|
27
27
|
|
28
28
|
it "should get first contact" do
|
29
29
|
contact = Mailee::Contact.first
|
30
|
-
contact.id.
|
30
|
+
contact.id.should_not be nil
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should create contact" do
|
34
34
|
contact = Mailee::Contact.create :email => "rest_test_#{@moment}@test.com"
|
35
|
-
contact.id.
|
35
|
+
contact.id.should_not be nil
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should get all contacts" do
|
@@ -45,14 +45,14 @@ describe "Mailee" do
|
|
45
45
|
|
46
46
|
it "should create contact - and find by id" do
|
47
47
|
contact = Mailee::Contact.create :email => "rest_test_#{@moment}@test.com"
|
48
|
-
contact.id.
|
48
|
+
contact.id.should_not be nil
|
49
49
|
found_contact = Mailee::Contact.find(contact.id)
|
50
50
|
found_contact.id.should be(contact.id)
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should create contact - and find by internal_id" do
|
54
54
|
contact = Mailee::Contact.create :email => "rest_test_#{@moment}@test.com", :internal_id => @moment
|
55
|
-
contact.id.
|
55
|
+
contact.id.should_not be nil
|
56
56
|
contact.internal_id.should == @moment
|
57
57
|
contact = Mailee::Contact.find(:first, :params => { :internal_id => @moment })
|
58
58
|
contact.internal_id.should == @moment
|
@@ -60,38 +60,38 @@ describe "Mailee" do
|
|
60
60
|
|
61
61
|
it "should create contact - with dynamic attributes" do
|
62
62
|
contact = Mailee::Contact.create :email => "rest_test_#{@moment}@test.com", :dynamic_attributes => {:foo => 'bar'}
|
63
|
-
contact.id.
|
63
|
+
contact.id.should_not be nil
|
64
64
|
contact.dynamic_attributes.attributes['foo'].should == 'bar'
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should create list - and find by id" do
|
68
68
|
list = Mailee::List.create :name => "rest_test_#{@moment}"
|
69
|
-
list.id.
|
69
|
+
list.id.should_not be nil
|
70
70
|
list = Mailee::List.find(list.id)
|
71
|
-
list.id.
|
71
|
+
list.id.should_not be nil
|
72
72
|
end
|
73
73
|
|
74
74
|
it "should create contact - and subscribe" do
|
75
75
|
contact = Mailee::Contact.create :email => "rest_test_#{@moment}@test.com"
|
76
|
-
contact.put(:subscribe, :list => "rest_test_#{@moment}").
|
76
|
+
contact.put(:subscribe, :list => "rest_test_#{@moment}").should_not be nil
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should create contact - and unsubscribe" do
|
80
80
|
contact = Mailee::Contact.create :email => "rest_test_#{@moment}@test.com"
|
81
|
-
contact.put(:unsubscribe).
|
81
|
+
contact.put(:unsubscribe).should_not be nil
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should create message" do
|
85
85
|
list = Mailee::List.create :name => "rest_test_#{@moment}"
|
86
86
|
message = Mailee::Message.create :title => "rest_test_#{@moment}", :subject => "rest_test_#{@moment}", :from_name => "rest_test_#{@moment}", :from_email => "rest_test_#{@moment}@test.com", :html => "rest_test_#{@moment}", :list_id => list.id
|
87
|
-
message.id.
|
87
|
+
message.id.should_not be nil
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should create message - with emails" do
|
91
91
|
list = Mailee::List.create :name => "rest_test_#{@moment}"
|
92
92
|
message = Mailee::Message.create :title => "rest_test_#{@moment}", :subject => "rest_test_#{@moment}", :from_name => "rest_test_#{@moment}", :from_email => "rest_test_#{@moment}@test.com", :html => "rest_test_#{@moment}", :emails => 'foo@bar.com bar@foo.com'
|
93
93
|
#raise message.inspect
|
94
|
-
message.id.
|
94
|
+
message.id.should_not be nil
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should create, test and send message" do
|
@@ -99,20 +99,20 @@ describe "Mailee" do
|
|
99
99
|
contact = Mailee::Contact.create :email => "rest_test_#{@moment}@test.com"
|
100
100
|
contact.put(:subscribe, :list => list.name)
|
101
101
|
message = Mailee::Message.create :title => "rest_test_#{@moment}", :subject => "rest_test_#{@moment}", :from_name => "rest_test_#{@moment}", :from_email => "rest_test_#{@moment}@test.com", :html => "rest_test_#{@moment}", :list_id => list.id
|
102
|
-
message.put(:test, :contacts => [contact.id]).
|
103
|
-
message.put(:ready, :when => 'now').
|
102
|
+
message.put(:test, :contacts => [contact.id]).should_not be nil
|
103
|
+
message.put(:ready, :when => 'now').should_not be nil
|
104
104
|
end
|
105
105
|
|
106
106
|
# API specific methods
|
107
107
|
|
108
108
|
it "should create, subscribe and unsubscribe a contact" do
|
109
109
|
contact = Mailee::Contact.create :email => "rest_test_#{@moment}@test.com"
|
110
|
-
contact.subscribe("rest_test_#{@moment}").
|
111
|
-
contact.unsubscribe.
|
110
|
+
contact.subscribe("rest_test_#{@moment}").should_not be nil
|
111
|
+
contact.unsubscribe.should_not be nil
|
112
112
|
end
|
113
113
|
|
114
114
|
it "should search contacts" do
|
115
|
-
Mailee::Contact.search("rest_test").
|
115
|
+
Mailee::Contact.search("rest_test").should_not be nil
|
116
116
|
end
|
117
117
|
|
118
118
|
it "should create and find by internal id" do
|
@@ -132,8 +132,8 @@ describe "Mailee" do
|
|
132
132
|
contact = Mailee::Contact.create :email => "rest_test_#{@moment}@test.com"
|
133
133
|
contact.put(:subscribe, :list => list.name)
|
134
134
|
message = Mailee::Message.create :title => "rest_test_#{@moment}", :subject => "rest_test_#{@moment}", :from_name => "rest_test_#{@moment}", :from_email => "rest_test_#{@moment}@test.com", :html => "rest_test_#{@moment}", :list_id => list.id
|
135
|
-
message.test([contact.id]).
|
136
|
-
message.ready.
|
135
|
+
message.test([contact.id]).should_not be nil
|
136
|
+
message.ready.should_not be nil
|
137
137
|
end
|
138
138
|
|
139
139
|
it "should create, test and send after message - specific methods" do
|
@@ -141,11 +141,11 @@ describe "Mailee" do
|
|
141
141
|
contact = Mailee::Contact.create :email => "rest_test_#{@moment}@test.com"
|
142
142
|
contact.put(:subscribe, :list => list.name)
|
143
143
|
message = Mailee::Message.create :title => "rest_test_#{@moment}", :subject => "rest_test_#{@moment}", :from_name => "rest_test_#{@moment}", :from_email => "rest_test_#{@moment}@test.com", :html => "rest_test_#{@moment}", :list_id => list.id
|
144
|
-
message.test([contact.id]).
|
145
|
-
message.ready(10.days.from_now).
|
144
|
+
message.test([contact.id]).should_not be nil
|
145
|
+
message.ready(10.days.from_now).should_not be nil
|
146
146
|
end
|
147
147
|
|
148
|
-
it "should import (quick) - specific methods" do Mailee::Quick.import("rest_test_#{@moment}@test.com\nrest_test_2_#{@moment}@test.com\nrest_test_3_#{@moment}@test.com").
|
148
|
+
it "should import (quick) - specific methods" do Mailee::Quick.import("rest_test_#{@moment}@test.com\nrest_test_2_#{@moment}@test.com\nrest_test_3_#{@moment}@test.com").should_not be nil
|
149
149
|
end
|
150
150
|
|
151
151
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Juan Maiz
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-06 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -43,6 +43,8 @@ files:
|
|
43
43
|
- pkg/mailee-0.1.0.gem
|
44
44
|
- pkg/mailee-0.1.1.gem
|
45
45
|
- pkg/mailee-0.1.2.gem
|
46
|
+
- spec/ar_spec_helper.rb
|
47
|
+
- spec/mailee-api-ar.rb
|
46
48
|
- spec/mailee-api.rb
|
47
49
|
- spec/spec.opts
|
48
50
|
- spec/spec_helper.rb
|
@@ -82,5 +84,7 @@ signing_key:
|
|
82
84
|
specification_version: 3
|
83
85
|
summary: "Gem de integra\xC3\xA7\xC3\xA3o do Mailee.me"
|
84
86
|
test_files:
|
87
|
+
- spec/ar_spec_helper.rb
|
88
|
+
- spec/mailee-api-ar.rb
|
85
89
|
- spec/mailee-api.rb
|
86
90
|
- spec/spec_helper.rb
|