def open
      raise "Already open" if open?

      @session = Net::HTTP.new(HOST, Net::HTTP.https_default_port)
      @session.use_ssl = true

      begin
        @session.start
        block_given? ? yield : self
      ensure
        close if block_given?
      end
    end
def open
      raise "Already open" if open?

      @session = Net::HTTP.new(HOST, Net::HTTP.https_default_port)
      @session.use_ssl = true

      begin
        @session.start
        block_given? ? yield : self
      ensure
        close if block_given?
      end
    end
Opens the client, creating a new TCP connection.

 If a block is given, yields to the block, closes the client when the
 block returns, and returns the return value of the block. If a
 block is not given, returns self and leaves the client open, relying on
 the caller to close the client with {#close}.

 Note that opening and closing the client is only required if you want to
 make several calls under one TCP connection. Otherwise, you can simply
 call the search methods ({#web}, {#image}, etc.), which call {#open} for
 you if necessary.

 @yield
   If a block is given, the client is closed when the block returns.
 @return [Object, self]
   If a block is given, the return value of the block; otherwise, +self+.
 @raise [StandardError]
   The client is already open