Sha256: 3c39ce85e9580c57d2078b80bb4a2614ddd36dadc328060eb02c934a349d6294

Contents?: true

Size: 757 Bytes

Versions: 5

Compression:

Stored size: 757 Bytes

Contents

class GeocoderRequest < Struct.new(:latitude, :longitude, :country, :state, :city, :locality, :postal, :text)

  def to_params
    result = []
    result << "\"latitude\":#{CGI.escape latitude}" unless latitude.nil?
    result << "\"longitude\":#{CGI.escape longitude}" unless longitude.nil?
    result << "\"country\":\"#{CGI.escape country}\"" unless country.nil?
    result << "\"state\":\"#{CGI.escape state}\"" unless state.nil?
    result << "\"city\":\"#{CGI.escape city}\"" unless city.nil?
    result << "\"locality\":\"#{CGI.escape locality}\"" unless locality.nil?
    result << "\"postal\":\"#{CGI.escape postal}\"" unless postal.nil?
    result << "\"text\":\"#{CGI.escape text}\"" unless text.nil?
    '{' + result.join(", ") + '}'
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
threetaps-client-1.0.10 lib/dto/geocoder/geocoder_request.rb
threetaps-client-1.0.9 lib/dto/geocoder/geocoder_request.rb
threetaps-client-1.0.8 lib/dto/geocoder/geocoder_request.rb
threetaps-client-1.0.7 lib/dto/geocoder/geocoder_request.rb
threetaps-client-1.0.6 lib/dto/geocoder/geocoder_request.rb