class PostyClient::Command::TransportCommand

Public Instance Methods

add(name, destination) click to toggle source
# File lib/posty_client/command/transport_command.rb, line 11
def add(name, destination)
  transport = PostyClient::Resources::Transport.new(name)
  transport.attributes['destination'] = destination
  
  unless transport.save
    say transport.errors.inspect, :red
    exit 1
  end
end
delete(name) click to toggle source
# File lib/posty_client/command/transport_command.rb, line 33
def delete(name)
  if yes?("Delete #{name}?")
    transport = PostyClient::Resources::Transport.new(name)
    unless transport.delete
      say transport.errors.inspect, :red
      exit 1
    end
  end
end
list() click to toggle source
# File lib/posty_client/command/transport_command.rb, line 5
def list
  transports = PostyClient::Resources::Transport.all.map {|d| [d.name]}
  print_table(transports)
end
rename(name, new_name) click to toggle source
# File lib/posty_client/command/transport_command.rb, line 22
def rename(name, new_name)
  transport = PostyClient::Resources::Transport.new(name)
  transport.attributes['name'] = new_name
  
  unless transport.save
    say transport.errors.inspect, :red
    exit 1
  end
end