class AWS::SNS::SubscriptionCollection

Represents the collection of all subscriptions for the AWS account. For example:

# get the ARNs of all SQS queues with subscriptions to topics
# owned by this account
topic.subscriptions.
  select { |s| s.protocol == :sqs }.
  collect(&:endpoint)

Public Instance Methods

[](arn) click to toggle source

Returns a subscription with the given ARN. This does not make a request to AWS. @param [String] arn The subscription ARN. @return [Subscription]

# File lib/aws/sns/subscription_collection.rb, line 34
def [] arn
  Subscription.new(arn, :config => config)
end

Protected Instance Methods

_each_item(next_token, options) { |subscription| ... } click to toggle source

Yield each subscription belonging to this account. @yieldparam [Subscription] subscription Each of the

subscriptions in the account.

@return [nil]

# File lib/aws/sns/subscription_collection.rb, line 44
def _each_item next_token, options, &block

  options[:next_token] = next_token if next_token

  resp = client.send(client_method, options.merge(request_options))
  resp.data[:subscriptions].each do |sub|

    subscription = Subscription.new(
      sub[:subscription_arn],
      :endpoint => sub[:endpoint],
      :protocol => sub[:protocol].tr('-','_').to_sym,
      :owner_id => sub[:owner],
      :topic_arn => sub[:topic_arn],
      :config => config)

    yield(subscription)

  end

  resp.data[:next_token]

end
client_method() click to toggle source
# File lib/aws/sns/subscription_collection.rb, line 67
def client_method
  :list_subscriptions
end
request_options() click to toggle source
# File lib/aws/sns/subscription_collection.rb, line 71
def request_options
  {}
end