dynect_email 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +4 -0
- data/.travis.yml +6 -0
- data/Gemfile +1 -1
- data/dynect_email.gemspec +3 -2
- data/lib/dynect_email.rb +42 -8
- data/lib/dynect_email/version.rb +1 -1
- data/shipit.rubygems.yml +15 -0
- data/test/dynect_email_test.rb +75 -0
- data/test/test_helper.rb +2 -2
- metadata +70 -31
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 86ecdacf5d3513f787d81d7f2e043fb0f095e609
|
4
|
+
data.tar.gz: 8bf487d41f69a5a76e03fc8b10b2653f3ffef99e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 022f1b3861561c212fb66335182e56283c0d9819c35aa0fc5e48333210a43ed8f41a7f452dce2a45ed3b98874621d460317733ea74f3ef47baf7b3b415249167
|
7
|
+
data.tar.gz: 5e0c023cc8ddda019d71c1fb6dac77f6ddff3ba6fab38a9d62987b0964443bc48647a597f00333ed939a4580d1866c61a1ae63823e5a1521194623cb77f5d2cd
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/dynect_email.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["John Duff"]
|
10
10
|
s.email = ["john.duff@shopify.com"]
|
11
|
-
s.homepage = "
|
11
|
+
s.homepage = ""
|
12
12
|
s.summary = %q{Integrate with the DynECT Email API.}
|
13
13
|
s.description = %q{Provides integration with the DynECT Email API.}
|
14
14
|
|
@@ -16,7 +16,8 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.add_runtime_dependency("httparty")
|
18
18
|
s.add_development_dependency("fakeweb")
|
19
|
-
s.add_development_dependency("mocha")
|
19
|
+
s.add_development_dependency("mocha", "0.14.0")
|
20
|
+
s.add_development_dependency("rake")
|
20
21
|
|
21
22
|
s.files = `git ls-files`.split("\n")
|
22
23
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/lib/dynect_email.rb
CHANGED
@@ -9,25 +9,53 @@ module DynectEmail
|
|
9
9
|
attr_accessor :api_key
|
10
10
|
end
|
11
11
|
|
12
|
+
# senders
|
13
|
+
|
12
14
|
def self.add_sender(email, apikey=nil)
|
13
|
-
|
15
|
+
request(:post, "/senders", {:emailaddress => email}, apikey)
|
14
16
|
end
|
15
17
|
|
16
18
|
def self.remove_sender(email, apikey=nil)
|
17
|
-
|
19
|
+
request(:post, "/senders/delete", {:emailaddress => email}, apikey)
|
18
20
|
end
|
19
21
|
|
22
|
+
# accounts
|
23
|
+
|
20
24
|
def self.add_account(username, password, company, phone, options={})
|
21
|
-
|
25
|
+
request(:post, "/accounts", options.merge({:username => username, :password => password, :companyname => company, :phone => phone}))
|
22
26
|
end
|
23
27
|
|
24
28
|
def self.remove_account(username)
|
25
|
-
|
29
|
+
request(:post, "/accounts/delete", :username => username)
|
30
|
+
end
|
31
|
+
|
32
|
+
# reports/bounces
|
33
|
+
|
34
|
+
def self.get_bounces_count(options = {})
|
35
|
+
request(:get, "/reports/bounces/count", options)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.get_bounces(options = {})
|
39
|
+
request(:get, "/reports/bounces", options)
|
40
|
+
end
|
41
|
+
|
42
|
+
# suppressions
|
43
|
+
|
44
|
+
def self.get_suppressions_count(options = {})
|
45
|
+
request(:get, "/suppressions/count", options)
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.get_suppressions(options = {})
|
49
|
+
request(:get, "/suppressions", options)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.activate_suppression(email)
|
53
|
+
request(:post, "/suppressions/activate", :emailaddress => email)
|
26
54
|
end
|
27
55
|
|
28
56
|
# {:xheader1 => "X-header", xheader2 => ....}
|
29
57
|
def self.set_headers(headers, apikey=nil)
|
30
|
-
|
58
|
+
request(:post, "/accounts/xheaders", headers, apikey)
|
31
59
|
end
|
32
60
|
|
33
61
|
private
|
@@ -37,10 +65,16 @@ module DynectEmail
|
|
37
65
|
response['response']['data']
|
38
66
|
end
|
39
67
|
|
40
|
-
def self.
|
68
|
+
def self.request(http_method, url, options={}, apikey=nil)
|
41
69
|
options.merge!(:apikey => apikey || DynectEmail.api_key)
|
42
|
-
result =
|
43
|
-
|
70
|
+
result = case http_method
|
71
|
+
when :post
|
72
|
+
post(url, :body => options)
|
73
|
+
when :get
|
74
|
+
get(url, :query => options)
|
75
|
+
else
|
76
|
+
raise "Invalid HTTP method"
|
77
|
+
end
|
44
78
|
handle_response(result)
|
45
79
|
end
|
46
80
|
end
|
data/lib/dynect_email/version.rb
CHANGED
data/shipit.rubygems.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
dependencies:
|
2
|
+
override:
|
3
|
+
- bundle install --path=./data/bundler
|
4
|
+
|
5
|
+
deploy:
|
6
|
+
override:
|
7
|
+
- |
|
8
|
+
BUILD=`bundle exec rake build`
|
9
|
+
if [ $? != 0 ]; then
|
10
|
+
echo $BUILD;
|
11
|
+
exit 1;
|
12
|
+
fi
|
13
|
+
PKG=`echo $BUILD | cut -d" " -f5 | sed -e s/\.$//`;
|
14
|
+
VERSION=`echo $BUILD | cut -d" " -f2`;
|
15
|
+
gem push $PKG
|
data/test/dynect_email_test.rb
CHANGED
@@ -131,4 +131,79 @@ class DynectEmailTest < Test::Unit::TestCase
|
|
131
131
|
|
132
132
|
DynectEmail.set_headers({:xheader1 => "X-Sample1", :xheader2 => "X-Sample2"})
|
133
133
|
end
|
134
|
+
|
135
|
+
def test_get_bounces_count
|
136
|
+
FakeWeb.register_uri(:get, %r|http://emailapi.dynect.net/rest/json/reports/bounces/count\?|, :body => load_fixture('ok'), :status => 200, :content_type => "text/json")
|
137
|
+
|
138
|
+
assert_nothing_raised do
|
139
|
+
DynectEmail.get_bounces_count
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_get_bounces_count_sends_correct_parameters
|
144
|
+
DynectEmail.expects(:get).with("/reports/bounces/count", :query => {:startdate => "2012-08-01", :enddate => "2012-08-17", :sender => "test@example.com", :apikey => "12345"})
|
145
|
+
DynectEmail.expects(:handle_response)
|
146
|
+
|
147
|
+
DynectEmail.get_bounces_count({:startdate => '2012-08-01', :enddate => '2012-08-17', :sender => 'test@example.com'})
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_get_bounces
|
151
|
+
FakeWeb.register_uri(:get, %r|http://emailapi.dynect.net/rest/json/reports/bounces\?|, :body => load_fixture('ok'), :status => 200, :content_type => "text/json")
|
152
|
+
|
153
|
+
assert_nothing_raised do
|
154
|
+
DynectEmail.get_bounces
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def test_get_bounces_sends_correct_parameters
|
159
|
+
DynectEmail.expects(:get).with("/reports/bounces", :query => {:startdate => "2012-08-01", :enddate => "2012-08-17", :sender => "test@example.com", :apikey => "12345"})
|
160
|
+
DynectEmail.expects(:handle_response)
|
161
|
+
|
162
|
+
DynectEmail.get_bounces({:startdate => '2012-08-01', :enddate => '2012-08-17', :sender => 'test@example.com'})
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_get_suppressions_count
|
166
|
+
FakeWeb.register_uri(:get, %r|http://emailapi.dynect.net/rest/json/suppressions/count\?|, :body => load_fixture('ok'), :status => 200, :content_type => "text/json")
|
167
|
+
|
168
|
+
assert_nothing_raised do
|
169
|
+
DynectEmail.get_suppressions_count
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def test_get_suppressions_count_sends_correct_parameters
|
174
|
+
DynectEmail.expects(:get).with("/suppressions/count", :query => {:startdate => "2012-08-01", :enddate => "2012-08-17", :apikey => "12345"})
|
175
|
+
DynectEmail.expects(:handle_response)
|
176
|
+
|
177
|
+
DynectEmail.get_suppressions_count({:startdate => '2012-08-01', :enddate => '2012-08-17'})
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_get_suppressions
|
181
|
+
FakeWeb.register_uri(:get, %r|http://emailapi.dynect.net/rest/json/suppressions\?|, :body => load_fixture('ok'), :status => 200, :content_type => "text/json")
|
182
|
+
|
183
|
+
assert_nothing_raised do
|
184
|
+
DynectEmail.get_suppressions
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_get_suppressions_sends_correct_parameters
|
189
|
+
DynectEmail.expects(:get).with("/suppressions", :query => {:startdate => "2012-08-01", :enddate => "2012-08-17", :apikey => "12345"})
|
190
|
+
DynectEmail.expects(:handle_response)
|
191
|
+
|
192
|
+
DynectEmail.get_suppressions({:startdate => '2012-08-01', :enddate => '2012-08-17'})
|
193
|
+
end
|
194
|
+
|
195
|
+
def test_activate_suppression
|
196
|
+
FakeWeb.register_uri(:post, "http://emailapi.dynect.net/rest/json/suppressions/activate", :body => load_fixture('ok'), :status => 200, :content_type => "text/json")
|
197
|
+
|
198
|
+
assert_nothing_raised do
|
199
|
+
DynectEmail.activate_suppression('test@example.com')
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
def test_activate_suppression_sends_correct_parameters
|
204
|
+
DynectEmail.expects(:post).with("/suppressions/activate", :body => {:emailaddress => 'test@example.com', :apikey => "12345"})
|
205
|
+
DynectEmail.expects(:handle_response)
|
206
|
+
|
207
|
+
DynectEmail.activate_suppression('test@example.com')
|
208
|
+
end
|
134
209
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,49 +1,93 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynect_email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- John Duff
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
|
-
cert_chain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XMHVs6Xi94h
|
27
|
+
qXFw1ec9Y2eDUqaolT3bviOk9BB197+A8Vz/k7MC6ci2NE+yDDB7HAC8zU6LAx8Y
|
28
|
+
Iqvw7B/PSZ/pz4bUVFlTATif4mi1vO3lidRkdHRtM7UePSn2rUpOi0gtXBP3bLu5
|
29
|
+
YjHJN7wx5cugMEyroKITG5gL0Nxtu21qtOlHX4Hc4KdE2JqzCPOsS4zsZGhgwhPs
|
30
|
+
fl3hbtVFTqbOlwL9vy1fudXcolIE/ZTcxQ+er07ZFZdKCXayR9PPs64heamfn0fp
|
31
|
+
TConQSX2BnZdhIEYW+cKzEC/bLc=
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2014-05-20 00:00:00.000000000 Z
|
13
34
|
dependencies:
|
14
35
|
- !ruby/object:Gem::Dependency
|
15
36
|
name: httparty
|
16
|
-
requirement:
|
17
|
-
none: false
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
18
38
|
requirements:
|
19
|
-
- -
|
39
|
+
- - ">="
|
20
40
|
- !ruby/object:Gem::Version
|
21
41
|
version: '0'
|
22
42
|
type: :runtime
|
23
43
|
prerelease: false
|
24
|
-
version_requirements:
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
25
49
|
- !ruby/object:Gem::Dependency
|
26
50
|
name: fakeweb
|
27
|
-
requirement:
|
28
|
-
none: false
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
29
52
|
requirements:
|
30
|
-
- -
|
53
|
+
- - ">="
|
31
54
|
- !ruby/object:Gem::Version
|
32
55
|
version: '0'
|
33
56
|
type: :development
|
34
57
|
prerelease: false
|
35
|
-
version_requirements:
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
36
63
|
- !ruby/object:Gem::Dependency
|
37
64
|
name: mocha
|
38
|
-
requirement:
|
39
|
-
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.14.0
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.14.0
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: rake
|
79
|
+
requirement: !ruby/object:Gem::Requirement
|
40
80
|
requirements:
|
41
|
-
- -
|
81
|
+
- - ">="
|
42
82
|
- !ruby/object:Gem::Version
|
43
83
|
version: '0'
|
44
84
|
type: :development
|
45
85
|
prerelease: false
|
46
|
-
version_requirements:
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
47
91
|
description: Provides integration with the DynECT Email API.
|
48
92
|
email:
|
49
93
|
- john.duff@shopify.com
|
@@ -51,7 +95,8 @@ executables: []
|
|
51
95
|
extensions: []
|
52
96
|
extra_rdoc_files: []
|
53
97
|
files:
|
54
|
-
- .gitignore
|
98
|
+
- ".gitignore"
|
99
|
+
- ".travis.yml"
|
55
100
|
- Gemfile
|
56
101
|
- MIT-LICENSE
|
57
102
|
- README.md
|
@@ -59,40 +104,34 @@ files:
|
|
59
104
|
- dynect_email.gemspec
|
60
105
|
- lib/dynect_email.rb
|
61
106
|
- lib/dynect_email/version.rb
|
107
|
+
- shipit.rubygems.yml
|
62
108
|
- test/dynect_email_test.rb
|
63
109
|
- test/fixtures/missing_or_invalid_api_key.json
|
64
110
|
- test/fixtures/missing_or_invalid_fields.json
|
65
111
|
- test/fixtures/object_already_exists.json
|
66
112
|
- test/fixtures/ok.json
|
67
113
|
- test/test_helper.rb
|
68
|
-
homepage:
|
114
|
+
homepage: ''
|
69
115
|
licenses: []
|
116
|
+
metadata: {}
|
70
117
|
post_install_message:
|
71
118
|
rdoc_options: []
|
72
119
|
require_paths:
|
73
120
|
- lib
|
74
121
|
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
122
|
requirements:
|
77
|
-
- -
|
123
|
+
- - ">="
|
78
124
|
- !ruby/object:Gem::Version
|
79
125
|
version: '0'
|
80
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
127
|
requirements:
|
83
|
-
- -
|
128
|
+
- - ">="
|
84
129
|
- !ruby/object:Gem::Version
|
85
130
|
version: '0'
|
86
131
|
requirements: []
|
87
132
|
rubyforge_project: dynect_email
|
88
|
-
rubygems_version:
|
133
|
+
rubygems_version: 2.2.0
|
89
134
|
signing_key:
|
90
|
-
specification_version:
|
135
|
+
specification_version: 4
|
91
136
|
summary: Integrate with the DynECT Email API.
|
92
|
-
test_files:
|
93
|
-
- test/dynect_email_test.rb
|
94
|
-
- test/fixtures/missing_or_invalid_api_key.json
|
95
|
-
- test/fixtures/missing_or_invalid_fields.json
|
96
|
-
- test/fixtures/object_already_exists.json
|
97
|
-
- test/fixtures/ok.json
|
98
|
-
- test/test_helper.rb
|
137
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|