smtpcom_api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,25 @@
1
+ module SmtpcomApi
2
+ module Request
3
+ module Urls
4
+ ACCOUNT = "/account"
5
+ SETTINGS = "/account/settings"
6
+ PLAN_DETAILS = "/account/plan_details"
7
+ DASHBOARD = "/account/statistics/delivery/dashboard"
8
+
9
+ SENDERS = "/account/senders"
10
+
11
+ SENDER_SETTINGS = "/account/senders/%s/sender_settings"
12
+ SENDER = "/account/senders/%s"
13
+ SENDER_ALLOWED_IPS = "/account/senders/%s/allowed_ips"
14
+ UPDATE_SENDER_ALLOWED_IP = "/account/senders/%s/allowed_ips/%s"
15
+
16
+ SUMMARY = "/account/senders/%s/statistics/summary"
17
+ DELIVERY = "/account/senders/%s/statistics/delivery"
18
+ CAMPAIGNS = "/account/senders/%s/statistics/campaigns"
19
+ CAMPAIGN = "/account/senders/%s/statistics/campaigns/%s"
20
+ COMPLAINTS = "/account/senders/%s/statistics/complaints"
21
+ QUEUE = "/account/senders/%s/statistics/queue"
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,56 @@
1
+ module SmtpcomApi
2
+ class Sender < Client
3
+ READERS = [:id, :sent, :allowed_ips]
4
+ ACCESSORS = [:label, :is_ip_based, :login, :max_quota, :password]
5
+ ATTRIBUTES = READERS + ACCESSORS
6
+
7
+ include Helpers
8
+
9
+ attr_accessor *ACCESSORS
10
+ attr_reader *READERS
11
+
12
+ def initialize(label_or_id, api_key, api_host, attributes={})
13
+ super(api_key, api_host)
14
+ @label_or_id = label_or_id
15
+ attributes = get(:sender, {:pl => @label_or_id})['sender'] if attributes.empty?
16
+ set_attributes(attributes)
17
+ @allowed_ips ||= []
18
+
19
+ [:summary, :delivery, :campaigns, :complaints, :queue].each do |key|
20
+ define_singleton_method key do |options={}|
21
+ get(key, options.merge({:pl => @label_or_id}))[key.to_s]
22
+ end
23
+ end
24
+ end
25
+
26
+ def reload
27
+ set_attributes get(:sender, {:pl => @label_or_id})['sender']
28
+ self
29
+ end
30
+
31
+ def campaign(campaign_id)
32
+ get(:campaign, {:pl => [@label_or_id, campaign_id]})['campaign']
33
+ end
34
+
35
+ def save
36
+ update = attributes.select{|k| ACCESSORS.include? k}
37
+ update.delete(:password) if update[:password].nil?
38
+ result = put :sender, :sender => update, :pl => @label_or_id
39
+ @label_or_id = @label
40
+ self.password = nil
41
+ self
42
+ end
43
+
44
+ def add_allowed_ip(ip)
45
+ @allowed_ips << post(:sender_allowed_ips, {:allowed_ip => {:range => ip}, :pl => @label_or_id})['allowed_ip']
46
+ end
47
+
48
+ def remove_allowed_ip(ip)
49
+ if @allowed_ips.map{|aip| aip['range']}.include?(ip)
50
+ delete(:update_sender_allowed_ip, {:pl => [@label_or_id, ip]})
51
+ @allowed_ips.reject!{|aip| aip['range']==ip}
52
+ end
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,10 @@
1
+ module SmtpcomApi
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ PATCH = 1
6
+ BUILD = nil
7
+
8
+ STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
9
+ end
10
+ end
@@ -0,0 +1,89 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "smtpcom_api"
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Vasiliy Sablin"]
12
+ s.date = "2012-06-09"
13
+ s.description = ""
14
+ s.email = "vasiliy.sablin@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".DS_Store",
21
+ ".document",
22
+ ".rspec",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "README.md",
27
+ "Rakefile",
28
+ "examples/usage.rb",
29
+ "lib/smtpcom_api.rb",
30
+ "lib/smtpcom_api/account.rb",
31
+ "lib/smtpcom_api/client.rb",
32
+ "lib/smtpcom_api/helpers.rb",
33
+ "lib/smtpcom_api/request.rb",
34
+ "lib/smtpcom_api/request/urls.rb",
35
+ "lib/smtpcom_api/sender.rb",
36
+ "lib/smtpcom_api/version.rb",
37
+ "smtpcom_api.gemspec",
38
+ "spec/account_spec.rb",
39
+ "spec/client_spec.rb",
40
+ "spec/fixtures/vcr_cassettes/client.yml",
41
+ "spec/helpers_spec.rb",
42
+ "spec/request_spec.rb",
43
+ "spec/sender_spec.rb",
44
+ "spec/shared.rb",
45
+ "spec/spec_helper.rb"
46
+ ]
47
+ s.homepage = "http://github.com/smtpcom/smtpcom_api"
48
+ s.licenses = ["MIT"]
49
+ s.require_paths = ["lib"]
50
+ s.rubygems_version = "1.8.24"
51
+ s.summary = "Ruby wrapper for the http://smtp.com API (http://api.smtp.com)"
52
+
53
+ if s.respond_to? :specification_version then
54
+ s.specification_version = 3
55
+
56
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
+ s.add_runtime_dependency(%q<faraday_middleware>, [">= 0"])
58
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
59
+ s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
60
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
61
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
62
+ s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
63
+ s.add_development_dependency(%q<rspec-mocks>, [">= 0"])
64
+ s.add_development_dependency(%q<webmock>, [">= 0"])
65
+ s.add_development_dependency(%q<vcr>, [">= 0"])
66
+ else
67
+ s.add_dependency(%q<faraday_middleware>, [">= 0"])
68
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
69
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
70
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
71
+ s.add_dependency(%q<simplecov>, [">= 0"])
72
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
73
+ s.add_dependency(%q<rspec-mocks>, [">= 0"])
74
+ s.add_dependency(%q<webmock>, [">= 0"])
75
+ s.add_dependency(%q<vcr>, [">= 0"])
76
+ end
77
+ else
78
+ s.add_dependency(%q<faraday_middleware>, [">= 0"])
79
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
80
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
81
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
82
+ s.add_dependency(%q<simplecov>, [">= 0"])
83
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
84
+ s.add_dependency(%q<rspec-mocks>, [">= 0"])
85
+ s.add_dependency(%q<webmock>, [">= 0"])
86
+ s.add_dependency(%q<vcr>, [">= 0"])
87
+ end
88
+ end
89
+
@@ -0,0 +1,45 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "SmtpcomApi::Account" do
4
+ use_vcr_cassette 'client'
5
+ let(:account) { SmtpcomApi::Account.new(API_KEY, API_HOST) }
6
+
7
+ describe "like a client" do
8
+ let(:client) { account }
9
+ it_behaves_like "a client"
10
+ end
11
+
12
+ describe "attributes" do
13
+ subject { account }
14
+
15
+ it { should respond_to :first_name }
16
+ it { should respond_to :last_name }
17
+ it { should respond_to :email }
18
+ end
19
+
20
+ describe "account" do
21
+
22
+ it "should return attributes hash" do
23
+ account.attributes.should be_an_instance_of(Hash)
24
+ end
25
+
26
+ it "should return attributes hash" do
27
+ account.attributes.should have_key(:first_name)
28
+ end
29
+
30
+ it "should be able to reload attributes" do
31
+ account.reload.should be_an_instance_of(SmtpcomApi::Account)
32
+ end
33
+
34
+ it "should be able to save attributes" do
35
+ account.save.should be_an_instance_of(SmtpcomApi::Account)
36
+ end
37
+
38
+ it "has dashboard" do
39
+ account.stub(:now).and_return(1339225350)
40
+ account.dashboard.should be_an_instance_of(Hash)
41
+ end
42
+
43
+ end
44
+
45
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "SmtpcomApi::Client" do
4
+ use_vcr_cassette 'client'
5
+ let(:client){ SmtpcomApi::Client.new(API_KEY, API_HOST) }
6
+ it_behaves_like "a client"
7
+ end
@@ -0,0 +1,559 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://rest.smtp.com/v1/account.json?api_key=373da51f9faa9bcac214cebe2a3b460c3697825d
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers: {}
10
+
11
+ response:
12
+ status:
13
+ code: 200
14
+ message:
15
+ headers:
16
+ server:
17
+ - nginx/0.7.67
18
+ date:
19
+ - Sat, 09 Jun 2012 07:18:33 GMT
20
+ content-type:
21
+ - application/json; charset=utf-8
22
+ transfer-encoding:
23
+ - chunked
24
+ connection:
25
+ - close
26
+ status:
27
+ - 200 OK
28
+ access-control-allow-origin:
29
+ - "*"
30
+ access-control-allow-methods:
31
+ - GET
32
+ x-ua-compatible:
33
+ - IE=Edge,chrome=1
34
+ etag:
35
+ - "\"2f8fcb1bd5172ccca354ecadacbfddd2\""
36
+ cache-control:
37
+ - max-age=0, private, must-revalidate
38
+ x-request-id:
39
+ - 897858d7dffe0b1c8a04dcccd8d37f6f
40
+ x-runtime:
41
+ - "0.099902"
42
+ x-rack-cache:
43
+ - miss
44
+ body:
45
+ encoding: US-ASCII
46
+ string: "{\"account\":{\"first_name\":\"Lyosha\",\"last_name\":\"Greb\",\"email\":\"dimid@smtp.com\",\"company_name\":\"my company\",\"phone\":\"1.555.555.5555\",\"prepaid_quota\":100000000,\"reset_quota_at\":0,\"ip_pool\":null,\"usage\":590278},\"message\":\"OK\",\"code\":0}"
47
+ http_version:
48
+ recorded_at: Sat, 09 Jun 2012 07:18:33 GMT
49
+ - request:
50
+ method: get
51
+ uri: http://rest.smtp.com/v1/account.json?api_key=373da51f9faa9bcac214cebe2a3b460c3697825d
52
+ body:
53
+ encoding: US-ASCII
54
+ string: ""
55
+ headers: {}
56
+
57
+ response:
58
+ status:
59
+ code: 200
60
+ message:
61
+ headers:
62
+ server:
63
+ - nginx/0.7.67
64
+ date:
65
+ - Sat, 09 Jun 2012 07:18:33 GMT
66
+ content-type:
67
+ - application/json; charset=utf-8
68
+ transfer-encoding:
69
+ - chunked
70
+ connection:
71
+ - close
72
+ status:
73
+ - 200 OK
74
+ access-control-allow-origin:
75
+ - "*"
76
+ access-control-allow-methods:
77
+ - GET
78
+ x-ua-compatible:
79
+ - IE=Edge,chrome=1
80
+ etag:
81
+ - "\"2f8fcb1bd5172ccca354ecadacbfddd2\""
82
+ cache-control:
83
+ - max-age=0, private, must-revalidate
84
+ x-request-id:
85
+ - 0053ef884b9ceca71480f033654fc97d
86
+ x-runtime:
87
+ - "0.067915"
88
+ x-rack-cache:
89
+ - miss
90
+ body:
91
+ encoding: US-ASCII
92
+ string: "{\"account\":{\"first_name\":\"Lyosha\",\"last_name\":\"Greb\",\"email\":\"dimid@smtp.com\",\"company_name\":\"my company\",\"phone\":\"1.555.555.5555\",\"prepaid_quota\":100000000,\"reset_quota_at\":0,\"ip_pool\":null,\"usage\":590278},\"message\":\"OK\",\"code\":0}"
93
+ http_version:
94
+ recorded_at: Sat, 09 Jun 2012 07:18:34 GMT
95
+ - request:
96
+ method: get
97
+ uri: http://rest.smtp.com/v1/account/senders/vasiliy.json?api_key=373da51f9faa9bcac214cebe2a3b460c3697825d
98
+ body:
99
+ encoding: US-ASCII
100
+ string: ""
101
+ headers: {}
102
+
103
+ response:
104
+ status:
105
+ code: 200
106
+ message:
107
+ headers:
108
+ server:
109
+ - nginx/0.7.67
110
+ date:
111
+ - Sat, 09 Jun 2012 07:18:34 GMT
112
+ content-type:
113
+ - application/json; charset=utf-8
114
+ transfer-encoding:
115
+ - chunked
116
+ connection:
117
+ - close
118
+ status:
119
+ - 200 OK
120
+ access-control-allow-origin:
121
+ - "*"
122
+ access-control-allow-methods:
123
+ - GET
124
+ x-ua-compatible:
125
+ - IE=Edge,chrome=1
126
+ etag:
127
+ - "\"5381cc1b80ec9455b884faf86ddd2bb4\""
128
+ cache-control:
129
+ - max-age=0, private, must-revalidate
130
+ x-request-id:
131
+ - ed45376d2b67bf889d0df2a33b7d189b
132
+ x-runtime:
133
+ - "0.021669"
134
+ x-rack-cache:
135
+ - miss
136
+ body:
137
+ encoding: US-ASCII
138
+ string: "{\"sender\":{\"id\":1000005,\"label\":\"vasiliy\",\"is_ip_based\":true,\"sent\":0,\"max_quota\":null,\"allowed_ips\":[]},\"message\":\"OK\",\"code\":0}"
139
+ http_version:
140
+ recorded_at: Sat, 09 Jun 2012 07:18:34 GMT
141
+ - request:
142
+ method: get
143
+ uri: http://rest.smtp.com/v1/account/senders.json?api_key=373da51f9faa9bcac214cebe2a3b460c3697825d
144
+ body:
145
+ encoding: US-ASCII
146
+ string: ""
147
+ headers: {}
148
+
149
+ response:
150
+ status:
151
+ code: 200
152
+ message:
153
+ headers:
154
+ server:
155
+ - nginx/0.7.67
156
+ date:
157
+ - Sat, 09 Jun 2012 07:18:35 GMT
158
+ content-type:
159
+ - application/json; charset=utf-8
160
+ transfer-encoding:
161
+ - chunked
162
+ connection:
163
+ - close
164
+ status:
165
+ - 200 OK
166
+ access-control-allow-origin:
167
+ - "*"
168
+ access-control-allow-methods:
169
+ - GET
170
+ x-ua-compatible:
171
+ - IE=Edge,chrome=1
172
+ etag:
173
+ - "\"c8e13da23f0ba21efbd94d256f6e5850\""
174
+ cache-control:
175
+ - max-age=0, private, must-revalidate
176
+ x-request-id:
177
+ - 3fd36630900f715209c2cd9a4b2f10e1
178
+ x-runtime:
179
+ - "0.075866"
180
+ x-rack-cache:
181
+ - miss
182
+ body:
183
+ encoding: US-ASCII
184
+ string: "{\"senders\":[{\"id\":1000020,\"label\":\"my_new_sender\",\"is_ip_based\":false,\"sent\":0,\"max_quota\":null,\"login\":\"my_new_sender\"},{\"id\":1000007,\"label\":\"yana_test\",\"is_ip_based\":false,\"sent\":100000,\"max_quota\":null,\"login\":\"yana_test\"},{\"id\":1000021,\"label\":\"my_new_sender1\",\"is_ip_based\":false,\"sent\":0,\"max_quota\":null,\"login\":\"my_new_sender1\"},{\"id\":1000022,\"label\":\"my_new_sender2\",\"is_ip_based\":false,\"sent\":0,\"max_quota\":null,\"login\":\"my_new_sender2\"},{\"id\":1000005,\"label\":\"vasiliy\",\"is_ip_based\":true,\"sent\":0,\"max_quota\":null,\"allowed_ips\":[]},{\"id\":1000006,\"label\":\"eee\\nfffffffffff\",\"is_ip_based\":true,\"sent\":0,\"max_quota\":10000,\"allowed_ips\":[]},{\"id\":1000024,\"label\":\"my_new_sender3\",\"is_ip_based\":false,\"sent\":0,\"max_quota\":null,\"login\":\"my_new_sender3\"},{\"id\":1000025,\"label\":\"my_new_sender4\",\"is_ip_based\":false,\"sent\":0,\"max_quota\":null,\"login\":\"my_new_sender4\"},{\"id\":1000027,\"label\":\"my_new_sender7\",\"is_ip_based\":false,\"sent\":0,\"max_quota\":null,\"login\":\"my_new_sender7\"},{\"id\":1000026,\"label\":\"ipauth\",\"is_ip_based\":true,\"sent\":0,\"max_quota\":null,\"allowed_ips\":[]},{\"id\":1000028,\"label\":\"my_new_sender8\",\"is_ip_based\":false,\"sent\":0,\"max_quota\":null,\"login\":\"my_new_sender8\"},{\"id\":1000004,\"label\":\"dimidik\",\"is_ip_based\":false,\"sent\":490278,\"max_quota\":null,\"login\":\"dimidik\"},{\"id\":1000029,\"label\":\"my_new_sender10\",\"is_ip_based\":false,\"sent\":0,\"max_quota\":null,\"login\":\"my_new_sender10\"}],\"message\":\"OK\",\"code\":0}"
185
+ http_version:
186
+ recorded_at: Sat, 09 Jun 2012 07:18:35 GMT
187
+ - request:
188
+ method: post
189
+ uri: http://rest.smtp.com/v1/account/senders.json
190
+ body:
191
+ encoding: US-ASCII
192
+ string: sender%5Blabel%5D=my_new_sender11&sender%5Blogin%5D=my_new_sender11&sender%5Bpassword%5D=my_pass1&api_key=373da51f9faa9bcac214cebe2a3b460c3697825d
193
+ headers:
194
+ Content-Type:
195
+ - application/x-www-form-urlencoded
196
+ response:
197
+ status:
198
+ code: 200
199
+ message:
200
+ headers:
201
+ server:
202
+ - nginx/0.7.67
203
+ date:
204
+ - Sat, 09 Jun 2012 07:18:37 GMT
205
+ content-type:
206
+ - application/json; charset=utf-8
207
+ transfer-encoding:
208
+ - chunked
209
+ connection:
210
+ - close
211
+ status:
212
+ - 200 OK
213
+ access-control-allow-origin:
214
+ - "*"
215
+ access-control-allow-methods:
216
+ - GET
217
+ x-ua-compatible:
218
+ - IE=Edge,chrome=1
219
+ etag:
220
+ - "\"06877153b4e7efbe9ae3fb1403306b5e\""
221
+ cache-control:
222
+ - max-age=0, private, must-revalidate
223
+ x-request-id:
224
+ - 022f6526d9d8ff7eff7a7f7b1a0843e4
225
+ x-runtime:
226
+ - "0.970128"
227
+ x-rack-cache:
228
+ - invalidate, pass
229
+ body:
230
+ encoding: US-ASCII
231
+ string: "{\"sender\":{\"id\":1000030,\"label\":\"my_new_sender11\",\"is_ip_based\":false,\"sent\":0,\"max_quota\":null,\"login\":\"my_new_sender11\"},\"message\":\"OK\",\"code\":0}"
232
+ http_version:
233
+ recorded_at: Sat, 09 Jun 2012 07:18:37 GMT
234
+ - request:
235
+ method: put
236
+ uri: http://rest.smtp.com/v1/account.json
237
+ body:
238
+ encoding: US-ASCII
239
+ string: account%5Bcompany_name%5D=my+company&account%5Bphone%5D=1.555.555.5555&account%5Blast_name%5D=Greb&account%5Bfirst_name%5D=Lyosha&api_key=373da51f9faa9bcac214cebe2a3b460c3697825d
240
+ headers:
241
+ Content-Type:
242
+ - application/x-www-form-urlencoded
243
+ response:
244
+ status:
245
+ code: 200
246
+ message:
247
+ headers:
248
+ server:
249
+ - nginx/0.7.67
250
+ date:
251
+ - Sat, 09 Jun 2012 07:18:39 GMT
252
+ content-type:
253
+ - application/json; charset=utf-8
254
+ transfer-encoding:
255
+ - chunked
256
+ connection:
257
+ - close
258
+ status:
259
+ - 200 OK
260
+ access-control-allow-origin:
261
+ - "*"
262
+ access-control-allow-methods:
263
+ - GET
264
+ x-ua-compatible:
265
+ - IE=Edge,chrome=1
266
+ etag:
267
+ - "\"2f8fcb1bd5172ccca354ecadacbfddd2\""
268
+ cache-control:
269
+ - max-age=0, private, must-revalidate
270
+ x-request-id:
271
+ - f8aaf18fa25c03fd84e86ce902295311
272
+ x-runtime:
273
+ - "0.044143"
274
+ x-rack-cache:
275
+ - invalidate, pass
276
+ body:
277
+ encoding: US-ASCII
278
+ string: "{\"account\":{\"first_name\":\"Lyosha\",\"last_name\":\"Greb\",\"email\":\"dimid@smtp.com\",\"company_name\":\"my company\",\"phone\":\"1.555.555.5555\",\"prepaid_quota\":100000000,\"reset_quota_at\":0,\"ip_pool\":null,\"usage\":590278},\"message\":\"OK\",\"code\":0}"
279
+ http_version:
280
+ recorded_at: Sat, 09 Jun 2012 07:18:41 GMT
281
+ - request:
282
+ method: get
283
+ uri: http://rest.smtp.com/v1/account/statistics/delivery/dashboard.json?time_end=1339225350&time_start=1336633350&api_key=373da51f9faa9bcac214cebe2a3b460c3697825d
284
+ body:
285
+ encoding: US-ASCII
286
+ string: ""
287
+ headers: {}
288
+
289
+ response:
290
+ status:
291
+ code: 200
292
+ message:
293
+ headers:
294
+ server:
295
+ - nginx/0.7.67
296
+ date:
297
+ - Sat, 09 Jun 2012 07:18:42 GMT
298
+ content-type:
299
+ - application/json; charset=utf-8
300
+ transfer-encoding:
301
+ - chunked
302
+ connection:
303
+ - close
304
+ status:
305
+ - 200 OK
306
+ access-control-allow-origin:
307
+ - "*"
308
+ access-control-allow-methods:
309
+ - GET
310
+ x-ua-compatible:
311
+ - IE=Edge,chrome=1
312
+ etag:
313
+ - "\"ffd48f3ead1be8f31dea056f3b182658\""
314
+ cache-control:
315
+ - max-age=0, private, must-revalidate
316
+ x-request-id:
317
+ - 6d3cde3047831c2e9479253216205611
318
+ x-runtime:
319
+ - "0.096717"
320
+ x-rack-cache:
321
+ - miss
322
+ body:
323
+ encoding: US-ASCII
324
+ string: "{\"dashboard\":{\"1000004\":{\"delivered_count\":435865,\"bounced_count\":51141,\"pending_count\":0,\"complaints_count\":0,\"deferred_count\":0,\"received_count\":487006,\"suppressed_count\":1,\"in_delivery_count\":0,\"campaigns\":[{\"sender_id\":1000004,\"account_id\":1000002,\"received_count\":25,\"complaints_count\":0,\"delivered_count\":24,\"bounced_count\":1,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1338829920,\"time_finished\":1338830040},{\"sender_id\":1000004,\"account_id\":1000002,\"received_count\":25,\"complaints_count\":0,\"delivered_count\":24,\"bounced_count\":1,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1338887640,\"time_finished\":1338887640},{\"sender_id\":1000004,\"account_id\":1000002,\"received_count\":25,\"complaints_count\":0,\"delivered_count\":22,\"bounced_count\":3,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1338910260,\"time_finished\":1338910260},{\"sender_id\":1000004,\"account_id\":1000002,\"received_count\":25,\"complaints_count\":0,\"delivered_count\":21,\"bounced_count\":4,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1338920760,\"time_finished\":1338920760},{\"sender_id\":1000004,\"account_id\":1000002,\"received_count\":25,\"complaints_count\":0,\"delivered_count\":23,\"bounced_count\":2,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1338925080,\"time_finished\":1338925080},{\"sender_id\":1000004,\"account_id\":1000002,\"received_count\":249737,\"complaints_count\":0,\"delivered_count\":223633,\"bounced_count\":26104,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1338926100,\"time_finished\":1338929640},{\"sender_id\":1000004,\"account_id\":1000002,\"received_count\":165005,\"complaints_count\":0,\"delivered_count\":147620,\"bounced_count\":17385,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1338930060,\"time_finished\":1338932400},{\"sender_id\":1000004,\"account_id\":1000002,\"received_count\":24772,\"complaints_count\":0,\"delivered_count\":22069,\"bounced_count\":2703,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1339144020,\"time_finished\":1339144380},{\"sender_id\":1000004,\"account_id\":1000002,\"received_count\":23642,\"complaints_count\":0,\"delivered_count\":21208,\"bounced_count\":2434,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1339146540,\"time_finished\":1339146900},{\"sender_id\":1000004,\"account_id\":1000002,\"received_count\":23720,\"complaints_count\":0,\"delivered_count\":21219,\"bounced_count\":2501,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1339151760,\"time_finished\":1339152120},{\"campaign_id\":\"foo290213\",\"sender_id\":1000004,\"account_id\":1000002,\"received_count\":4,\"complaints_count\":0,\"delivered_count\":1,\"bounced_count\":3,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1339169904,\"time_finished\":1339216921}]},\"1000007\":{\"delivered_count\":87016,\"bounced_count\":10187,\"pending_count\":0,\"complaints_count\":0,\"deferred_count\":0,\"received_count\":97203,\"suppressed_count\":0,\"in_delivery_count\":0,\"campaigns\":[{\"sender_id\":1000007,\"account_id\":1000002,\"received_count\":23821,\"complaints_count\":0,\"delivered_count\":21356,\"bounced_count\":2465,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1338995520,\"time_finished\":1338995820},{\"sender_id\":1000007,\"account_id\":1000002,\"received_count\":24156,\"complaints_count\":0,\"delivered_count\":21619,\"bounced_count\":2537,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1339079820,\"time_finished\":1339080180},{\"sender_id\":1000007,\"account_id\":1000002,\"received_count\":24454,\"complaints_count\":0,\"delivered_count\":21851,\"bounced_count\":2603,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1339089660,\"time_finished\":1339090020},{\"sender_id\":1000007,\"account_id\":1000002,\"received_count\":24772,\"complaints_count\":0,\"delivered_count\":22190,\"bounced_count\":2582,\"suppressed_count\":0,\"opened_count\":0,\"time_started\":1339143600,\"time_finished\":1339143960}]}},\"last_update_time\":1339217142,\"message\":\"OK\",\"code\":0}"
325
+ http_version:
326
+ recorded_at: Sat, 09 Jun 2012 07:18:42 GMT
327
+ - request:
328
+ method: get
329
+ uri: http://rest.smtp.com/v1/account/senders/vasiliy.json?api_key=373da51f9faa9bcac214cebe2a3b460c3697825d
330
+ body:
331
+ encoding: US-ASCII
332
+ string: ""
333
+ headers: {}
334
+
335
+ response:
336
+ status:
337
+ code: 200
338
+ message:
339
+ headers:
340
+ server:
341
+ - nginx/0.7.67
342
+ date:
343
+ - Sat, 09 Jun 2012 07:18:43 GMT
344
+ content-type:
345
+ - application/json; charset=utf-8
346
+ transfer-encoding:
347
+ - chunked
348
+ connection:
349
+ - close
350
+ status:
351
+ - 200 OK
352
+ access-control-allow-origin:
353
+ - "*"
354
+ access-control-allow-methods:
355
+ - GET
356
+ x-ua-compatible:
357
+ - IE=Edge,chrome=1
358
+ etag:
359
+ - "\"5381cc1b80ec9455b884faf86ddd2bb4\""
360
+ cache-control:
361
+ - max-age=0, private, must-revalidate
362
+ x-request-id:
363
+ - c3869b358942167777654138bda7b5cd
364
+ x-runtime:
365
+ - "0.352955"
366
+ x-rack-cache:
367
+ - miss
368
+ body:
369
+ encoding: US-ASCII
370
+ string: "{\"sender\":{\"id\":1000005,\"label\":\"vasiliy\",\"is_ip_based\":true,\"sent\":0,\"max_quota\":null,\"allowed_ips\":[]},\"message\":\"OK\",\"code\":0}"
371
+ http_version:
372
+ recorded_at: Sat, 09 Jun 2012 07:18:43 GMT
373
+ - request:
374
+ method: put
375
+ uri: http://rest.smtp.com/v1/account/senders/vasiliy.json
376
+ body:
377
+ encoding: US-ASCII
378
+ string: sender%5Blabel%5D=vasiliy&sender%5Bis_ip_based%5D=true&sender%5Blogin%5D&sender%5Bmax_quota%5D&api_key=373da51f9faa9bcac214cebe2a3b460c3697825d
379
+ headers:
380
+ Content-Type:
381
+ - application/x-www-form-urlencoded
382
+ response:
383
+ status:
384
+ code: 200
385
+ message:
386
+ headers:
387
+ server:
388
+ - nginx/0.7.67
389
+ date:
390
+ - Sat, 09 Jun 2012 07:18:44 GMT
391
+ content-type:
392
+ - application/json; charset=utf-8
393
+ transfer-encoding:
394
+ - chunked
395
+ connection:
396
+ - close
397
+ status:
398
+ - 200 OK
399
+ access-control-allow-origin:
400
+ - "*"
401
+ access-control-allow-methods:
402
+ - GET
403
+ x-ua-compatible:
404
+ - IE=Edge,chrome=1
405
+ etag:
406
+ - "\"5381cc1b80ec9455b884faf86ddd2bb4\""
407
+ cache-control:
408
+ - max-age=0, private, must-revalidate
409
+ x-request-id:
410
+ - 219bde66de79146d77ba00a209277d2d
411
+ x-runtime:
412
+ - "0.787113"
413
+ x-rack-cache:
414
+ - invalidate, pass
415
+ body:
416
+ encoding: US-ASCII
417
+ string: "{\"sender\":{\"id\":1000005,\"label\":\"vasiliy\",\"is_ip_based\":true,\"sent\":0,\"max_quota\":null,\"allowed_ips\":[]},\"message\":\"OK\",\"code\":0}"
418
+ http_version:
419
+ recorded_at: Sat, 09 Jun 2012 07:18:44 GMT
420
+ - request:
421
+ method: get
422
+ uri: http://rest.smtp.com/v1/account/senders/ipauth.json?api_key=373da51f9faa9bcac214cebe2a3b460c3697825d
423
+ body:
424
+ encoding: US-ASCII
425
+ string: ""
426
+ headers: {}
427
+
428
+ response:
429
+ status:
430
+ code: 200
431
+ message:
432
+ headers:
433
+ server:
434
+ - nginx/0.7.67
435
+ date:
436
+ - Sat, 09 Jun 2012 07:18:45 GMT
437
+ content-type:
438
+ - application/json; charset=utf-8
439
+ transfer-encoding:
440
+ - chunked
441
+ connection:
442
+ - close
443
+ status:
444
+ - 200 OK
445
+ access-control-allow-origin:
446
+ - "*"
447
+ access-control-allow-methods:
448
+ - GET
449
+ x-ua-compatible:
450
+ - IE=Edge,chrome=1
451
+ etag:
452
+ - "\"d0f17b540507a8f94da374feccca4eb1\""
453
+ cache-control:
454
+ - max-age=0, private, must-revalidate
455
+ x-request-id:
456
+ - 5397009b5175ffb7cd84e35e89b2c70d
457
+ x-runtime:
458
+ - "0.022047"
459
+ x-rack-cache:
460
+ - miss
461
+ body:
462
+ encoding: US-ASCII
463
+ string: "{\"sender\":{\"id\":1000026,\"label\":\"ipauth\",\"is_ip_based\":true,\"sent\":0,\"max_quota\":null,\"allowed_ips\":[]},\"message\":\"OK\",\"code\":0}"
464
+ http_version:
465
+ recorded_at: Sat, 09 Jun 2012 07:18:45 GMT
466
+ - request:
467
+ method: post
468
+ uri: http://rest.smtp.com/v1/account/senders/ipauth/allowed_ips.json
469
+ body:
470
+ encoding: US-ASCII
471
+ string: allowed_ip%5Brange%5D=233.221.1.2&api_key=373da51f9faa9bcac214cebe2a3b460c3697825d
472
+ headers:
473
+ Content-Type:
474
+ - application/x-www-form-urlencoded
475
+ response:
476
+ status:
477
+ code: 200
478
+ message:
479
+ headers:
480
+ server:
481
+ - nginx/0.7.67
482
+ date:
483
+ - Sat, 09 Jun 2012 07:18:46 GMT
484
+ content-type:
485
+ - application/json; charset=utf-8
486
+ transfer-encoding:
487
+ - chunked
488
+ connection:
489
+ - close
490
+ status:
491
+ - 200 OK
492
+ access-control-allow-origin:
493
+ - "*"
494
+ access-control-allow-methods:
495
+ - GET
496
+ x-ua-compatible:
497
+ - IE=Edge,chrome=1
498
+ etag:
499
+ - "\"ec009960b32e5de30fb93859e8126b0a\""
500
+ cache-control:
501
+ - max-age=0, private, must-revalidate
502
+ x-request-id:
503
+ - 60d2d8aacda2892a50f1bfdd49d583dc
504
+ x-runtime:
505
+ - "0.477299"
506
+ x-rack-cache:
507
+ - invalidate, pass
508
+ body:
509
+ encoding: US-ASCII
510
+ string: "{\"allowed_ip\":{\"range\":\"233.221.1.2\",\"is_active\":true},\"message\":\"OK\",\"code\":0}"
511
+ http_version:
512
+ recorded_at: Sat, 09 Jun 2012 07:18:47 GMT
513
+ - request:
514
+ method: delete
515
+ uri: http://rest.smtp.com/v1/account/senders/ipauth/allowed_ips/233%2E221%2E1%2E2.json?api_key=373da51f9faa9bcac214cebe2a3b460c3697825d
516
+ body:
517
+ encoding: US-ASCII
518
+ string: ""
519
+ headers: {}
520
+
521
+ response:
522
+ status:
523
+ code: 200
524
+ message:
525
+ headers:
526
+ server:
527
+ - nginx/0.7.67
528
+ date:
529
+ - Sat, 09 Jun 2012 07:20:36 GMT
530
+ content-type:
531
+ - application/json; charset=utf-8
532
+ transfer-encoding:
533
+ - chunked
534
+ connection:
535
+ - close
536
+ status:
537
+ - 200 OK
538
+ access-control-allow-origin:
539
+ - "*"
540
+ access-control-allow-methods:
541
+ - GET
542
+ x-ua-compatible:
543
+ - IE=Edge,chrome=1
544
+ etag:
545
+ - "\"b512ed4233ec58cdef91b4f1160c4cce\""
546
+ cache-control:
547
+ - max-age=0, private, must-revalidate
548
+ x-request-id:
549
+ - 61a830d505c2820b13f63bba0dfeb166
550
+ x-runtime:
551
+ - "0.024067"
552
+ x-rack-cache:
553
+ - invalidate, pass
554
+ body:
555
+ encoding: US-ASCII
556
+ string: "{\"message\":\"OK\",\"code\":0}"
557
+ http_version:
558
+ recorded_at: Sat, 09 Jun 2012 07:20:36 GMT
559
+ recorded_with: VCR 2.2.0