Class: FakeSNS::Actions::CreateTopic

Inherits:
FakeSNS::Action show all
Defined in:
lib/fake_sns/actions/create_topic.rb

Instance Attribute Summary collapse

Attributes inherited from FakeSNS::Action

#db, #params

Instance Method Summary collapse

Methods inherited from FakeSNS::Action

#initialize, param

Constructor Details

This class inherits a constructor from FakeSNS::Action

Instance Attribute Details

#topicObject (readonly)

Returns the value of attribute topic.



20
21
22
# File 'lib/fake_sns/actions/create_topic.rb', line 20

def topic
  @topic
end

Instance Method Details

#arnObject



16
17
18
# File 'lib/fake_sns/actions/create_topic.rb', line 16

def arn
  topic["arn"]
end

#callObject



11
12
13
14
# File 'lib/fake_sns/actions/create_topic.rb', line 11

def call
  raise InvalidParameterValue, "Topic Name: #{name.inspect}" unless valid_name?
  @topic = (existing_topic || new_topic)
end

#valid_name?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/fake_sns/actions/create_topic.rb', line 7

def valid_name?
  name =~ /\A[\w\-]+\z/
end