streamsend 0.2.3 → 1.0.0.rc1
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/.gitignore +18 -5
- data/.rspec +1 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +25 -17
- data/README.md +76 -0
- data/Rakefile +1 -2
- data/lib/streamsend/api/account.rb +6 -48
- data/lib/streamsend/api/audience.rb +14 -0
- data/lib/streamsend/api/base/base_call.rb +60 -0
- data/lib/streamsend/api/base/create.rb +41 -0
- data/lib/streamsend/api/base/destroy.rb +43 -0
- data/lib/streamsend/api/base/index.rb +51 -0
- data/lib/streamsend/api/base/show.rb +42 -0
- data/lib/streamsend/api/base/update.rb +43 -0
- data/lib/streamsend/api/blast.rb +51 -0
- data/lib/streamsend/api/bounce.rb +20 -0
- data/lib/streamsend/api/click.rb +18 -0
- data/lib/streamsend/api/configuration.rb +26 -0
- data/lib/streamsend/api/email.rb +20 -0
- data/lib/streamsend/api/exception.rb +4 -4
- data/lib/streamsend/api/field.rb +20 -0
- data/lib/streamsend/api/field_option.rb +60 -0
- data/lib/streamsend/api/filter.rb +20 -0
- data/lib/streamsend/api/from_email_address.rb +24 -0
- data/lib/streamsend/api/import.rb +11 -0
- data/lib/streamsend/api/link.rb +11 -0
- data/lib/streamsend/api/list.rb +13 -39
- data/lib/streamsend/api/membership.rb +28 -0
- data/lib/streamsend/api/person.rb +66 -0
- data/lib/streamsend/api/result.rb +13 -0
- data/lib/streamsend/api/session.rb +73 -0
- data/lib/streamsend/api/unsubscribe.rb +20 -0
- data/lib/streamsend/api/upload.rb +13 -0
- data/lib/streamsend/api/user.rb +67 -38
- data/lib/streamsend/api/view.rb +8 -0
- data/lib/streamsend/version.rb +3 -0
- data/lib/streamsend.rb +35 -16
- data/spec/lib/streamsend/api/integration/account_spec.rb +50 -0
- data/spec/lib/streamsend/api/integration/audience_spec.rb +56 -0
- data/spec/lib/streamsend/api/integration/blast_spec.rb +110 -0
- data/spec/lib/streamsend/api/integration/bounce_spec.rb +43 -0
- data/spec/lib/streamsend/api/integration/click_spec.rb +37 -0
- data/spec/lib/streamsend/api/integration/email_spec.rb +76 -0
- data/spec/lib/streamsend/api/integration/field_option_spec.rb +87 -0
- data/spec/lib/streamsend/api/integration/field_spec.rb +75 -0
- data/spec/lib/streamsend/api/integration/filter_spec.rb +101 -0
- data/spec/lib/streamsend/api/integration/from_email_address_spec.rb +46 -0
- data/spec/lib/streamsend/api/integration/helpers.rb +16 -0
- data/spec/lib/streamsend/api/integration/import_spec.rb +35 -0
- data/spec/lib/streamsend/api/integration/link_spec.rb +39 -0
- data/spec/lib/streamsend/api/integration/list_spec.rb +83 -0
- data/spec/lib/streamsend/api/integration/membership_spec.rb +69 -0
- data/spec/lib/streamsend/api/integration/person_spec.rb +119 -0
- data/spec/lib/streamsend/api/integration/unsubscribe_spec.rb +47 -0
- data/spec/lib/streamsend/api/integration/upload_spec.rb +29 -0
- data/spec/lib/streamsend/api/integration/user_spec.rb +99 -0
- data/spec/lib/streamsend/api/integration/view_spec.rb +27 -0
- data/spec/lib/streamsend/api/unit/base/base_call_spec.rb +66 -0
- data/spec/lib/streamsend/api/unit/base/create_spec.rb +67 -0
- data/spec/lib/streamsend/api/unit/base/destroy_spec.rb +59 -0
- data/spec/lib/streamsend/api/unit/base/index_spec.rb +85 -0
- data/spec/lib/streamsend/api/unit/base/show_spec.rb +68 -0
- data/spec/lib/streamsend/api/unit/base/update_spec.rb +76 -0
- data/spec/lib/streamsend/api/unit/blast_spec.rb +79 -0
- data/spec/lib/streamsend/api/unit/bounce_spec.rb +36 -0
- data/spec/lib/streamsend/api/unit/click_spec.rb +34 -0
- data/spec/lib/streamsend/api/unit/field_option_spec.rb +71 -0
- data/spec/lib/streamsend/api/unit/from_email_address_spec.rb +20 -0
- data/spec/lib/streamsend/api/unit/link_spec.rb +33 -0
- data/spec/lib/streamsend/api/unit/list_spec.rb +33 -0
- data/spec/lib/streamsend/api/unit/membership_spec.rb +46 -0
- data/spec/lib/streamsend/api/unit/person_spec.rb +102 -0
- data/spec/lib/streamsend/api/unit/result_spec.rb +13 -0
- data/spec/lib/streamsend/api/unit/session_spec.rb +62 -0
- data/spec/lib/streamsend/api/unit/unsubscribe_spec.rb +33 -0
- data/spec/lib/streamsend/api/unit/user_spec.rb +102 -0
- data/spec/spec_helper.rb +8 -11
- data/streamsend.gemspec +22 -23
- metadata +250 -178
- checksums.yaml +0 -7
- data/.pair +0 -10
- data/README.rdoc +0 -1
- data/lib/streamsend/api/resource.rb +0 -41
- data/lib/streamsend/api/subscriber.rb +0 -113
- data/spec/integration/account_spec.rb +0 -69
- data/spec/integration/fixtures/vcr_cassettes/streamsend.yml +0 -6831
- data/spec/integration/integration.yml +0 -5
- data/spec/integration/list_spec.rb +0 -68
- data/spec/integration/spec_helper.rb +0 -16
- data/spec/integration/subscriber_spec.rb +0 -24
- data/spec/integration/user_spec.rb +0 -58
- data/spec/lib/streamsend/api/list_spec.rb +0 -179
- data/spec/lib/streamsend/api/resource_spec.rb +0 -24
- data/spec/lib/streamsend/api/subscriber_spec.rb +0 -345
- data/spec/lib/streamsend/api/user_spec.rb +0 -149
- data/spec/lib/streamsend/api_spec.rb +0 -31
- data/watcher_config.rb +0 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module StreamSend
|
|
2
|
+
module Api
|
|
3
|
+
module Integration
|
|
4
|
+
class Helpers
|
|
5
|
+
def self.create_upload_file(file_path, number_of_subscribers = 10)
|
|
6
|
+
file_contents = ""
|
|
7
|
+
number_of_subscribers.times do |n|
|
|
8
|
+
file_contents << "streamsendqa+#{DateTime.now.to_i.to_s}+#{n}@gmail.com\tUser#{n}\tTester\n"
|
|
9
|
+
end
|
|
10
|
+
File.open(file_path, "w") { |file| file.write file_contents }
|
|
11
|
+
file_path
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
require "spec/lib/streamsend/api/integration/helpers"
|
|
3
|
+
|
|
4
|
+
module StreamSend
|
|
5
|
+
module Api
|
|
6
|
+
module Import
|
|
7
|
+
describe "Import calls" do
|
|
8
|
+
let(:session){ StreamSend::Api::Session.new() }
|
|
9
|
+
let(:file_path){ "test.txt" }
|
|
10
|
+
|
|
11
|
+
before do
|
|
12
|
+
WebMock.disable!
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
after do
|
|
16
|
+
WebMock.enable!
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe Show do
|
|
20
|
+
it "returns a import by id" do
|
|
21
|
+
StreamSend::Api::Integration::Helpers.create_upload_file(file_path)
|
|
22
|
+
upload_creator = StreamSend::Api::Upload::Create.new(session)
|
|
23
|
+
upload_id = upload_creator.execute(file_path)
|
|
24
|
+
creator = Create.new(session)
|
|
25
|
+
import_hash = { :import => { :upload_id => upload_id, :separator => "Tab", :columns => { :column => "email_address" } } }
|
|
26
|
+
id = creator.execute(import_hash)
|
|
27
|
+
shower = Show.new(session)
|
|
28
|
+
import = shower.execute(id)
|
|
29
|
+
expect(import.id).to eq(id)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module StreamSend
|
|
4
|
+
module Api
|
|
5
|
+
module Link
|
|
6
|
+
describe "Link calls" do
|
|
7
|
+
let(:session){ StreamSend::Api::Session.new() }
|
|
8
|
+
let(:blast_id) { 70361 }
|
|
9
|
+
|
|
10
|
+
before do
|
|
11
|
+
WebMock.disable!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
after do
|
|
15
|
+
WebMock.enable!
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe Index do
|
|
19
|
+
it "returns an array of links" do
|
|
20
|
+
indexer = Index.new(session)
|
|
21
|
+
links = indexer.execute(blast_id)
|
|
22
|
+
expect(links.count).to be > 0
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe Show do
|
|
27
|
+
it "returns a link by id" do
|
|
28
|
+
indexer = Index.new(session)
|
|
29
|
+
links = indexer.execute(blast_id)
|
|
30
|
+
link = links[0]
|
|
31
|
+
shower = Show.new(session)
|
|
32
|
+
same_link = shower.execute(blast_id, link.id)
|
|
33
|
+
expect(link.url).to eq(same_link.url)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module StreamSend
|
|
4
|
+
module Api
|
|
5
|
+
module List
|
|
6
|
+
describe "List calls" do
|
|
7
|
+
let(:session){ StreamSend::Api::Session.new() }
|
|
8
|
+
let(:list_hash){ { :list => { :name => "New list #{DateTime.now.to_i.to_s}" } } }
|
|
9
|
+
|
|
10
|
+
before do
|
|
11
|
+
WebMock.disable!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
after do
|
|
15
|
+
WebMock.enable!
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe Index do
|
|
19
|
+
it "returns an array of lists" do
|
|
20
|
+
creator = Create.new(session)
|
|
21
|
+
id = creator.execute(list_hash)
|
|
22
|
+
|
|
23
|
+
indexer = Index.new(session)
|
|
24
|
+
lists = indexer.execute
|
|
25
|
+
expect(lists.count).to be > 0
|
|
26
|
+
|
|
27
|
+
destroyer = Destroy.new(session)
|
|
28
|
+
destroyer.execute(id)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe Show do
|
|
33
|
+
it "returns a list by id" do
|
|
34
|
+
creator = Create.new(session)
|
|
35
|
+
id = creator.execute(list_hash)
|
|
36
|
+
|
|
37
|
+
shower = Show.new(session)
|
|
38
|
+
list = shower.execute(id)
|
|
39
|
+
expect(list.name).to eq(list_hash[:list][:name])
|
|
40
|
+
expect(list.id).to eq(id)
|
|
41
|
+
|
|
42
|
+
destroyer = Destroy.new(session)
|
|
43
|
+
destroyer.execute(id)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe Update do
|
|
48
|
+
it "updates an list" do
|
|
49
|
+
creator = Create.new(session)
|
|
50
|
+
id = creator.execute(list_hash)
|
|
51
|
+
|
|
52
|
+
shower = Show.new(session)
|
|
53
|
+
list = shower.execute(id)
|
|
54
|
+
list.name = "newer namers!"
|
|
55
|
+
updater = Update.new(session)
|
|
56
|
+
updater.execute(id, list.marshal_dump)
|
|
57
|
+
list_updated = shower.execute(id)
|
|
58
|
+
expect(list_updated.name).to eq(list_hash[:list][:name])
|
|
59
|
+
expect(list_updated.id).to eq(id)
|
|
60
|
+
|
|
61
|
+
destroyer = Destroy.new(session)
|
|
62
|
+
destroyer.execute(id)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
describe Destroy do
|
|
67
|
+
it "destroys a list" do
|
|
68
|
+
creator = Create.new(session)
|
|
69
|
+
id = creator.execute(list_hash)
|
|
70
|
+
|
|
71
|
+
destroyer = Destroy.new(session)
|
|
72
|
+
destroyer.execute(id)
|
|
73
|
+
|
|
74
|
+
expect do
|
|
75
|
+
shower = Show.new(session)
|
|
76
|
+
list = shower.execute(id)
|
|
77
|
+
end.to raise_exception(StreamSend::Api::Exception, "Could not find any lists with the specified id. (404)")
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module StreamSend
|
|
4
|
+
module Api
|
|
5
|
+
module Membership
|
|
6
|
+
describe "Membership calls" do
|
|
7
|
+
let(:session){ StreamSend::Api::Session.new() }
|
|
8
|
+
let(:list_creator){ StreamSend::Api::List::Create.new(session) }
|
|
9
|
+
let(:list_hash){ { :list => { :name => "New list #{DateTime.now.to_i.to_s}" } } }
|
|
10
|
+
let(:list_id){ list_creator.execute(list_hash) }
|
|
11
|
+
let(:people_creator){ StreamSend::Api::Person::Create.new(session) }
|
|
12
|
+
let(:person_hash){ { :person => { :email_address => "what+#{DateTime.now.to_i.to_s}@are.you" } } }
|
|
13
|
+
let(:person_id){ people_creator.execute(person_hash) }
|
|
14
|
+
let(:membership_hash){ { :membership => { :list_id => list_id, :person_id => person_id } } }
|
|
15
|
+
|
|
16
|
+
before do
|
|
17
|
+
WebMock.disable!
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
after do
|
|
21
|
+
WebMock.enable!
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe Index do
|
|
25
|
+
it "returns an array of memberships" do
|
|
26
|
+
creator = Create.new(session)
|
|
27
|
+
id = creator.execute(membership_hash)
|
|
28
|
+
|
|
29
|
+
indexer = Index.new(session)
|
|
30
|
+
memberships = indexer.execute(person_id)
|
|
31
|
+
expect(memberships.count).to be > 0
|
|
32
|
+
|
|
33
|
+
destroyer = Destroy.new(session)
|
|
34
|
+
destroyer.execute(id)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
describe Show do
|
|
39
|
+
it "returns a membership by id" do
|
|
40
|
+
creator = Create.new(session)
|
|
41
|
+
id = creator.execute(membership_hash)
|
|
42
|
+
|
|
43
|
+
shower = Show.new(session)
|
|
44
|
+
membership = shower.execute(id)
|
|
45
|
+
expect(membership.id).to eq(id)
|
|
46
|
+
|
|
47
|
+
destroyer = Destroy.new(session)
|
|
48
|
+
destroyer.execute(id)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
describe Destroy do
|
|
53
|
+
it "destroys a membership" do
|
|
54
|
+
creator = Create.new(session)
|
|
55
|
+
id = creator.execute(membership_hash)
|
|
56
|
+
|
|
57
|
+
destroyer = Destroy.new(session)
|
|
58
|
+
destroyer.execute(id)
|
|
59
|
+
|
|
60
|
+
expect do
|
|
61
|
+
shower = Show.new(session)
|
|
62
|
+
membership = shower.execute(id)
|
|
63
|
+
end.to raise_exception(StreamSend::Api::Exception, "Could not find any memberships with the specified id. (404)")
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module StreamSend
|
|
4
|
+
module Api
|
|
5
|
+
module Person
|
|
6
|
+
describe "Person calls" do
|
|
7
|
+
let(:session){ StreamSend::Api::Session.new() }
|
|
8
|
+
let(:randomish){ DateTime.now.to_i.to_s }
|
|
9
|
+
let(:person_hash){ { :person => { :email_address => "joe+#{randomish}@some.place" } } }
|
|
10
|
+
|
|
11
|
+
before do
|
|
12
|
+
WebMock.disable!
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
after do
|
|
16
|
+
WebMock.enable!
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe Index do
|
|
20
|
+
it "returns an array of people" do
|
|
21
|
+
creator = Create.new(session)
|
|
22
|
+
id = creator.execute(person_hash)
|
|
23
|
+
|
|
24
|
+
indexer = Index.new(session)
|
|
25
|
+
people = indexer.execute
|
|
26
|
+
expect(people.count).to be > 0
|
|
27
|
+
|
|
28
|
+
# destroyer = Destroy.new(session)
|
|
29
|
+
# destroyer.execute(id)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe Click do
|
|
34
|
+
let(:peopler){ Click.new(session) }
|
|
35
|
+
let(:blast_id) { 70361 }
|
|
36
|
+
let(:link_id) { 27581 }
|
|
37
|
+
it "returns an array of people" do
|
|
38
|
+
people = peopler.execute(blast_id)
|
|
39
|
+
expect(people.count).to be > 0
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "returns an array of people for a link click by link id" do
|
|
43
|
+
people = peopler.execute(blast_id, link_id)
|
|
44
|
+
expect(people.count).to be > 0
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
describe View do
|
|
49
|
+
let(:viewer){ View.new(session) }
|
|
50
|
+
let(:blast_id) { 72761 }
|
|
51
|
+
it "returns an array of people" do
|
|
52
|
+
people = viewer.execute(blast_id)
|
|
53
|
+
expect(people.count).to be > 0
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
describe Activate do
|
|
58
|
+
it "activates a new user" do
|
|
59
|
+
creator = Create.new(session)
|
|
60
|
+
id = creator.execute(person_hash)
|
|
61
|
+
activator = Activate.new(session)
|
|
62
|
+
expect(activator.execute(id).code).to eq(200)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
describe Unsubscribe do
|
|
67
|
+
it "unsubscribes a new user" do
|
|
68
|
+
creator = Create.new(session)
|
|
69
|
+
id = creator.execute(person_hash)
|
|
70
|
+
activator = Activate.new(session)
|
|
71
|
+
expect(activator.execute(id).code).to eq(200)
|
|
72
|
+
unsuber = Unsubscribe.new(session)
|
|
73
|
+
expect(unsuber.execute(id).code).to eq(200)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
describe Show do
|
|
78
|
+
it "returns a person by id" do
|
|
79
|
+
creator = Create.new(session)
|
|
80
|
+
id = creator.execute(person_hash)
|
|
81
|
+
|
|
82
|
+
shower = Show.new(session)
|
|
83
|
+
person = shower.execute(id)
|
|
84
|
+
expect(person.email_address).to eq(person_hash[:person][:email_address])
|
|
85
|
+
expect(person.id).to eq(id)
|
|
86
|
+
|
|
87
|
+
# destroyer = Destroy.new(session)
|
|
88
|
+
# destroyer.execute(id)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
describe Update do
|
|
93
|
+
it "updates a person" do
|
|
94
|
+
creator = Create.new(session)
|
|
95
|
+
id = creator.execute(person_hash)
|
|
96
|
+
|
|
97
|
+
shower = Show.new(session)
|
|
98
|
+
person = shower.execute(id)
|
|
99
|
+
person.email_address = "me+#{randomish}@you.too"
|
|
100
|
+
updater = Update.new(session)
|
|
101
|
+
updater.execute(id, person.marshal_dump)
|
|
102
|
+
person_updated = shower.execute(id)
|
|
103
|
+
expect(person_updated.email_address).to eq(person_hash[:person][:email_address])
|
|
104
|
+
expect(person_updated.id).to eq(id)
|
|
105
|
+
|
|
106
|
+
# destroyer = Destroy.new(session)
|
|
107
|
+
# destroyer.execute(id)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
describe Destroy do
|
|
112
|
+
it "removes the specified person" do
|
|
113
|
+
pending "Destory not enabled for this account."
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module StreamSend
|
|
4
|
+
module Api
|
|
5
|
+
module Unsubscribe
|
|
6
|
+
describe "Unsubscribe calls" do
|
|
7
|
+
let(:session){ StreamSend::Api::Session.new() }
|
|
8
|
+
let(:blast_id){ 72061 }
|
|
9
|
+
|
|
10
|
+
before do
|
|
11
|
+
WebMock.disable!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
after do
|
|
15
|
+
WebMock.enable!
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe Index do
|
|
19
|
+
it "returns an array of unsubscribes" do
|
|
20
|
+
indexer = Index.new(session)
|
|
21
|
+
unsubs = indexer.execute(blast_id)
|
|
22
|
+
expect(unsubs.count).to be > 0
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
describe Manual do
|
|
27
|
+
it "returns an array of manual unsubscribes" do
|
|
28
|
+
manualer = Manual.new(session)
|
|
29
|
+
unsubs = manualer.execute(blast_id)
|
|
30
|
+
expect(unsubs.count).to be > 0
|
|
31
|
+
expect(unsubs[0].source).to eq("manual")
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe Complaint do
|
|
36
|
+
it "returns an array of complaint unsubscribes" do
|
|
37
|
+
pending "Unsure how to generate a complaint."
|
|
38
|
+
complainer = Complaint.new(session)
|
|
39
|
+
unsubs = complainer.execute(blast_id)
|
|
40
|
+
expect(unsubs.count).to be > 0
|
|
41
|
+
expect(unsubs[0].source).to eq("complaint")
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module StreamSend
|
|
4
|
+
module Api
|
|
5
|
+
module Upload
|
|
6
|
+
describe "Upload calls" do
|
|
7
|
+
let(:session){ StreamSend::Api::Session.new() }
|
|
8
|
+
let(:file_path){ "test.txt" }
|
|
9
|
+
|
|
10
|
+
before do
|
|
11
|
+
WebMock.disable!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
after do
|
|
15
|
+
WebMock.enable!
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe Create do
|
|
19
|
+
it "creates an upload" do
|
|
20
|
+
creator = Create.new(session)
|
|
21
|
+
StreamSend::Api::Integration::Helpers.create_upload_file(file_path)
|
|
22
|
+
upload_id = creator.execute(file_path)
|
|
23
|
+
expect(upload_id).to_not be nil
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module StreamSend
|
|
4
|
+
module Api
|
|
5
|
+
module User
|
|
6
|
+
describe "User calls" do
|
|
7
|
+
let(:session){ StreamSend::Api::Session.new() }
|
|
8
|
+
let(:ran){ DateTime.now.to_i.to_s }
|
|
9
|
+
let(:user_hash){ { :user => { :first_name => "Joe", :last_name => "Number #{ran}", :email_address => "me+#{ran}@tesing.this", :password => "password12" } } }
|
|
10
|
+
|
|
11
|
+
before do
|
|
12
|
+
WebMock.disable!
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
after do
|
|
16
|
+
WebMock.enable!
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe Index do
|
|
20
|
+
it "returns an array of users" do
|
|
21
|
+
creator = Create.new(session)
|
|
22
|
+
id = creator.execute(user_hash)
|
|
23
|
+
|
|
24
|
+
indexer = Index.new(session)
|
|
25
|
+
users = indexer.execute
|
|
26
|
+
expect(users.count).to be > 0
|
|
27
|
+
|
|
28
|
+
destroyer = Destroy.new(session)
|
|
29
|
+
destroyer.execute(id)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe Show do
|
|
34
|
+
it "returns a user by id" do
|
|
35
|
+
creator = Create.new(session)
|
|
36
|
+
id = creator.execute(user_hash)
|
|
37
|
+
|
|
38
|
+
shower = Show.new(session)
|
|
39
|
+
user = shower.execute(id)
|
|
40
|
+
expect(user.first_name).to eq(user_hash[:user][:first_name])
|
|
41
|
+
expect(user.id).to eq(id)
|
|
42
|
+
|
|
43
|
+
destroyer = Destroy.new(session)
|
|
44
|
+
destroyer.execute(id)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
describe Update do
|
|
49
|
+
it "updates an user" do
|
|
50
|
+
creator = Create.new(session)
|
|
51
|
+
id = creator.execute(user_hash)
|
|
52
|
+
|
|
53
|
+
shower = Show.new(session)
|
|
54
|
+
user = shower.execute(id)
|
|
55
|
+
user.first_name = "newer namers!"
|
|
56
|
+
updater = Update.new(session)
|
|
57
|
+
updater.execute(id, user.marshal_dump)
|
|
58
|
+
user_updated = shower.execute(id)
|
|
59
|
+
expect(user_updated.name).to eq(user_hash[:user][:name])
|
|
60
|
+
expect(user_updated.id).to eq(id)
|
|
61
|
+
|
|
62
|
+
destroyer = Destroy.new(session)
|
|
63
|
+
destroyer.execute(id)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
describe Destroy do
|
|
68
|
+
it "destroys a list" do
|
|
69
|
+
creator = Create.new(session)
|
|
70
|
+
id = creator.execute(user_hash)
|
|
71
|
+
|
|
72
|
+
destroyer = Destroy.new(session)
|
|
73
|
+
destroyer.execute(id)
|
|
74
|
+
|
|
75
|
+
expect do
|
|
76
|
+
shower = Show.new(session)
|
|
77
|
+
user = shower.execute(id)
|
|
78
|
+
end.to raise_exception(StreamSend::Api::Exception, "Could not find any users with the specified id. (404)")
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
describe Login do
|
|
83
|
+
it "returns an expiring login token" do
|
|
84
|
+
creator = Create.new(session)
|
|
85
|
+
id = creator.execute(user_hash)
|
|
86
|
+
|
|
87
|
+
loginer = Login.new(session)
|
|
88
|
+
expect do
|
|
89
|
+
loginer.execute(id)
|
|
90
|
+
end.to_not raise_exception
|
|
91
|
+
|
|
92
|
+
destroyer = Destroy.new(session)
|
|
93
|
+
destroyer.execute(id)
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module StreamSend
|
|
4
|
+
module Api
|
|
5
|
+
module View
|
|
6
|
+
describe "View calls" do
|
|
7
|
+
let(:session){ StreamSend::Api::Session.new() }
|
|
8
|
+
let(:blast_id){ 72761 }
|
|
9
|
+
|
|
10
|
+
before do
|
|
11
|
+
WebMock.disable!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
after do
|
|
15
|
+
WebMock.enable!
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe Index do
|
|
19
|
+
it "returns an array of views" do
|
|
20
|
+
indexer = Index.new(session)
|
|
21
|
+
expect(indexer.execute(blast_id).count).to be > 0
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
module StreamSend
|
|
4
|
+
module Api
|
|
5
|
+
module Call
|
|
6
|
+
describe BaseCall do
|
|
7
|
+
let(:session){ StreamSend::Api::Session.new("test", "password", "http://default.base") }
|
|
8
|
+
let(:base){ BaseCall.new(session) }
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
describe "#namespace" do
|
|
12
|
+
it "should infer the enclosing module name from the namespacing" do
|
|
13
|
+
expect(base.namespace).to eq("calls")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "should tableize, and downcase the enclosing module name" do
|
|
17
|
+
base.stub_chain(:class, :name).and_return("StreamSend::Api::SingularName::BaseCall")
|
|
18
|
+
expect(base.namespace).to eq("singular_names")
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
it "creates a base_uri based on the session and namespace" do
|
|
24
|
+
expect(base.base_uri).to eq("http://default.base/calls")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe "Blast Uris" do
|
|
28
|
+
let(:blast_id){ 122 }
|
|
29
|
+
|
|
30
|
+
it "should provide a base url for the blast id provided" do
|
|
31
|
+
expect(base.base_blast_uri_for(blast_id)).to eq("http://default.base/blasts/122/calls")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should provide a base url for the blast id provided" do
|
|
35
|
+
expect(base.blast_uri_for(blast_id)).to eq("http://default.base/blasts/122/calls.xml")
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
describe "Audience Uris" do
|
|
40
|
+
before do
|
|
41
|
+
xml = <<-XML
|
|
42
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
43
|
+
<audiences type="array">
|
|
44
|
+
<audience>
|
|
45
|
+
<id type="integer">1</id>
|
|
46
|
+
</audience>
|
|
47
|
+
</audiences>
|
|
48
|
+
XML
|
|
49
|
+
stub_request(:get, "http://test:password@default.base/audiences.xml").to_return(:status => 200, :body => xml, :headers => {'Content-Type' => 'text/xml'})
|
|
50
|
+
end
|
|
51
|
+
it "creates a base_audience__uri based on the session and namespace" do
|
|
52
|
+
expect(base.base_audience_uri).to eq("http://default.base/audiences/1/calls")
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "creates a audience uri for the id provided" do
|
|
56
|
+
expect(base.audience_uri_for(1)).to eq("http://default.base/audiences/1/calls/1.xml")
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "createa a audience uri for the index call" do
|
|
60
|
+
expect(base.audiences_uri).to eq("http://default.base/audiences/1/calls.xml")
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|