def call(action, query={}, &blk)
      call!(action, expand(query)) do |code, data|
        case code
        when 200
          response = compact(data)
        when 400...500
          messages = if data["Response"]
            Array(data["Response"]["Errors"]).map {|_, e| e["Message"] }
          elsif data["ErrorResponse"]
            Array(data["ErrorResponse"]["Error"]["Code"])
          end
          raise InvalidRequest, messages.join(",")
        else
          msg = "unexpected response #{code} -> #{data.inspect}"
          raise InvalidRequest, msg
        end

        if blk
          blk.call(response)
        else
          response
        end
      end
    end
def call(action, query={}, &blk)
      call!(action, expand(query)) do |code, data|
        case code
        when 200
          response = compact(data)
        when 400...500
          messages = if data["Response"]
            Array(data["Response"]["Errors"]).map {|_, e| e["Message"] }
          elsif data["ErrorResponse"]
            Array(data["ErrorResponse"]["Error"]["Code"])
          end
          raise InvalidRequest, messages.join(",")
        else
          msg = "unexpected response #{code} -> #{data.inspect}"
          raise InvalidRequest, msg
        end

        if blk
          blk.call(response)
        else
          response
        end
      end
    end
Execute an EC2 command, expand the input,
 and compact the output

 Examples:
   ec2.call("DescribeInstances")
   ec2.call("TerminateInstances", "InstanceId" => ["i-1234", "i-993j"]