fake_sns 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eea380f4afe8a28a3fe8ef442ee68bc36ed44fc7
4
- data.tar.gz: 27394ec000f0bb22a985f37e38058c9c32057b33
3
+ metadata.gz: 953565c25465f8397a79796e544bd6c330920819
4
+ data.tar.gz: 811c1fe88c89649e1e2df1e25ace157d724d7dee
5
5
  SHA512:
6
- metadata.gz: 4a4c3f9cb1e0e99c47fc939ba45bf15ce944ab3bdc9ac70f3086daccfd1e0ba5c8b1e7a3ceed9a360653d3ae614ac5bf3f83bf8e519f373f3ec5e5c688ce0271
7
- data.tar.gz: 65744967afec469a3224a608dd141d5c2549f482e28c1d42f2980388cccfe3e1d37d3ee6714d4ae497c2f337c534780a0bc4621d42cbf182c4cb7eaa7c9a827c
6
+ metadata.gz: 63db8d6d075a43549eec75fa293b47225b63cc41fab09e6a81d0998ce3157200584b9e173ea16f294e48708c0bce66c0aa9adb97d33b022f969bc4c2bdee7055
7
+ data.tar.gz: 449fa66a9f2389a0a31539a710b310b66c4581fcd3c40768e0696ecc49b69c2dbc26d1937301db398eaf5071e263055cf7a33b8fd328ac45d982028218551b01
@@ -0,0 +1,19 @@
1
+ module FakeSNS
2
+ module Actions
3
+ class SetSubscriptionAttributes < Action
4
+
5
+ VALID_PARAMETER_NAMES = %w(DeliveryPolicy RawMessageDelivery)
6
+
7
+ param key: "AttributeName"
8
+ param value: "AttributeValue"
9
+ param arn: "SubscriptionArn"
10
+
11
+ def call
12
+ raise InvalidParameterValue, "AttributeName: #{key.inspect}" unless VALID_PARAMETER_NAMES.include?(key)
13
+ subscription = db.subscriptions.fetch(arn)
14
+ subscription[key] = value
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -8,6 +8,8 @@ module FakeSNS
8
8
  attribute :endpoint, String
9
9
  attribute :topic_arn, String
10
10
  attribute :owner, String
11
+ attribute :delivery_policy, String
12
+ attribute :raw_message_delivery, Boolean
11
13
 
12
14
  def sqs?
13
15
  protocol == "sqs"
@@ -30,5 +30,13 @@ module FakeSNS
30
30
  collection.delete(fetch(arn))
31
31
  end
32
32
 
33
+ def fetch(arn, &default)
34
+ default ||= -> { raise InvalidParameterValue, "Unknown subscription #{arn}" }
35
+ found = collection.find do |subscription|
36
+ subscription["arn"] == arn
37
+ end
38
+ found || default.call
39
+ end
40
+
33
41
  end
34
42
  end
@@ -1,3 +1,3 @@
1
1
  module FakeSNS
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,5 @@
1
+ <SetSubscriptionAttributesResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
2
+ <ResponseMetadata>
3
+ <RequestId><%= request_id %></RequestId>
4
+ </ResponseMetadata>
5
+ </SetSubscriptionAttributesResponse>
@@ -7,6 +7,8 @@ describe "Subscribing", :sqs do
7
7
  subscription = topic.subscribe("http://example.com")
8
8
  expect(sns.subscriptions.map(&:topic_arn)).to eq [topic.arn]
9
9
  expect(sns.subscriptions.map(&:arn)).to eq [subscription.arn]
10
+
11
+ subscription.raw_message_delivery = true
10
12
  end
11
13
 
12
14
  it "filters by topic" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_sns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - iain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-19 00:00:00.000000000 Z
11
+ date: 2014-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -205,6 +205,7 @@ files:
205
205
  - lib/fake_sns/actions/list_subscriptions_by_topic.rb
206
206
  - lib/fake_sns/actions/list_topics.rb
207
207
  - lib/fake_sns/actions/publish.rb
208
+ - lib/fake_sns/actions/set_subscription_attributes.rb
208
209
  - lib/fake_sns/actions/set_topic_attributes.rb
209
210
  - lib/fake_sns/actions/subscribe.rb
210
211
  - lib/fake_sns/database.rb
@@ -231,6 +232,7 @@ files:
231
232
  - lib/fake_sns/views/list_subscriptions_by_topic.xml.erb
232
233
  - lib/fake_sns/views/list_topics.xml.erb
233
234
  - lib/fake_sns/views/publish.xml.erb
235
+ - lib/fake_sns/views/set_subscription_attributes.xml.erb
234
236
  - lib/fake_sns/views/set_topic_attributes.xml.erb
235
237
  - lib/fake_sns/views/subscribe.xml.erb
236
238
  - spec/fake_sns/drain_spec.rb