Module: Terminal::Modules::BrowseSnapshotsAndUsers

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

Instance Method Summary collapse

Instance Method Details

#count_public_snapshots(username, options = {}) ⇒ Hash

Get count of public snapshots, optionally filtered by the owner's username, a tag, or the snapshot's featured status. Combinations of filters are fine.

Parameters:

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

Options Hash (options):

  • tag (String)

    tag the snapshot was created with

  • featured (Boolean)

    true/false

  • title (String)

    title of the snapshot

Returns:

  • (Hash)

    has of 1 key the count, :snapshot_count

See Also:

Authentication:

  • No auth required



61
62
63
64
# File 'lib/terminal/modules/browse_snapshots_and_users.rb', line 61

def count_public_snapshots(username, options = {})
  options[:username] = username
  perform(:post, 'count_public_snapshots', options)
end

#get_profile(username) ⇒ Hash

Get information about a user

Parameters:

  • username (String)

    The user to look up

Returns:

  • (Hash)

    user information, top level :user [:name, :username, :url ...] etc

See Also:

Authentication:

  • No auth required



25
26
27
# File 'lib/terminal/modules/browse_snapshots_and_users.rb', line 25

def get_profile(username)
  perform(:post, 'get_profile', { :username => username })
end

#get_snapshot(snapshot_id) ⇒ Hash

Get information about a snapshot

Parameters:

  • snapshot_id (String)

    the id of the snapshot you want info about

Returns:

  • (Hash)

    snapshot information, top level :snapshot [:title, :body, :readme, :tags ...] etc

See Also:

Authentication:

  • No auth required



15
16
17
# File 'lib/terminal/modules/browse_snapshots_and_users.rb', line 15

def get_snapshot(snapshot_id)
  perform(:post, 'get_snapshot', { :snapshot_id => snapshot_id })
end

#list_public_snapshots(username, options = {}) ⇒ Hash

List public snapshots, optionally filtered by the owner's username, a tag, or the snapshot's featured status. Combinations of filters are fine.

Parameters:

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

Options Hash (options):

  • tag (String)

    tag the snapshot was created with

  • featured (Boolean)

    true/false

  • title (String)

    title of the snapshot

  • page (Integer)

    0

  • perPage (Integer)

    results per page 10

  • sortby (String)

    popularity, date etc

Returns:

  • (Hash)

    hash of snapshots, top level key :snapshots

See Also:

Authentication:

  • No auth required



44
45
46
47
# File 'lib/terminal/modules/browse_snapshots_and_users.rb', line 44

def list_public_snapshots(username, options = {})
  options[:username] = username
  perform(:post, 'list_public_snapshots', options)
end