1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
fog--fog-aws/lib/fog/aws/models/sns/topic.rb
Josh Lane d48d376e9c initial import
* take the liberty of correcting Aws naming
2014-12-31 09:17:51 -08:00

48 lines
1.3 KiB
Ruby

require 'fog/core/model'
module Fog
module AWS
class SNS
class Topic < Fog::Model
identity :id, :aliases => "TopicArn"
attribute :owner, :aliases => "Owner"
attribute :policy, :aliases => "Policy"
attribute :display_name, :aliases => "DisplayName"
attribute :subscriptions_pending, :aliases => "SubscriptionsPending"
attribute :subscriptions_confirmed, :aliases => "SubscriptionsConfirmed"
attribute :subscriptions_deleted, :aliases => "SubscriptionsDeleted"
attribute :delivery_policy, :aliases => "DeliveryPolicy"
attribute :effective_delivery_policy, :aliases => "EffectiveDeliveryPolicy"
def ready?
display_name
end
def update_topic_attribute(attribute, new_value)
requires :id
service.set_topic_attributes(id, attribute, new_value).body
reload
end
def destroy
requires :id
service.delete_topic(id)
true
end
def save
requires :id
data = service.create_topic(id).body["TopicArn"]
if data
data = {"id" => data}
merge_attributes(data)
true
else false
end
end
end
end
end
end