Class: Awspec::Helper::Finder::SNSTopic::SnsTopic

Inherits:
Object
  • Object
show all
Defined in:
lib/awspec/helper/finder/sns_topic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribs) ⇒ SnsTopic

Returns a new instance of SnsTopic.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/awspec/helper/finder/sns_topic.rb', line 10

def initialize(attribs)
  @policy = attribs['Policy']
  @owner = attribs['Owner']
  @pending_subscriptions = attribs['SubscriptionsPending'].to_i
  @topic_arn = attribs['TopicArn']
  @effective_delivery_policy = attribs['EffectiveDeliveryPolicy']
  @display_name = attribs['DisplayName']
  @confirmed_subscriptions = attribs['SubscriptionsConfirmed'].to_i
  @deleted_subscriptions = attribs['SubscriptionsDeleted'].to_i
  @name = attribs['TopicArn'].split(':')[-1]
end

Instance Attribute Details

#confirmed_subscriptionsObject (readonly)

to make testing results easier to the eyes instead of using Rspec include matcher for hashes



7
8
9
# File 'lib/awspec/helper/finder/sns_topic.rb', line 7

def confirmed_subscriptions
  @confirmed_subscriptions
end

#deleted_subscriptionsObject (readonly)

to make testing results easier to the eyes instead of using Rspec include matcher for hashes



7
8
9
# File 'lib/awspec/helper/finder/sns_topic.rb', line 7

def deleted_subscriptions
  @deleted_subscriptions
end

#display_nameObject (readonly)

to make testing results easier to the eyes instead of using Rspec include matcher for hashes



7
8
9
# File 'lib/awspec/helper/finder/sns_topic.rb', line 7

def display_name
  @display_name
end

#effective_delivery_policyObject (readonly)

to make testing results easier to the eyes instead of using Rspec include matcher for hashes



7
8
9
# File 'lib/awspec/helper/finder/sns_topic.rb', line 7

def effective_delivery_policy
  @effective_delivery_policy
end

#nameObject (readonly)

to make testing results easier to the eyes instead of using Rspec include matcher for hashes



7
8
9
# File 'lib/awspec/helper/finder/sns_topic.rb', line 7

def name
  @name
end

#ownerObject (readonly)

to make testing results easier to the eyes instead of using Rspec include matcher for hashes



7
8
9
# File 'lib/awspec/helper/finder/sns_topic.rb', line 7

def owner
  @owner
end

#pending_subscriptionsObject (readonly)

to make testing results easier to the eyes instead of using Rspec include matcher for hashes



7
8
9
# File 'lib/awspec/helper/finder/sns_topic.rb', line 7

def pending_subscriptions
  @pending_subscriptions
end

#policyObject (readonly)

to make testing results easier to the eyes instead of using Rspec include matcher for hashes



7
8
9
# File 'lib/awspec/helper/finder/sns_topic.rb', line 7

def policy
  @policy
end

#topic_arnObject (readonly)

to make testing results easier to the eyes instead of using Rspec include matcher for hashes



7
8
9
# File 'lib/awspec/helper/finder/sns_topic.rb', line 7

def topic_arn
  @topic_arn
end

Instance Method Details

#to_sObject



22
23
24
25
26
27
28
29
# File 'lib/awspec/helper/finder/sns_topic.rb', line 22

def to_s
  output = ["SnsTopic: #{self.name}"]
  self.instance_variables.each do |attrib|
    tmp = attrib.to_s.sub('@', '')
    output << "  #{tmp} = #{self.send(tmp)}"
  end
  output.join("\n")
end