fake_sns 0.0.1 → 0.0.2
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 +4 -4
- data/lib/fake_sns/actions/set_subscription_attributes.rb +19 -0
- data/lib/fake_sns/subscription.rb +2 -0
- data/lib/fake_sns/subscription_collection.rb +8 -0
- data/lib/fake_sns/version.rb +1 -1
- data/lib/fake_sns/views/set_subscription_attributes.xml.erb +5 -0
- data/spec/fake_sns/subscribing_spec.rb +2 -0
- metadata +4 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 953565c25465f8397a79796e544bd6c330920819
         | 
| 4 | 
            +
              data.tar.gz: 811c1fe88c89649e1e2df1e25ace157d724d7dee
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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
         | 
| @@ -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
         | 
    
        data/lib/fake_sns/version.rb
    CHANGED
    
    
| @@ -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. | 
| 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:  | 
| 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
         |