Class: Locomotive::Wagon::DeleteCommand
- Inherits:
-
Struct
- Object
- Struct
- Locomotive::Wagon::DeleteCommand
- Includes:
- ApiConcern, DeployFileConcern
- Defined in:
- lib/locomotive/wagon/commands/delete_command.rb
Constant Summary collapse
- SITE_RESOURCE =
'site'- SINGLE_RESOURCES =
%w(page content_type snippet section translation).freeze
- ALL_RESOURCES =
%w(content_types snippets theme_assets sections translations).freeze
Instance Attribute Summary collapse
-
#env ⇒ Object
Returns the value of attribute env.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#path ⇒ Object
Returns the value of attribute path.
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#shell ⇒ Object
Returns the value of attribute shell.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from DeployFileConcern
#deploy_file, #read_deploy_settings, #write_deploy_settings
Methods included from ApiConcern
#api_client, #api_credentials, #api_host, #api_site_client, #connection_information_from_env_and_path
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env
6 7 8 |
# File 'lib/locomotive/wagon/commands/delete_command.rb', line 6 def env @env end |
#identifier ⇒ Object
Returns the value of attribute identifier
6 7 8 |
# File 'lib/locomotive/wagon/commands/delete_command.rb', line 6 def identifier @identifier end |
#path ⇒ Object
Returns the value of attribute path
6 7 8 |
# File 'lib/locomotive/wagon/commands/delete_command.rb', line 6 def path @path end |
#resource ⇒ Object
Returns the value of attribute resource
6 7 8 |
# File 'lib/locomotive/wagon/commands/delete_command.rb', line 6 def resource @resource end |
#shell ⇒ Object
Returns the value of attribute shell
6 7 8 |
# File 'lib/locomotive/wagon/commands/delete_command.rb', line 6 def shell @shell end |
Class Method Details
.delete(*args) ⇒ Object
19 20 21 |
# File 'lib/locomotive/wagon/commands/delete_command.rb', line 19 def self.delete(*args) new(*args).delete end |
Instance Method Details
#delete ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/locomotive/wagon/commands/delete_command.rb', line 24 def delete if resource == SITE_RESOURCE delete_site elsif SINGLE_RESOURCES.include?(resource) delete_single elsif ALL_RESOURCES.include?(resource) delete_all else raise ArgumentError, "Resource must be one of #{SINGLE_RESOURCES.join(?,)} if you pass an identifier OR be one of #{ALL_RESOURCES.join(?,)} if you want to delete all the items of that resource." end end |