pheme 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9149116da3709141b203cf65a869497adba3797f
4
- data.tar.gz: 7b0cb4ede93115e51b86869bc916624e552e47f5
3
+ metadata.gz: 46433ad750c6060d267dc7124847580d107274c9
4
+ data.tar.gz: 11cf1262b1da8a5e590eef8ef023a88734f1874f
5
5
  SHA512:
6
- metadata.gz: 9c3bd9a644a326a977785430dc10af03f00d93666e6356954f8803383b822b18430ed8bac3cd515d8bf20b718960b07d69d505074e254f9918807b0b8e518de2
7
- data.tar.gz: a1d735abbdab60b3527ad9f2a561c34a986b550c541f3bf9038f5f8b5d9d508ab926c3ae6831ef462f04ff4021bd8fcb8fb08e4ea807c96cb4b081e790d0627b
6
+ metadata.gz: b309d7c66b7ed47901c4748476e5ac428513dfb89b531c64f1936f0f48e1dfc555acc3fbc586372c25592015d9998f6e6bfd6c236a21d8504bc26e11afa8b919
7
+ data.tar.gz: f9c7870ba06f05d0d01dbc35f09e6d392cb5d4ebd272d0ef7fc7ef938516d52862517875322aafe03390441d02829148160f7ddc8315b7136f5924cfcfe742c9
@@ -3,15 +3,15 @@ module Pheme
3
3
  attr_accessor :queue_url, :queue_poller, :connection_pool_block, :poller_configuration
4
4
 
5
5
  def initialize(queue_url:, connection_pool_block: false, poller_configuration: {})
6
+ raise ArgumentError, "must specify non-nil queue_url" unless queue_url.present?
6
7
  @queue_url = queue_url
7
8
  @queue_poller = Aws::SQS::QueuePoller.new(queue_url)
8
9
  @connection_pool_block = connection_pool_block
9
- @poller_configuration = poller_configuration.merge({
10
+ @poller_configuration = {
10
11
  wait_time_seconds: 10, # amount of time a long polling receive call can wait for a mesage before receiving a empty response (which will trigger another polling request)
11
12
  idle_timeout: 20, # disconnects poller after 20 seconds of idle time
12
- visibility_timeout: 30, # length of time in seconds that this message will not be visible to other receiving components
13
13
  skip_delete: true, # manually delete messages
14
- })
14
+ }.merge(poller_configuration || {})
15
15
  end
16
16
 
17
17
  def poll
@@ -3,6 +3,7 @@ module Pheme
3
3
  attr_accessor :topic_arn
4
4
 
5
5
  def initialize(topic_arn:)
6
+ raise ArgumentError, "must specify non-nil topic_arn" unless topic_arn.present?
6
7
  @topic_arn = topic_arn
7
8
  end
8
9
 
@@ -1,3 +1,3 @@
1
1
  module Pheme
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -10,6 +10,20 @@ describe Pheme::QueuePoller do
10
10
  allow(Aws::SQS::QueuePoller).to receive(:new) { poller }
11
11
  end
12
12
 
13
+ describe ".new" do
14
+ context "when initialized with valid params" do
15
+ it "does not raise an error" do
16
+ expect { ExampleQueuePoller.new(queue_url: "queue_url") }.not_to raise_error
17
+ end
18
+ end
19
+
20
+ context "when initialized with a nil queue_url" do
21
+ it "raises an ArgumentError" do
22
+ expect { ExampleQueuePoller.new(queue_url: nil) }.to raise_error(ArgumentError)
23
+ end
24
+ end
25
+ end
26
+
13
27
  describe "#poll" do
14
28
  before(:each) do
15
29
  module ActiveRecord
@@ -1,8 +1,23 @@
1
1
  describe Pheme::TopicPublisher do
2
2
  before(:each) { use_default_configuration! }
3
- subject { ExamplePublisher.new(topic_arn: "arn:aws:sns:whatever") }
3
+
4
+ describe ".new" do
5
+ context "when initialized with valid params" do
6
+ it "does not raise an error" do
7
+ expect { ExamplePublisher.new(topic_arn: "arn:aws:sns:whatever") }.not_to raise_error
8
+ end
9
+ end
10
+
11
+ context "when initialized with a nil topic_arn" do
12
+ it "raises an ArgumentError" do
13
+ expect { ExamplePublisher.new(topic_arn: nil) }.to raise_error(ArgumentError)
14
+ end
15
+ end
16
+ end
4
17
 
5
18
  describe "#publish_events" do
19
+ subject { ExamplePublisher.new(topic_arn: "arn:aws:sns:whatever") }
20
+
6
21
  it "publishes the correct events" do
7
22
  expect(Pheme.configuration.sns_client).to receive(:publish).with({
8
23
  topic_arn: "arn:aws:sns:whatever",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pheme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Graham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-23 00:00:00.000000000 Z
11
+ date: 2016-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -144,3 +144,4 @@ test_files:
144
144
  - spec/support/example_queue_poller.rb
145
145
  - spec/topic_publisher_spec.rb
146
146
  - spec/version_spec.rb
147
+ has_rdoc: