Module: Terminal::Modules::CreateAndManageSnapshots

Includes:
Utils
Included in:
API
Defined in:
lib/terminal/modules/create_and_manage_snapshots.rb

Instance Method Summary collapse

Instance Method Details

#count_snapshots(options = {}) ⇒ Hash

Returns a count of all your snapshots, filtered by options

Parameters:

  • options (Hash) (defaults to: {})

    options to filter on

Options Hash (options):

  • username (String)

    filter by the owner's username

  • tag (String)

    filter by a tag

  • featured (Boolean)

    filter by featured status

  • title (String)

    filter by the title of the snapshot

Returns:

  • (Hash)

    count, the key :snapshots_count is top level

See Also:

Authentication:

  • Requires user_token and access_token



38
39
40
41
# File 'lib/terminal/modules/create_and_manage_snapshots.rb', line 38

def count_snapshots(options = {})
  options[:auth] = true
  perform(:post, 'count_snapshots', options)
end

#delete_snapshot(snapshot_id) ⇒ Hash

Delete a snapshot by id

Parameters:

  • snapshot_id (String)

    the id of the snapshot to delete

Returns:

  • (Hash)

See Also:

Authentication:

  • Requires user_token and access_token



49
50
51
52
53
54
# File 'lib/terminal/modules/create_and_manage_snapshots.rb', line 49

def delete_snapshot(snapshot_id)
  options = {}
  options[:auth] = true
  options[:snapshot_id] = snapshot_id
  perform(:post, 'delete_snapshot', options)
end

#edit_snapshot(snapshot_id, options = {}) ⇒ Object

Edit the metadata of a snapshot owned by your account.

Parameters:

  • snapshot_id (String)

    the id of the snapshot you want to edit

  • options (Hash) (defaults to: {})

    options you want to edit (snapshot meta data)

Options Hash (options):

  • body (String)
  • title (String)
  • readme (String)
  • tags (Array)
  • public (Boolean)

See Also:

Authentication:

  • Require user_token and access token



67
68
69
70
71
# File 'lib/terminal/modules/create_and_manage_snapshots.rb', line 67

def edit_snapshot(snapshot_id, options ={})
  options[:auth] = true
  options[:snapshot_id] = snapshot_id
  perform(:post, 'edit_snapshot', options)
end

#list_snapshots(options = {}) ⇒ Hash

Returns a list of all your snapshots, filtered by options

Parameters:

  • options (Hash) (defaults to: {})

    options to filter results on

Options Hash (options):

  • username (String)

    filter by the username

  • tag (String)

    filter by the tag

  • featured (Boolean)

    is it featured

  • title (String)

    the title of the snapshot

  • page (Integer)

    WTF

  • perPage (Integer)

    paginate results I think

  • sortby (String)

    popularity or date

Returns:

  • (Hash)

    of snapshots, the key :snapshots is top level

See Also:

Authentication:

  • Requires user_token and access_token



23
24
25
26
# File 'lib/terminal/modules/create_and_manage_snapshots.rb', line 23

def list_snapshots(options = {})
  options[:auth] = true
  perform(:post, 'list_snapshots', options)
end

#snapshot_terminal(container_key, options = {}) ⇒ Hash

Create a snapshot of a terminal instance, but it actually makes no sense

Parameters:

  • container_key (String)
  • options (Hash) (defaults to: {})

Options Hash (options):

  • body (Object)

Returns:

  • (Hash)

See Also:

Authentication:

  • Requires user_token and access_token



81
82
83
84
85
# File 'lib/terminal/modules/create_and_manage_snapshots.rb', line 81

def snapshot_terminal(container_key, options = {})
  options[:auth] = true
  options[:container_key] = container_key
  perform(:post, 'snapshot_terminal', options)
end