From 967a686bc9ae87f3a1f8dff96559381002427617 Mon Sep 17 00:00:00 2001 From: phiggins Date: Wed, 2 Feb 2011 00:40:13 -0800 Subject: [PATCH] SNS ListSubscriptions --- lib/fog/aws/parsers/sns/list_subscriptions.rb | 29 +++++++++++++++++++ .../aws/requests/sns/list_subscriptions.rb | 27 +++++++++++++++++ lib/fog/aws/sns.rb | 3 +- 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 lib/fog/aws/parsers/sns/list_subscriptions.rb create mode 100644 lib/fog/aws/requests/sns/list_subscriptions.rb diff --git a/lib/fog/aws/parsers/sns/list_subscriptions.rb b/lib/fog/aws/parsers/sns/list_subscriptions.rb new file mode 100644 index 000000000..c6c757e50 --- /dev/null +++ b/lib/fog/aws/parsers/sns/list_subscriptions.rb @@ -0,0 +1,29 @@ +module Fog + module Parsers + module AWS + module SNS + + class ListSubscriptions < Fog::Parsers::Base + + def reset + @response = { 'Subscriptions' => [] } + @subscription = {} + end + + def end_element(name) + case name + when "TopicArn", "Protocol", "SubscriptionArn", "Owner", "Endpoint" + @subscription[name] = @value + when "member" + @response['Subscriptions'] << @subscription + @subscription = {} + when 'RequestId', 'NextToken' + @response[name] = @value + end + end + end + + end + end + end +end diff --git a/lib/fog/aws/requests/sns/list_subscriptions.rb b/lib/fog/aws/requests/sns/list_subscriptions.rb new file mode 100644 index 000000000..0cc2de20d --- /dev/null +++ b/lib/fog/aws/requests/sns/list_subscriptions.rb @@ -0,0 +1,27 @@ +module Fog + module AWS + class SNS + class Real + + require 'fog/aws/parsers/sns/list_subscriptions' + + def list_subscriptions(options = {}) + request({ + 'Action' => 'ListSubscriptions', + :parser => Fog::Parsers::AWS::SNS::ListSubscriptions.new + }.merge!(options)) + end + + end + + class Mock + + def list_subscriptions + Fog::Mock.not_implemented + end + + end + + end + end +end diff --git a/lib/fog/aws/sns.rb b/lib/fog/aws/sns.rb index 50efbb978..7fca78265 100644 --- a/lib/fog/aws/sns.rb +++ b/lib/fog/aws/sns.rb @@ -6,8 +6,9 @@ module Fog recognizes :host, :path, :port, :scheme, :persistent request_path 'fog/aws/requests/sns' - request :list_topics request :get_topic_attributes + request :list_subscriptions + request :list_topics class Mock