streamsend 0.2.3 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/.gitignore +18 -5
  2. data/.rspec +1 -0
  3. data/Gemfile +2 -1
  4. data/Gemfile.lock +25 -17
  5. data/README.md +76 -0
  6. data/Rakefile +1 -2
  7. data/lib/streamsend/api/account.rb +6 -48
  8. data/lib/streamsend/api/audience.rb +14 -0
  9. data/lib/streamsend/api/base/base_call.rb +60 -0
  10. data/lib/streamsend/api/base/create.rb +41 -0
  11. data/lib/streamsend/api/base/destroy.rb +43 -0
  12. data/lib/streamsend/api/base/index.rb +51 -0
  13. data/lib/streamsend/api/base/show.rb +42 -0
  14. data/lib/streamsend/api/base/update.rb +43 -0
  15. data/lib/streamsend/api/blast.rb +51 -0
  16. data/lib/streamsend/api/bounce.rb +20 -0
  17. data/lib/streamsend/api/click.rb +18 -0
  18. data/lib/streamsend/api/configuration.rb +26 -0
  19. data/lib/streamsend/api/email.rb +20 -0
  20. data/lib/streamsend/api/exception.rb +4 -4
  21. data/lib/streamsend/api/field.rb +20 -0
  22. data/lib/streamsend/api/field_option.rb +60 -0
  23. data/lib/streamsend/api/filter.rb +20 -0
  24. data/lib/streamsend/api/from_email_address.rb +24 -0
  25. data/lib/streamsend/api/import.rb +11 -0
  26. data/lib/streamsend/api/link.rb +11 -0
  27. data/lib/streamsend/api/list.rb +13 -39
  28. data/lib/streamsend/api/membership.rb +28 -0
  29. data/lib/streamsend/api/person.rb +66 -0
  30. data/lib/streamsend/api/result.rb +13 -0
  31. data/lib/streamsend/api/session.rb +73 -0
  32. data/lib/streamsend/api/unsubscribe.rb +20 -0
  33. data/lib/streamsend/api/upload.rb +13 -0
  34. data/lib/streamsend/api/user.rb +67 -38
  35. data/lib/streamsend/api/view.rb +8 -0
  36. data/lib/streamsend/version.rb +3 -0
  37. data/lib/streamsend.rb +35 -16
  38. data/spec/lib/streamsend/api/integration/account_spec.rb +50 -0
  39. data/spec/lib/streamsend/api/integration/audience_spec.rb +56 -0
  40. data/spec/lib/streamsend/api/integration/blast_spec.rb +110 -0
  41. data/spec/lib/streamsend/api/integration/bounce_spec.rb +43 -0
  42. data/spec/lib/streamsend/api/integration/click_spec.rb +37 -0
  43. data/spec/lib/streamsend/api/integration/email_spec.rb +76 -0
  44. data/spec/lib/streamsend/api/integration/field_option_spec.rb +87 -0
  45. data/spec/lib/streamsend/api/integration/field_spec.rb +75 -0
  46. data/spec/lib/streamsend/api/integration/filter_spec.rb +101 -0
  47. data/spec/lib/streamsend/api/integration/from_email_address_spec.rb +46 -0
  48. data/spec/lib/streamsend/api/integration/helpers.rb +16 -0
  49. data/spec/lib/streamsend/api/integration/import_spec.rb +35 -0
  50. data/spec/lib/streamsend/api/integration/link_spec.rb +39 -0
  51. data/spec/lib/streamsend/api/integration/list_spec.rb +83 -0
  52. data/spec/lib/streamsend/api/integration/membership_spec.rb +69 -0
  53. data/spec/lib/streamsend/api/integration/person_spec.rb +119 -0
  54. data/spec/lib/streamsend/api/integration/unsubscribe_spec.rb +47 -0
  55. data/spec/lib/streamsend/api/integration/upload_spec.rb +29 -0
  56. data/spec/lib/streamsend/api/integration/user_spec.rb +99 -0
  57. data/spec/lib/streamsend/api/integration/view_spec.rb +27 -0
  58. data/spec/lib/streamsend/api/unit/base/base_call_spec.rb +66 -0
  59. data/spec/lib/streamsend/api/unit/base/create_spec.rb +67 -0
  60. data/spec/lib/streamsend/api/unit/base/destroy_spec.rb +59 -0
  61. data/spec/lib/streamsend/api/unit/base/index_spec.rb +85 -0
  62. data/spec/lib/streamsend/api/unit/base/show_spec.rb +68 -0
  63. data/spec/lib/streamsend/api/unit/base/update_spec.rb +76 -0
  64. data/spec/lib/streamsend/api/unit/blast_spec.rb +79 -0
  65. data/spec/lib/streamsend/api/unit/bounce_spec.rb +36 -0
  66. data/spec/lib/streamsend/api/unit/click_spec.rb +34 -0
  67. data/spec/lib/streamsend/api/unit/field_option_spec.rb +71 -0
  68. data/spec/lib/streamsend/api/unit/from_email_address_spec.rb +20 -0
  69. data/spec/lib/streamsend/api/unit/link_spec.rb +33 -0
  70. data/spec/lib/streamsend/api/unit/list_spec.rb +33 -0
  71. data/spec/lib/streamsend/api/unit/membership_spec.rb +46 -0
  72. data/spec/lib/streamsend/api/unit/person_spec.rb +102 -0
  73. data/spec/lib/streamsend/api/unit/result_spec.rb +13 -0
  74. data/spec/lib/streamsend/api/unit/session_spec.rb +62 -0
  75. data/spec/lib/streamsend/api/unit/unsubscribe_spec.rb +33 -0
  76. data/spec/lib/streamsend/api/unit/user_spec.rb +102 -0
  77. data/spec/spec_helper.rb +8 -11
  78. data/streamsend.gemspec +22 -23
  79. metadata +250 -178
  80. checksums.yaml +0 -7
  81. data/.pair +0 -10
  82. data/README.rdoc +0 -1
  83. data/lib/streamsend/api/resource.rb +0 -41
  84. data/lib/streamsend/api/subscriber.rb +0 -113
  85. data/spec/integration/account_spec.rb +0 -69
  86. data/spec/integration/fixtures/vcr_cassettes/streamsend.yml +0 -6831
  87. data/spec/integration/integration.yml +0 -5
  88. data/spec/integration/list_spec.rb +0 -68
  89. data/spec/integration/spec_helper.rb +0 -16
  90. data/spec/integration/subscriber_spec.rb +0 -24
  91. data/spec/integration/user_spec.rb +0 -58
  92. data/spec/lib/streamsend/api/list_spec.rb +0 -179
  93. data/spec/lib/streamsend/api/resource_spec.rb +0 -24
  94. data/spec/lib/streamsend/api/subscriber_spec.rb +0 -345
  95. data/spec/lib/streamsend/api/user_spec.rb +0 -149
  96. data/spec/lib/streamsend/api_spec.rb +0 -31
  97. data/watcher_config.rb +0 -2
@@ -0,0 +1,33 @@
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("test", "password", "https://default.base") }
8
+ let(:indexer){ Index.new(session) }
9
+ let(:audience_id){ 1 }
10
+ let(:person_id){ 543 }
11
+ let(:xml){ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><lists type=\"array\"><list><test type=\"integer\">1</test></list></lists>" }
12
+
13
+ before do
14
+ session.stub(:audience_id).and_return(audience_id)
15
+ end
16
+
17
+ describe Index do
18
+ it "creates a uri for lists" do
19
+ stub_request(:get, "https://test:password@default.base/audiences/1/lists.xml").to_return(:status => 200, :body => xml, :headers => {})
20
+ indexer.execute
21
+ expect(indexer.uri).to eq("https://default.base/audiences/#{audience_id}/lists.xml")
22
+ end
23
+
24
+ it "creates a uri for a persons lists" do
25
+ stub_request(:get, "https://test:password@default.base/audiences/1/people/543/lists.xml").to_return(:status => 200, :body => xml, :headers => {})
26
+ indexer.execute(person_id)
27
+ expect(indexer.uri).to eq("https://default.base/audiences/#{audience_id}/people/#{person_id}/lists.xml")
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,46 @@
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("test", "password", "https://default.base") }
8
+ let(:person_id){ 123 }
9
+ let(:list_id){ 456 }
10
+ let(:audience_id){ 1 }
11
+ let(:options){ { :page => 12, :per_page => 200 } }
12
+ let(:xml){ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><memberships type=\"array\"><membership><test type=\"integer\">1</test></membership></memberships>" }
13
+
14
+ before do
15
+ session.stub(:audience_id).and_return(audience_id)
16
+ end
17
+
18
+ describe Index do
19
+ it "returns a uri for an index of memberships" do
20
+ stub_request(:get, "https://test:password@default.base/audiences/1/people/123/memberships.xml?page=1&per_page=100").
21
+ to_return(:status => 200, :body => xml, :headers => {})
22
+ indexer = Index.new(session)
23
+ indexer.execute(person_id)
24
+ expect(indexer.uri).to eq("https://default.base/audiences/#{audience_id}/people/#{person_id}/memberships.xml?page=1&per_page=100")
25
+ end
26
+
27
+ it "returns a uri for an index of memberships with custom paging" do
28
+ stub_request(:get, "https://test:password@default.base/audiences/1/people/123/memberships.xml?page=12&per_page=200").
29
+ to_return(:status => 200, :body => xml, :headers => {})
30
+ indexer = Index.new(session)
31
+ indexer.execute(person_id, nil, options)
32
+ expect(indexer.uri).to eq("https://default.base/audiences/#{audience_id}/people/#{person_id}/memberships.xml?page=12&per_page=200")
33
+ end
34
+
35
+ it "returns a uri for an index of memberships by list id" do
36
+ stub_request(:get, "https://test:password@default.base/audiences/1/people/123/lists/456/memberships.xml?page=1&per_page=100").
37
+ to_return(:status => 200, :body => xml, :headers => {})
38
+ indexer = Index.new(session)
39
+ indexer.execute(person_id, list_id)
40
+ expect(indexer.uri).to eq("https://default.base/audiences/#{audience_id}/people/#{person_id}/lists/#{list_id}/memberships.xml?page=1&per_page=100")
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,102 @@
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("test", "password", "https://default.base") }
8
+ let(:indexer){ Index.new(session) }
9
+ let(:activator){ Activate.new(session) }
10
+ let(:unsuber){ Unsubscribe.new(session) }
11
+ let(:options){ { :page => 12, :per_page => 222 } }
12
+ let(:xml){ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><people type=\"array\"><person><test type=\"integer\">1</test></person></people>" }
13
+ let(:audience_id){ 1 }
14
+ let(:person_id){ 421 }
15
+ let(:blast_id){ 1 }
16
+ let(:link_id){ 1 }
17
+
18
+ before do
19
+ session.stub(:audience_id).and_return(audience_id)
20
+ end
21
+ describe Index do
22
+ it "returns a uri for a person index" do
23
+ stub_request(:get, "https://test:password@default.base/audiences/1/people.xml?page=1&per_page=100").
24
+ to_return(:status => 200, :body => xml, :headers => {})
25
+ indexer.execute
26
+ expect(indexer.uri).to eq("https://default.base/audiences/1/people.xml?page=1&per_page=100")
27
+ end
28
+
29
+ it "returns a uri for a person index by email address" do
30
+ stub_request(:get, "https://test:password@default.base/audiences/1/people.xml?email_address=myemail@address.none&page=1&per_page=100").
31
+ to_return(:status => 200, :body => xml, :headers => {})
32
+ indexer.execute("myemail@address.none", nil, {})
33
+ expect(indexer.uri).to eq("https://default.base/audiences/1/people.xml?page=1&per_page=100&email_address=myemail@address.none")
34
+ end
35
+
36
+ it "returns a uri for a person index by tracking hash" do
37
+ stub_request(:get, "https://test:password@default.base/audiences/1/people.xml?page=1&per_page=100&tracking_hash=xyz").
38
+ to_return(:status => 200, :body => xml, :headers => {})
39
+ indexer.execute(nil, "xyz", {})
40
+ expect(indexer.uri).to eq("https://default.base/audiences/1/people.xml?page=1&per_page=100&tracking_hash=xyz")
41
+ end
42
+
43
+ it "returns a uri with custom paging" do
44
+ stub_request(:get, "https://test:password@default.base/audiences/1/people.xml?page=12&per_page=222").
45
+ to_return(:status => 200, :body => xml, :headers => {})
46
+ indexer.execute(nil, nil, options)
47
+ expect(indexer.uri).to eq("https://default.base/audiences/1/people.xml?page=12&per_page=222")
48
+ end
49
+ end
50
+
51
+ describe Click do
52
+ let(:clicker){ StreamSend::Api::Person::Click.new(session) }
53
+ it "creates a uri for blast click people" do
54
+ stub_request(:get, "https://test:password@default.base/blasts/1/clicks/people.xml?page=1&per_page=100").
55
+ to_return(:status => 200, :body => xml, :headers => {})
56
+ clicker.execute(blast_id)
57
+ expect(clicker.uri).to eq("https://default.base/blasts/#{blast_id}/clicks/people.xml?page=1&per_page=100")
58
+ end
59
+
60
+ it "creates uri for specific link click people" do
61
+ stub_request(:get, "https://test:password@default.base/blasts/1/links/1/clicks/people.xml?page=1&per_page=100").
62
+ to_return(:status => 200, :body => xml, :headers => {"Content-type" => "text/xml"})
63
+ clicker.execute(blast_id, link_id)
64
+ expect(clicker.uri).to eq("https://default.base/blasts/#{blast_id}/links/#{link_id}/clicks/people.xml?page=1&per_page=100")
65
+ end
66
+ end
67
+
68
+ describe View do
69
+ let(:session){ StreamSend::Api::Session.new("test", "password", "https://default.base") }
70
+ let(:peopler){ StreamSend::Api::Person::View.new(session) }
71
+ let(:options){ {:page => 234, :per_page => 444 } }
72
+ let(:blast_id){ 1 }
73
+
74
+ it "creates a uri for blast view people" do
75
+ stub_request(:get, "https://test:password@default.base/blasts/1/views/people.xml?page=1&per_page=100").
76
+ to_return(:status => 200, :body => xml, :headers => {})
77
+ peopler.execute(blast_id)
78
+ expect(peopler.uri).to eq("https://default.base/blasts/#{blast_id}/views/people.xml?page=1&per_page=100")
79
+ end
80
+ end
81
+
82
+ describe Activate do
83
+ it "returns a uri for activating the person by id" do
84
+ stub_request(:post, "https://test:password@default.base/audiences/1/people/421/activate.xml").
85
+ to_return(:status => 200, :body => "", :headers => {})
86
+ activator.execute(person_id)
87
+ expect(activator.uri(person_id)).to eq("https://default.base/audiences/1/people/#{person_id}/activate.xml")
88
+ end
89
+ end
90
+
91
+ describe Unsubscribe do
92
+ it "returns a uri for unsubscribing a person by id" do
93
+ stub_request(:post, "https://test:password@default.base/audiences/1/people/421/unsubscribe.xml").
94
+ to_return(:status => 200, :body => "", :headers => {})
95
+ unsuber.execute(person_id)
96
+ expect(unsuber.uri(person_id)).to eq("https://default.base/audiences/1/people/#{person_id}/unsubscribe.xml")
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,13 @@
1
+ require "spec_helper"
2
+
3
+ module StreamSend
4
+ module Api
5
+ describe Result do
6
+ it "returns the hash value for id when called not the Ruby id" do
7
+ hash = { :id => 101, :name => "test" }
8
+ result = Result.new(hash)
9
+ expect(result.id).to eq(101)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,62 @@
1
+ require "spec_helper"
2
+
3
+ module StreamSend
4
+ module Api
5
+ describe Session do
6
+ let(:session){ Session.new("test", "password", "http://default.base") }
7
+
8
+ it "uses the default base_uri if none is provided" do
9
+ no_base_session = Session.new("test", "password")
10
+ expect(no_base_session.base_uri).to eq("http://app.streamsend.com")
11
+ end
12
+
13
+ it "uses the specified base_uri if one is specified" do
14
+ non_default_session = Session.new("test", "pass", "http://something.else.here")
15
+ expect(non_default_session.base_uri).to eq("http://something.else.here")
16
+ end
17
+
18
+ describe "#basic_auth_credentials" do
19
+ it "returns a hash with the username and password" do
20
+ expect(session.basic_auth_credentials).to eq({ :basic_auth => {:username => "test", :password => "password"} })
21
+ end
22
+ end
23
+
24
+ it "gets the audience id for the configured account" do
25
+ xml = <<-XML
26
+ <?xml version="1.0" encoding="UTF-8"?>
27
+ <audiences type="array">
28
+ <audience>
29
+ <id type="integer">1</id>
30
+ </audience>
31
+ </audiences>
32
+ XML
33
+ stub_request(:get, "http://test:password@default.base/audiences.xml").to_return(:status => 200, :body => xml, :headers => {'Content-Type' => 'text/xml'})
34
+ expect(session.audience_id).to eq(1)
35
+ end
36
+
37
+ describe "get" do
38
+ it "uses the PUT verb" do
39
+ stub = stub_http_request(:get, "http://test:password@default.base")
40
+ session.get(session.base_uri)
41
+ stub.should have_been_requested
42
+ end
43
+ end
44
+
45
+ describe "post" do
46
+ it "uses the PUT verb" do
47
+ stub = stub_http_request(:post, "http://test:password@default.base")
48
+ session.post(session.base_uri)
49
+ stub.should have_been_requested
50
+ end
51
+ end
52
+
53
+ describe "put" do
54
+ it "uses the PUT verb" do
55
+ stub = stub_http_request(:put, "http://test:password@default.base")
56
+ session.put(session.base_uri)
57
+ stub.should have_been_requested
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,33 @@
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("test", "password", "https://default.base") }
8
+ let(:manual){ Manual.new(session) }
9
+ let(:complainer){ Complaint.new(session) }
10
+ let(:xml){ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><unsubscribes type=\"array\"><unsubscribe><test type=\"integer\">1</test></unsubscribe></unsubscribes>" }
11
+ let(:blast_id){ 231 }
12
+
13
+ describe Manual do
14
+ it "creates a uri for manual blast unsubscribes" do
15
+ stub_request(:get, "https://test:password@default.base/blasts/231/unsubscribes/manual.xml?page=1&per_page=100").
16
+ to_return(:status => 200, :body => xml, :headers => {})
17
+ manual.execute(blast_id)
18
+ expect(manual.uri).to eq("https://default.base/blasts/#{blast_id}/unsubscribes/manual.xml?page=1&per_page=100")
19
+ end
20
+ end
21
+
22
+ describe Complaint do
23
+ it "creates a uri for complaint blast unsubscribes" do
24
+ stub_request(:get, "https://test:password@default.base/blasts/231/unsubscribes/complaint.xml?page=1&per_page=100").
25
+ to_return(:status => 200, :body => xml, :headers => {})
26
+ complainer.execute(blast_id)
27
+ expect(complainer.uri).to eq("https://default.base/blasts/#{blast_id}/unsubscribes/complaint.xml?page=1&per_page=100")
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,102 @@
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("test", "password", "https://default.base") }
8
+ let(:indexer){ Index.new(session) }
9
+ let(:shower){ Show.new(session) }
10
+ let(:deleter){ Destroy.new(session) }
11
+ let(:loginer){ Login.new(session) }
12
+ let(:creator){ Create.new(session) }
13
+ let(:updater){ Update.new(session) }
14
+ let(:randomish){ DateTime.now.to_i.to_s }
15
+ let(:user_hash){ { :user => { :email_address => "you+#{randomish}@are.here", :password => "lulz1234", :administrator => false } } }
16
+ let(:account_id){ 543 }
17
+ let(:user_id){ 12 }
18
+ let(:xml){ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><users type=\"array\"><user><test type=\"integer\">1</test></user></users>" }
19
+
20
+ describe Index do
21
+ it "returns a user index uri with account id" do
22
+ stub_request(:get, "https://test:password@default.base/accounts/543/users.xml").
23
+ to_return(:status => 200, :body => xml, :headers => {})
24
+ indexer.execute(account_id)
25
+ expect(indexer.uri).to eq("https://default.base/accounts/543/users.xml")
26
+ end
27
+
28
+ it "returns a index uri wihtout account id" do
29
+ stub_request(:get, "https://test:password@default.base/users.xml").
30
+ to_return(:status => 200, :body => xml, :headers => {})
31
+ indexer.execute()
32
+ expect(indexer.uri).to eq("https://default.base/users.xml")
33
+ end
34
+ end
35
+
36
+ describe Show do
37
+ it "returns a user show uri with account id" do
38
+ stub_request(:get, "https://test:password@default.base/accounts/543/users/12.xml").
39
+ to_return(:status => 200, :body => xml, :headers => {})
40
+ shower.execute(user_id, account_id)
41
+ expect(shower.uri).to eq("https://default.base/accounts/543/users/12.xml")
42
+ end
43
+
44
+ it "returns a show uri wihtout account id" do
45
+ stub_request(:get, "https://test:password@default.base/users/12.xml").
46
+ to_return(:status => 200, :body => xml, :headers => {})
47
+ shower.execute(user_id)
48
+ expect(shower.uri).to eq("https://default.base/users/12.xml")
49
+ end
50
+ end
51
+
52
+ describe Create do
53
+ it "returns a user create uri with account id" do
54
+ stub_request(:post, "https://test:password@default.base/users.xml").
55
+ to_return(:status => 201, :body => "", :headers => {'Location' => 'something/something/101'})
56
+ creator.execute(user_hash)
57
+ expect(creator.uri).to eq("https://default.base/users.xml")
58
+ end
59
+
60
+ it "returns a user create uri without account id" do
61
+ stub_request(:post, "https://test:password@default.base/accounts/543/users.xml").
62
+ to_return(:status => 201, :body => "", :headers => {'Location' => 'something/something/101'})
63
+ creator.execute(user_hash, account_id)
64
+ expect(creator.uri).to eq("https://default.base/accounts/#{account_id}/users.xml")
65
+ end
66
+ end
67
+
68
+ describe Update do
69
+ it "returns a user update uri with account id" do
70
+ stub_request(:put, "https://test:password@default.base/users/12.xml").
71
+ to_return(:status => 200, :body => "")
72
+ updater.execute(user_id, user_hash)
73
+ expect(updater.uri).to eq("https://default.base/users/#{user_id}.xml")
74
+ end
75
+
76
+ it "returns a user update uri without account id" do
77
+ stub_request(:put, "https://test:password@default.base/accounts/#{account_id}/users/12.xml").
78
+ to_return(:status => 200, :body => "")
79
+ updater.execute(user_id, user_hash, account_id)
80
+ expect(updater.uri).to eq("https://default.base/accounts/#{account_id}/users/#{user_id}.xml")
81
+ end
82
+ end
83
+
84
+ describe Destroy do
85
+ it "returns a user destroy uri with account id" do
86
+ stub_request(:delete, "https://test:password@default.base/accounts/543/users/12.xml").
87
+ to_return(:status => 200, :body => xml, :headers => {})
88
+ deleter.execute(user_id, account_id)
89
+ expect(deleter.uri).to eq("https://default.base/accounts/543/users/12.xml")
90
+ end
91
+
92
+ it "returns a destroy uri wihtout account id" do
93
+ stub_request(:delete, "https://test:password@default.base/users/12.xml").
94
+ to_return(:status => 200, :body => xml, :headers => {})
95
+ deleter.execute(user_id)
96
+ expect(deleter.uri).to eq("https://default.base/users/12.xml")
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,17 +1,14 @@
1
1
  require 'uri'
2
+ require 'ruby-debug'
2
3
  require 'rspec/expectations'
3
- require "vcr"
4
- require "webmock/rspec"
4
+ require 'webmock/rspec'
5
5
 
6
6
  require File.join(File.dirname(__FILE__), "../lib/streamsend")
7
7
 
8
- VCR.configure do |c|
9
- c.default_cassette_options = { :record => :new_episodes }
10
- c.cassette_library_dir = 'spec/integration/fixtures/vcr_cassettes'
11
- c.hook_into :webmock
12
- c.debug_logger = File.open("logfile.log", "w")
13
- c.filter_sensitive_data("<STREAMSEND_PASSWORD>") do
14
- ENV['STREAMSEND_PASSWORD']
15
- end
16
- end
8
+ RSpec.configure do |config|
9
+ config.treat_symbols_as_metadata_keys_with_true_values = true
10
+ config.run_all_when_everything_filtered = true
11
+ config.filter_run :focus
17
12
 
13
+ config.order = 'ordered'
14
+ end
data/streamsend.gemspec CHANGED
@@ -1,28 +1,27 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "streamsend/version"
2
4
 
3
- Gem::Specification.new do |gem|
4
- gem.authors = ["Scott Albertson", "Jeff Roush", "Mark Eschbach", "Bob Yeo"]
5
- gem.email = %q{jroush@ezpublishing.com}
6
- gem.summary = %q{Ruby wrapper for the StreamSend API.}
7
- gem.description = %q{Ruby wrapper for the StreamSend API.}
8
- gem.homepage = %q{https://github.com/Jeff-R/streamsend-ruby}
9
- gem.date = %q{2013-07-09}
5
+ Gem::Specification.new do |s|
6
+ s.name = "streamsend"
7
+ s.version = StreamSend::VERSION
8
+ s.authors = ["Bob Yeo"]
9
+ s.email = ["ryeo@ezpublishing.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Ruby wrapper for the StreamSend API.}
12
+ s.description = %q{Ruby wrapper for the StreamSend API.}
10
13
 
11
- gem.add_dependency "httparty"
12
- gem.add_dependency "activesupport", "~>3.2"
13
- gem.add_dependency "builder"
14
- gem.add_development_dependency "rspec"
15
- gem.add_development_dependency "git-commit-story"
16
- gem.add_development_dependency "webmock", "~> 1.6"
17
- gem.add_development_dependency "vcr"
18
- gem.add_development_dependency "watchr"
19
- gem.add_development_dependency "ruby-fsevent"
20
- gem.add_development_dependency "pair-salad"
14
+ s.add_dependency "httmultiparty"
15
+ s.add_dependency "activesupport", "~>3.2"
16
+ s.add_dependency "builder"
17
+ s.add_development_dependency "rspec"
18
+ s.add_development_dependency "git-commit-story"
19
+ s.add_development_dependency "webmock", "~> 1.6"
20
+ s.add_development_dependency "pair-salad"
21
+ s.add_development_dependency "ruby-debug"
21
22
 
22
- gem.files = `git ls-files`.split($\)
23
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
24
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
25
- gem.name = "streamsend"
26
- gem.require_paths = ["lib"]
27
- gem.version = "0.2.3"
23
+ s.files = `git ls-files`.split("\n")
24
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
+ s.require_paths = ["lib"]
28
27
  end