Class: Smug::AlbumsCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/smugsync/albums.rb

Instance Method Summary collapse

Methods included from Utils

#method_missing, #status_message

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Smug::Utils

Instance Method Details

#execObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/smugsync/albums.rb', line 6

def exec
    cmd = ARGV[0]
    if cmd == 'list'
        authenticate

        albums = get("smugmug.albums.get")["Albums"]

        format = "%-10s%-10s%-s\n"
        printf(format, "Id", "Key", "Title")
        albums.each do |a|
            printf(format, a["id"], a["Key"], a["Title"])
        end
    else
        $stderr.puts "albums: unknown command #{cmd}"
        exit(1)
    end
end