Sha256: 44b7f68282a678ccd71e6fffdf3db3abff569a5e9298a67c112dff25b3536e87

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fog-aws-0.1.1 lib/fog/aws/models/sns/topic.rb
fog-aws-0.1.0 lib/fog/aws/models/sns/topic.rb
fog-aws-0.0.8 lib/fog/aws/models/sns/topic.rb
fog-aws-0.0.7 lib/fog/aws/models/sns/topic.rb
fog-aws-0.0.6 lib/fog/aws/models/sns/topic.rb
fog-aws-0.0.5 lib/fog/aws/models/sns/topic.rb