Class: GeocoderRequest
- Defined in:
- lib/dto/geocoder/geocoder_request.rb
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#locality ⇒ Object
Returns the value of attribute locality.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#postal ⇒ Object
Returns the value of attribute postal.
-
#state ⇒ Object
Returns the value of attribute state.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
Methods inherited from Struct
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city
1 2 3 |
# File 'lib/dto/geocoder/geocoder_request.rb', line 1 def city @city end |
#country ⇒ Object
Returns the value of attribute country
1 2 3 |
# File 'lib/dto/geocoder/geocoder_request.rb', line 1 def country @country end |
#latitude ⇒ Object
Returns the value of attribute latitude
1 2 3 |
# File 'lib/dto/geocoder/geocoder_request.rb', line 1 def latitude @latitude end |
#locality ⇒ Object
Returns the value of attribute locality
1 2 3 |
# File 'lib/dto/geocoder/geocoder_request.rb', line 1 def locality @locality end |
#longitude ⇒ Object
Returns the value of attribute longitude
1 2 3 |
# File 'lib/dto/geocoder/geocoder_request.rb', line 1 def longitude @longitude end |
#postal ⇒ Object
Returns the value of attribute postal
1 2 3 |
# File 'lib/dto/geocoder/geocoder_request.rb', line 1 def postal @postal end |
#state ⇒ Object
Returns the value of attribute state
1 2 3 |
# File 'lib/dto/geocoder/geocoder_request.rb', line 1 def state @state end |
#text ⇒ Object
Returns the value of attribute text
1 2 3 |
# File 'lib/dto/geocoder/geocoder_request.rb', line 1 def text @text end |
Instance Method Details
#to_params ⇒ Object
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 |