geonames.rb
def query(name, parameters)
    default = {host: options[:host]}
    default[:username] = options[:username] if options[:username]

    uri = uris[name].expand(default.merge(parameters))

    result =
      if block_given?
        open(uri.to_s){|io| yield(io.read) }
      else
        open(uri.to_s){|io| JSON.parse(io.read) }
      end

    if status = result["status"]
      raise APIError, status.inspect
    else
      result
    end
  end
# Execute query for given +name+ with +parameters+ translated via URI
# template expansion.
Execute query for given +name+ with +parameters+ translated via URI
template expansion.
Execute query for given + name + with + parameters + translated via URI template expansion .
def query(name, parameters)
    default = {host: options[:host]}
    default[:username] = options[:username] if options[:username]
    uri = uris[name].expand(default.merge(parameters))
    result =
      if block_given?
        open(uri.to_s){|io| yield(io.read) }
      else
        open(uri.to_s){|io| JSON.parse(io.read) }
      end
    if status = result["status"]
      raise APIError, status.inspect
    else
      result
    end
  end
def query ( name , parameters ) default = { host : options [ :host ] } default [ :username ] = options [ :username ] if options [ :username ] uri = uris [ name ] . expand ( default . merge ( parameters ) ) result = if block_given? open ( uri . to_s ) { | io | yield ( io . read ) } else open ( uri . to_s ) { | io | JSON . parse ( io . read ) } end if status = result [ "status" ] raise APIError , status . inspect else result end end
Execute query for given +name+ with +parameters+ translated via URI
template expansion.
Execute query for given + name + with + parameters + translated via URI template expansion .
name
parameters