streamsend 1.0.0.rc16 → 1.0.0.rc19

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.
Files changed (39) hide show
  1. checksums.yaml +8 -8
  2. data/.gitignore +2 -0
  3. data/Gemfile.lock +9 -7
  4. data/lib/streamsend/api/base/count.rb +27 -0
  5. data/lib/streamsend/api/base/index.rb +13 -15
  6. data/lib/streamsend/api/blast.rb +6 -6
  7. data/lib/streamsend/api/bounce.rb +2 -2
  8. data/lib/streamsend/api/click.rb +2 -2
  9. data/lib/streamsend/api/configuration.rb +4 -0
  10. data/lib/streamsend/api/hash_xml_serializer.rb +58 -0
  11. data/lib/streamsend/api/list.rb +1 -1
  12. data/lib/streamsend/api/membership.rb +16 -3
  13. data/lib/streamsend/api/person.rb +4 -8
  14. data/lib/streamsend/api/result.rb +32 -1
  15. data/lib/streamsend/api/session.rb +22 -1
  16. data/lib/streamsend/api/unsubscribe.rb +2 -2
  17. data/lib/streamsend/version.rb +1 -1
  18. data/lib/streamsend.rb +3 -4
  19. data/spec/lib/streamsend/api/integration/blast_spec.rb +4 -4
  20. data/spec/lib/streamsend/api/integration/bounce_spec.rb +3 -0
  21. data/spec/lib/streamsend/api/integration/click_spec.rb +2 -0
  22. data/spec/lib/streamsend/api/integration/link_spec.rb +2 -0
  23. data/spec/lib/streamsend/api/integration/membership_spec.rb +27 -1
  24. data/spec/lib/streamsend/api/integration/owner_spec.rb +25 -18
  25. data/spec/lib/streamsend/api/integration/person_spec.rb +12 -2
  26. data/spec/lib/streamsend/api/integration/unsubscribe_spec.rb +2 -0
  27. data/spec/lib/streamsend/api/integration/view_spec.rb +1 -0
  28. data/spec/lib/streamsend/api/unit/base/count_spec.rb +57 -0
  29. data/spec/lib/streamsend/api/unit/base/index_spec.rb +42 -18
  30. data/spec/lib/streamsend/api/unit/blast_spec.rb +6 -9
  31. data/spec/lib/streamsend/api/unit/bounce_spec.rb +5 -7
  32. data/spec/lib/streamsend/api/unit/click_spec.rb +4 -4
  33. data/spec/lib/streamsend/api/unit/hash_xml_serializer_spec.rb +63 -0
  34. data/spec/lib/streamsend/api/unit/link_spec.rb +2 -2
  35. data/spec/lib/streamsend/api/unit/membership_spec.rb +23 -9
  36. data/spec/lib/streamsend/api/unit/person_spec.rb +10 -11
  37. data/spec/lib/streamsend/api/unit/result_spec.rb +32 -3
  38. data/spec/lib/streamsend/api/unit/unsubscribe_spec.rb +4 -6
  39. metadata +9 -3
@@ -3,10 +3,39 @@ require "spec_helper"
3
3
  module StreamSend
4
4
  module Api
5
5
  describe Result do
6
+ let(:simple_hash) { { :id => 101, :name => "test" } }
7
+ let(:simple_result) { Result.new(simple_hash) }
8
+ let(:nested_hash) { { :parent_hash => { :child_hash => { :child_value => "Valuable!" }, :child_array => [1,2,3] } } }
9
+ let(:complex_result) { StreamSend::Api::Result.create_nested_result_object(nested_hash) }
10
+
6
11
  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)
12
+ expect(simple_result.id).to eq(101)
13
+ end
14
+
15
+ describe "#create_nested_result_object" do
16
+ it "creates a nested result object" do
17
+ expect(complex_result.parent_hash.child_hash.child_value).to eq("Valuable!")
18
+ end
19
+
20
+ it "creates a nested result for arrays" do
21
+ expect(complex_result.parent_hash.child_array).to eq([1,2,3])
22
+ end
23
+ end
24
+
25
+ describe "#to_hash" do
26
+ it "creates a hash from a simple result object" do
27
+ expect(simple_result.to_hash).to eq(simple_hash)
28
+ end
29
+
30
+ it "creates a nested hash from a nested result object" do
31
+ expect(complex_result.to_hash).to eq(nested_hash)
32
+ end
33
+ end
34
+
35
+ describe "#attributes" do
36
+ it "gets the attributes for a result" do
37
+ expect(complex_result.attributes).to eq(["parent_hash"])
38
+ end
10
39
  end
11
40
  end
12
41
  end
@@ -12,19 +12,17 @@ module StreamSend
12
12
 
13
13
  describe Manual do
14
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 => {'Content-Type' => 'text/xml'})
15
+ stub_request(:get, "https://test:password@default.base/blasts/231/unsubscribes/manual.xml").to_return(:status => 200, :body => xml, :headers => {'Content-Type' => 'text/xml'})
17
16
  manual.execute(blast_id)
18
- expect(manual.uri).to eq("https://default.base/blasts/#{blast_id}/unsubscribes/manual.xml?page=1&per_page=100")
17
+ expect(manual.uri).to eq("https://default.base/blasts/#{blast_id}/unsubscribes/manual.xml")
19
18
  end
20
19
  end
21
20
 
22
21
  describe Complaint do
23
22
  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 => {'Content-Type' => 'text/xml'})
23
+ stub_request(:get, "https://test:password@default.base/blasts/231/unsubscribes/complaint.xml").to_return(:status => 200, :body => xml, :headers => {'Content-Type' => 'text/xml'})
26
24
  complainer.execute(blast_id)
27
- expect(complainer.uri).to eq("https://default.base/blasts/#{blast_id}/unsubscribes/complaint.xml?page=1&per_page=100")
25
+ expect(complainer.uri).to eq("https://default.base/blasts/#{blast_id}/unsubscribes/complaint.xml")
28
26
  end
29
27
  end
30
28
  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.rc16
4
+ version: 1.0.0.rc19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Yeo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-04 00:00:00.000000000 Z
11
+ date: 2014-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httmultiparty
@@ -156,6 +156,7 @@ files:
156
156
  - lib/streamsend/api/account.rb
157
157
  - lib/streamsend/api/audience.rb
158
158
  - lib/streamsend/api/base/base_call.rb
159
+ - lib/streamsend/api/base/count.rb
159
160
  - lib/streamsend/api/base/create.rb
160
161
  - lib/streamsend/api/base/destroy.rb
161
162
  - lib/streamsend/api/base/index.rb
@@ -171,6 +172,7 @@ files:
171
172
  - lib/streamsend/api/field_option.rb
172
173
  - lib/streamsend/api/filter.rb
173
174
  - lib/streamsend/api/from_email_address.rb
175
+ - lib/streamsend/api/hash_xml_serializer.rb
174
176
  - lib/streamsend/api/import.rb
175
177
  - lib/streamsend/api/link.rb
176
178
  - lib/streamsend/api/list.rb
@@ -207,6 +209,7 @@ files:
207
209
  - spec/lib/streamsend/api/integration/user_spec.rb
208
210
  - spec/lib/streamsend/api/integration/view_spec.rb
209
211
  - spec/lib/streamsend/api/unit/base/base_call_spec.rb
212
+ - spec/lib/streamsend/api/unit/base/count_spec.rb
210
213
  - spec/lib/streamsend/api/unit/base/create_spec.rb
211
214
  - spec/lib/streamsend/api/unit/base/destroy_spec.rb
212
215
  - spec/lib/streamsend/api/unit/base/index_spec.rb
@@ -217,6 +220,7 @@ files:
217
220
  - spec/lib/streamsend/api/unit/click_spec.rb
218
221
  - spec/lib/streamsend/api/unit/field_option_spec.rb
219
222
  - spec/lib/streamsend/api/unit/from_email_address_spec.rb
223
+ - spec/lib/streamsend/api/unit/hash_xml_serializer_spec.rb
220
224
  - spec/lib/streamsend/api/unit/link_spec.rb
221
225
  - spec/lib/streamsend/api/unit/list_spec.rb
222
226
  - spec/lib/streamsend/api/unit/membership_spec.rb
@@ -247,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
251
  version: 1.3.1
248
252
  requirements: []
249
253
  rubyforge_project:
250
- rubygems_version: 2.2.1
254
+ rubygems_version: 2.2.2
251
255
  signing_key:
252
256
  specification_version: 4
253
257
  summary: Ruby wrapper for the StreamSend API.
@@ -274,6 +278,7 @@ test_files:
274
278
  - spec/lib/streamsend/api/integration/user_spec.rb
275
279
  - spec/lib/streamsend/api/integration/view_spec.rb
276
280
  - spec/lib/streamsend/api/unit/base/base_call_spec.rb
281
+ - spec/lib/streamsend/api/unit/base/count_spec.rb
277
282
  - spec/lib/streamsend/api/unit/base/create_spec.rb
278
283
  - spec/lib/streamsend/api/unit/base/destroy_spec.rb
279
284
  - spec/lib/streamsend/api/unit/base/index_spec.rb
@@ -284,6 +289,7 @@ test_files:
284
289
  - spec/lib/streamsend/api/unit/click_spec.rb
285
290
  - spec/lib/streamsend/api/unit/field_option_spec.rb
286
291
  - spec/lib/streamsend/api/unit/from_email_address_spec.rb
292
+ - spec/lib/streamsend/api/unit/hash_xml_serializer_spec.rb
287
293
  - spec/lib/streamsend/api/unit/link_spec.rb
288
294
  - spec/lib/streamsend/api/unit/list_spec.rb
289
295
  - spec/lib/streamsend/api/unit/membership_spec.rb