streamsend 1.0.0.rc6 → 1.0.0.rc7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/lib/streamsend/api/base/destroy.rb +2 -2
- data/lib/streamsend/api/base/update.rb +2 -2
- data/lib/streamsend/api/{trigger.rb → rss_trigger.rb} +9 -3
- data/lib/streamsend/version.rb +1 -1
- data/lib/streamsend.rb +1 -1
- data/spec/lib/streamsend/api/unit/{trigger_spec.rb → rss_trigger_spec.rb} +7 -17
- metadata +5 -7
- data/spec/lib/streamsend/api/integration/trigger_spec.rb +0 -89
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWNhNDU5ZTliYzI2ZWE2ZWRmNzNiMGQ5OTE0MWE4ZTE2NWMwMTg5OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjVmMGRmNjEzNDFlNjVmY2E3YWQxN2YxZDQ2NGUyNTQzOGVjMDJjOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWJjZGEwZWIzYWIxZTQ5ZjI1NzllOGI4ODJiNmIwZmNmNzRiMzc1NjgxYzA5
|
10
|
+
YmY0MTMzM2NiMjRlNTJiNzlhNDQ0NDY4NjBiNzY4MTQ4NjNjZDcwYTc3YzAw
|
11
|
+
ZWZhYzc3MGJkMjU3NzY2YjE0NjAwNDcxYTdhM2YyZDNhZWVhMGQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTUyOGQwNGM2NDFiYjIxNTI2NzZlZTRmZTE2ZGRjNWYyNTkyMDc2MWU5N2U4
|
14
|
+
ZTMxNGRmNTEwYzUyOTU3YzU2ZWQ5N2VlNzM0NmMxOGQyMDQwM2I0NzhhNmE3
|
15
|
+
MTRkNmY3NjRjNTM1ZGNlMjczN2U4ZTE5ZDAwNWE2OWY1MjQ2OTA=
|
data/Gemfile.lock
CHANGED
@@ -2,9 +2,9 @@ module StreamSend
|
|
2
2
|
module Api
|
3
3
|
module Call
|
4
4
|
class Destroy < StreamSend::Api::Call::BaseCall
|
5
|
-
def execute(object_id)
|
5
|
+
def execute(object_id, options = {})
|
6
6
|
@id = object_id
|
7
|
-
response = session.delete(uri)
|
7
|
+
response = session.delete(uri, options)
|
8
8
|
case response.code
|
9
9
|
when 200
|
10
10
|
true
|
@@ -2,9 +2,9 @@ module StreamSend
|
|
2
2
|
module Api
|
3
3
|
module Call
|
4
4
|
class Update < StreamSend::Api::Call::BaseCall
|
5
|
-
def execute(object_id, object_hash)
|
5
|
+
def execute(object_id, object_hash, options = {})
|
6
6
|
@id = object_id
|
7
|
-
response = session.put(uri, :body => object_hash)
|
7
|
+
response = session.put(uri, options.merge(:body => object_hash))
|
8
8
|
case response.code
|
9
9
|
when 200 then true
|
10
10
|
when 401 then raise StreamSend::Api::UnauthorizedException
|
@@ -1,10 +1,16 @@
|
|
1
1
|
module StreamSend
|
2
2
|
module Api
|
3
|
-
module
|
4
|
-
|
5
|
-
end
|
3
|
+
module RssTrigger
|
4
|
+
# No Index action
|
6
5
|
|
7
6
|
class Show < StreamSend::Api::Call::Show
|
7
|
+
def base_uri
|
8
|
+
"#{session.base_uri}/rss_triggers"
|
9
|
+
end
|
10
|
+
|
11
|
+
def namespace
|
12
|
+
"trigger"
|
13
|
+
end
|
8
14
|
end
|
9
15
|
|
10
16
|
class Update < StreamSend::Api::Call::Update
|
data/lib/streamsend/version.rb
CHANGED
data/lib/streamsend.rb
CHANGED
@@ -31,7 +31,7 @@ require "streamsend/api/list"
|
|
31
31
|
require "streamsend/api/import"
|
32
32
|
require "streamsend/api/membership"
|
33
33
|
require "streamsend/api/person"
|
34
|
-
require "streamsend/api/
|
34
|
+
require "streamsend/api/rss_trigger"
|
35
35
|
require "streamsend/api/unsubscribe"
|
36
36
|
require "streamsend/api/upload"
|
37
37
|
require "streamsend/api/view"
|
@@ -2,10 +2,9 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
module StreamSend
|
4
4
|
module Api
|
5
|
-
module
|
5
|
+
module RssTrigger
|
6
6
|
describe "Trigger calls" do
|
7
7
|
let(:session){ StreamSend::Api::Session.new("test", "password", "https://default.base") }
|
8
|
-
let(:index_request){ Index.new(session) }
|
9
8
|
let(:show_request){ Show.new(session) }
|
10
9
|
let(:create_request){ Create.new(session) }
|
11
10
|
let(:update_request){ Update.new(session) }
|
@@ -25,39 +24,30 @@ module StreamSend
|
|
25
24
|
let(:trigger_id){ 1234 }
|
26
25
|
let(:xml){ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><triggers type=\"array\"><trigger><test type=\"integer\">1</test></trigger></triggers>" }
|
27
26
|
|
28
|
-
describe Index do
|
29
|
-
it "creates a uri for getting an index of triggers" do
|
30
|
-
stub_request(:get, "https://test:password@default.base/triggers.xml").
|
31
|
-
to_return(:status => 200, :body => xml, :headers => {'Content-Type' => 'text/xml'})
|
32
|
-
index_request.execute
|
33
|
-
expect(index_request.uri).to eq("https://default.base/triggers.xml")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
27
|
describe Show do
|
38
28
|
it "creates a uri for getting a specific trigger" do
|
39
|
-
stub_request(:get, "https://test:password@default.base/
|
29
|
+
stub_request(:get, "https://test:password@default.base/rss_triggers/#{trigger_id}.xml").
|
40
30
|
to_return(:status => 200, :body => xml, :headers => {'Content-Type' => 'text/xml'})
|
41
31
|
show_request.execute(trigger_id)
|
42
|
-
expect(show_request.uri).to eq("https://default.base/
|
32
|
+
expect(show_request.uri).to eq("https://default.base/rss_triggers/#{trigger_id}.xml")
|
43
33
|
end
|
44
34
|
end
|
45
35
|
|
46
36
|
describe Create do
|
47
37
|
it "creates a uri for creating a trigger" do
|
48
|
-
stub_request(:post, "https://test:password@default.base/
|
38
|
+
stub_request(:post, "https://test:password@default.base/rss_triggers.xml").
|
49
39
|
to_return(:status => 201, :body => "", :headers => {'Location' => 'something/something/101'})
|
50
40
|
create_request.execute(trigger_hash)
|
51
|
-
expect(create_request.uri).to eq("https://default.base/
|
41
|
+
expect(create_request.uri).to eq("https://default.base/rss_triggers.xml")
|
52
42
|
end
|
53
43
|
end
|
54
44
|
|
55
45
|
describe Update do
|
56
46
|
it "creates a uri for updating a trigger" do
|
57
|
-
stub_request(:put, "https://test:password@default.base/
|
47
|
+
stub_request(:put, "https://test:password@default.base/rss_triggers/#{trigger_id}.xml").
|
58
48
|
to_return(:status => 200, :body => "")
|
59
49
|
update_request.execute(trigger_id, trigger_hash)
|
60
|
-
expect(update_request.uri).to eq("https://default.base/
|
50
|
+
expect(update_request.uri).to eq("https://default.base/rss_triggers/#{trigger_id}.xml")
|
61
51
|
end
|
62
52
|
end
|
63
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: streamsend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Yeo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httmultiparty
|
@@ -177,8 +177,8 @@ files:
|
|
177
177
|
- lib/streamsend/api/membership.rb
|
178
178
|
- lib/streamsend/api/person.rb
|
179
179
|
- lib/streamsend/api/result.rb
|
180
|
+
- lib/streamsend/api/rss_trigger.rb
|
180
181
|
- lib/streamsend/api/session.rb
|
181
|
-
- lib/streamsend/api/trigger.rb
|
182
182
|
- lib/streamsend/api/unsubscribe.rb
|
183
183
|
- lib/streamsend/api/upload.rb
|
184
184
|
- lib/streamsend/api/user.rb
|
@@ -200,7 +200,6 @@ files:
|
|
200
200
|
- spec/lib/streamsend/api/integration/list_spec.rb
|
201
201
|
- spec/lib/streamsend/api/integration/membership_spec.rb
|
202
202
|
- spec/lib/streamsend/api/integration/person_spec.rb
|
203
|
-
- spec/lib/streamsend/api/integration/trigger_spec.rb
|
204
203
|
- spec/lib/streamsend/api/integration/unsubscribe_spec.rb
|
205
204
|
- spec/lib/streamsend/api/integration/upload_spec.rb
|
206
205
|
- spec/lib/streamsend/api/integration/user_spec.rb
|
@@ -221,8 +220,8 @@ files:
|
|
221
220
|
- spec/lib/streamsend/api/unit/membership_spec.rb
|
222
221
|
- spec/lib/streamsend/api/unit/person_spec.rb
|
223
222
|
- spec/lib/streamsend/api/unit/result_spec.rb
|
223
|
+
- spec/lib/streamsend/api/unit/rss_trigger_spec.rb
|
224
224
|
- spec/lib/streamsend/api/unit/session_spec.rb
|
225
|
-
- spec/lib/streamsend/api/unit/trigger_spec.rb
|
226
225
|
- spec/lib/streamsend/api/unit/unsubscribe_spec.rb
|
227
226
|
- spec/lib/streamsend/api/unit/user_spec.rb
|
228
227
|
- spec/spec_helper.rb
|
@@ -267,7 +266,6 @@ test_files:
|
|
267
266
|
- spec/lib/streamsend/api/integration/list_spec.rb
|
268
267
|
- spec/lib/streamsend/api/integration/membership_spec.rb
|
269
268
|
- spec/lib/streamsend/api/integration/person_spec.rb
|
270
|
-
- spec/lib/streamsend/api/integration/trigger_spec.rb
|
271
269
|
- spec/lib/streamsend/api/integration/unsubscribe_spec.rb
|
272
270
|
- spec/lib/streamsend/api/integration/upload_spec.rb
|
273
271
|
- spec/lib/streamsend/api/integration/user_spec.rb
|
@@ -288,8 +286,8 @@ test_files:
|
|
288
286
|
- spec/lib/streamsend/api/unit/membership_spec.rb
|
289
287
|
- spec/lib/streamsend/api/unit/person_spec.rb
|
290
288
|
- spec/lib/streamsend/api/unit/result_spec.rb
|
289
|
+
- spec/lib/streamsend/api/unit/rss_trigger_spec.rb
|
291
290
|
- spec/lib/streamsend/api/unit/session_spec.rb
|
292
|
-
- spec/lib/streamsend/api/unit/trigger_spec.rb
|
293
291
|
- spec/lib/streamsend/api/unit/unsubscribe_spec.rb
|
294
292
|
- spec/lib/streamsend/api/unit/user_spec.rb
|
295
293
|
- spec/spec_helper.rb
|
@@ -1,89 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module StreamSend
|
4
|
-
module Api
|
5
|
-
module Trigger
|
6
|
-
describe "Trigger calls" do
|
7
|
-
let(:session){ StreamSend::Api::Session.new() }
|
8
|
-
let(:create_request){ Create.new(session) }
|
9
|
-
let(:destroy_request){ Destroy.new(session) }
|
10
|
-
let(:from_addy){ "jo@yo.yoyo" }
|
11
|
-
|
12
|
-
before do
|
13
|
-
WebMock.disable!
|
14
|
-
emails = StreamSend::Api::Email::Index.new(session).execute
|
15
|
-
email_id = emails[0].id
|
16
|
-
from_emails = StreamSend::Api::FromEmailAddress::Index.new(session).execute
|
17
|
-
@from_email = from_emails.select{|email| email.activated == true}.first
|
18
|
-
@trigger = { :trigger => { :name => "test trigs",
|
19
|
-
:enabled => true,
|
20
|
-
:subject => "testing this yo!",
|
21
|
-
:email_id => email_id,
|
22
|
-
:start_date => "2013-05-27",
|
23
|
-
:time => "T03:44:55Z",
|
24
|
-
:frequency => "weekly",
|
25
|
-
:interval => 2,
|
26
|
-
:days => 1,
|
27
|
-
:from => {:name => "jo", :email_address => @from_email.email_address },
|
28
|
-
:reply_to => {:name => "jack", :email_address => @from_email.email_address },
|
29
|
-
:to => {:audience_id => 1 },
|
30
|
-
:options => {:track_views => true}}}
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
after do
|
35
|
-
WebMock.enable!
|
36
|
-
end
|
37
|
-
|
38
|
-
describe Index do
|
39
|
-
it "returns an array of triggers" do
|
40
|
-
pending "No activated from email addresses for this account" if !@from_email
|
41
|
-
id = create_request.execute(@trigger)
|
42
|
-
|
43
|
-
index_request = Index.new(session)
|
44
|
-
triggers = index_request.execute
|
45
|
-
expect(triggers.count).to be > 0
|
46
|
-
|
47
|
-
destroy_request.execute(id)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe Show do
|
52
|
-
it "returns a specific trigger by id" do
|
53
|
-
pending "No activated from email addresses for this account" if !@from_email
|
54
|
-
id = create_request.execute(@trigger)
|
55
|
-
|
56
|
-
show_request = Show.new(session)
|
57
|
-
trigger = show_request.execute(id)
|
58
|
-
expect(trigger.name).to eq(@trigger[:trigger][:name])
|
59
|
-
|
60
|
-
destroy_request.execute(id)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe Create do
|
65
|
-
it "creates a trigger" do
|
66
|
-
pending "No activated from email addresses for this account" if !@from_email
|
67
|
-
id = create_request.execute(@trigger)
|
68
|
-
|
69
|
-
expect(id).to_not be nil
|
70
|
-
destroy_request.execute(id)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe Destroy do
|
75
|
-
it "destroys a trigger" do
|
76
|
-
pending "No activated from email addresses for this account" if !@from_email
|
77
|
-
id = create_request.execute(@trigger)
|
78
|
-
expect(id).to_not be nil
|
79
|
-
destroy_request.execute(id)
|
80
|
-
expect do
|
81
|
-
show_request = Show.new(session)
|
82
|
-
user = show_request.execute(id)
|
83
|
-
end.to raise_exception(StreamSend::Api::Exception, "Could not find any triggers with the specified id. (404)")
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|