class QuickMug::Image

Attributes

id[R]
key[R]

Public Class Methods

fromApi(data) click to toggle source
# File lib/quickmug/image.rb, line 32
def self.fromApi(data)
  Image.new(data['id'], data['Key'])
end
fromArgs(args) click to toggle source
# File lib/quickmug/image.rb, line 36
def self.fromArgs(args)
  raise ArgumentError.new('You must specify an image ID and KEY') if args.size < 2
  Image.new(args[0],args[1])
end
new(id, key) click to toggle source
# File lib/quickmug/image.rb, line 5
def initialize(id, key)
  @id = id
  @key = key
end

Public Instance Methods

apiHash() click to toggle source
# File lib/quickmug/image.rb, line 10
def apiHash
  {:ImageID => @id, :ImageKey => @key}
end
info() click to toggle source
# File lib/quickmug/image.rb, line 14
def info
  @info ||= QuickMug.client.images.getInfo(apiHash)
end
render() click to toggle source
# File lib/quickmug/image.rb, line 22
def render
  output = QuickMug.config['format']

  info.each do |key, value|
    output = output.gsub("[#{key}]", value.to_s)
  end

  output
end
to_s() click to toggle source
# File lib/quickmug/image.rb, line 18
def to_s
  render
end