class Devpad::CLI::Pad

Public Instance Methods

clone(pad_id) click to toggle source
# File lib/devpad/cli/pad.rb, line 44
def clone(pad_id)
  pad_clone = {
    name: options[:name],
    description: options[:description],
    template: options[:template],
    content: options[:content],
    initial_code: options[:initial_code],
    current_code: options[:current_code],
    containers: options[:containers]
  }
  params = {
    id: pad_id,
    pad_clone: pad_clone
  }
  new_pad_id = Devpad::CLI::Commands::Pad::Clone.new(shell: shell).execute(params)
  if options[:'with-link']
    Devpad::CLI::Commands::Pad::Link.new(shell: shell).execute(id: new_pad_id)
  end
end
close(pad_id) click to toggle source
# File lib/devpad/cli/pad.rb, line 90
def close(pad_id)
  Devpad::CLI::Commands::Pad::Close.new(shell: shell).execute(id: pad_id)
end
create() click to toggle source
# File lib/devpad/cli/pad.rb, line 25
def create
  params = {
    pad: {
      name: options[:name],
      description: options[:description],
      template: options[:template],
      language_id: options[:language]
    }
  }
  pad_id = Devpad::CLI::Commands::Pad::Create.new(shell: shell).execute(params)
  if options[:'with-link']
    Devpad::CLI::Commands::Pad::Link.new(shell: shell).execute(id: pad_id)
  end
end
invitation(pad_id) click to toggle source
# File lib/devpad/cli/pad.rb, line 72
def invitation(pad_id)
  params = {
    id: pad_id,
    pad_invitation: {
      email_attributes: {
        name: options[:name], address: options[:email]
      }
    }
  }
  Devpad::CLI::Commands::Pad::Invitation.new(shell: shell).execute(params)
end
list() click to toggle source
# File lib/devpad/cli/pad.rb, line 7
def list
  if options[:active].present?
    status = 'active'
  elsif options[:closed].present?
    status = 'closed'
  else
    status = nil
  end
  params = options.slice('template', 'page').merge('status' => status)
  Devpad::CLI::Commands::Pad::List.new(shell: shell).execute(params)
end
user(pad_id) click to toggle source
# File lib/devpad/cli/pad.rb, line 65
def user(pad_id)
  Devpad::CLI::Commands::Pad::User.new(shell: shell).execute(id: pad_id)
end