Class: GeocoderRequest

Inherits:
Struct
  • Object
show all
Defined in:
lib/dto/geocoder/geocoder_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

from_array, from_hash

Instance Attribute Details

#cityObject

Returns the value of attribute city

Returns:

  • (Object)

    the current value of city



1
2
3
# File 'lib/dto/geocoder/geocoder_request.rb', line 1

def city
  @city
end

#countryObject

Returns the value of attribute country

Returns:

  • (Object)

    the current value of country



1
2
3
# File 'lib/dto/geocoder/geocoder_request.rb', line 1

def country
  @country
end

#latitudeObject

Returns the value of attribute latitude

Returns:

  • (Object)

    the current value of latitude



1
2
3
# File 'lib/dto/geocoder/geocoder_request.rb', line 1

def latitude
  @latitude
end

#localityObject

Returns the value of attribute locality

Returns:

  • (Object)

    the current value of locality



1
2
3
# File 'lib/dto/geocoder/geocoder_request.rb', line 1

def locality
  @locality
end

#longitudeObject

Returns the value of attribute longitude

Returns:

  • (Object)

    the current value of longitude



1
2
3
# File 'lib/dto/geocoder/geocoder_request.rb', line 1

def longitude
  @longitude
end

#postalObject

Returns the value of attribute postal

Returns:

  • (Object)

    the current value of postal



1
2
3
# File 'lib/dto/geocoder/geocoder_request.rb', line 1

def postal
  @postal
end

#stateObject

Returns the value of attribute state

Returns:

  • (Object)

    the current value of state



1
2
3
# File 'lib/dto/geocoder/geocoder_request.rb', line 1

def state
  @state
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



1
2
3
# File 'lib/dto/geocoder/geocoder_request.rb', line 1

def text
  @text
end

Instance Method Details

#to_paramsObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/dto/geocoder/geocoder_request.rb', line 3

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.gsub(/"/,"")}\"" unless text.nil?
  '{' + result.join(", ") + '}'
end