Class: PostyClient::Command::DomainCommand
- Inherits:
-
Thor
- Object
- Thor
- PostyClient::Command::DomainCommand
- Defined in:
- lib/posty_client/command/domain_command.rb
Instance Method Summary collapse
Instance Method Details
#add(name) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/posty_client/command/domain_command.rb', line 11 def add(name) domain = PostyClient::Resources::Domain.new(name) unless domain.save say domain.errors.inspect, :red exit 1 end end |
#delete(name) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/posty_client/command/domain_command.rb', line 31 def delete(name) if yes?("Delete #{name}?") domain = PostyClient::Resources::Domain.new(name) unless domain.delete say domain.errors.inspect, :red exit 1 end end end |
#list ⇒ Object
5 6 7 8 |
# File 'lib/posty_client/command/domain_command.rb', line 5 def list domains = PostyClient::Resources::Domain.all.map {|d| [d.name]} print_table(domains) end |
#rename(name, new_name) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/posty_client/command/domain_command.rb', line 21 def rename(name, new_name) domain = PostyClient::Resources::Domain.new(name) domain.attributes['name'] = new_name unless domain.save say domain.errors.inspect, :red exit 1 end end |