Class: Banacle::SlashCommand::Command
- Inherits:
-
Object
- Object
- Banacle::SlashCommand::Command
- Defined in:
- lib/banacle/slash_command/command.rb
Constant Summary collapse
- CREATE_ACTION =
'create'.freeze
- DELETE_ACTION =
'delete'.freeze
- PERMITTED_ACTIONS =
[CREATE_ACTION, DELETE_ACTION].freeze
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#cidr_blocks ⇒ Object
readonly
Returns the value of attribute cidr_blocks.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#vpc_id ⇒ Object
readonly
Returns the value of attribute vpc_id.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(action:, region:, vpc_id:, cidr_blocks:) ⇒ Command
constructor
A new instance of Command.
- #to_h ⇒ Object
Constructor Details
#initialize(action:, region:, vpc_id:, cidr_blocks:) ⇒ Command
Returns a new instance of Command.
12 13 14 15 16 17 |
# File 'lib/banacle/slash_command/command.rb', line 12 def initialize(action:, region:, vpc_id:, cidr_blocks:) @action = action @region = region @vpc_id = vpc_id @cidr_blocks = cidr_blocks end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
19 20 21 |
# File 'lib/banacle/slash_command/command.rb', line 19 def action @action end |
#cidr_blocks ⇒ Object (readonly)
Returns the value of attribute cidr_blocks.
19 20 21 |
# File 'lib/banacle/slash_command/command.rb', line 19 def cidr_blocks @cidr_blocks end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
19 20 21 |
# File 'lib/banacle/slash_command/command.rb', line 19 def region @region end |
#vpc_id ⇒ Object (readonly)
Returns the value of attribute vpc_id.
19 20 21 |
# File 'lib/banacle/slash_command/command.rb', line 19 def vpc_id @vpc_id end |
Instance Method Details
#execute ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/banacle/slash_command/command.rb', line 21 def execute case action when CREATE_ACTION create_nacl when DELETE_ACTION delete_nacl else # Do nothing end end |
#to_h ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/banacle/slash_command/command.rb', line 32 def to_h { action: action, region: region, vpc_id: vpc_id, cidr_blocks: cidr_blocks, } end |