Sha256: 90090c688a114ba8274c31e6a96b317068741b8ab2b0564234eb5169b58b38b7

Contents?: true

Size: 669 Bytes

Versions: 2

Compression:

Stored size: 669 Bytes

Contents

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

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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
threetaps-client-1.0.12 lib/dto/geocoder/geocoder_request.rb
threetaps-client-1.0.11 lib/dto/geocoder/geocoder_request.rb