Class: Geonames::PostalCodeSearchCriteria
- Inherits:
-
Object
- Object
- Geonames::PostalCodeSearchCriteria
- Defined in:
- lib/geonames/postal_code_search_criteria.rb
Instance Attribute Summary collapse
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#is_or_operator ⇒ Object
Returns the value of attribute is_or_operator.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#max_rows ⇒ Object
Returns the value of attribute max_rows.
-
#place_name ⇒ Object
Returns the value of attribute place_name.
-
#postal_code ⇒ Object
Returns the value of attribute postal_code.
-
#radius ⇒ Object
Returns the value of attribute radius.
-
#style ⇒ Object
Returns the value of attribute style.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ PostalCodeSearchCriteria
constructor
A new instance of PostalCodeSearchCriteria.
- #to_query_params_string ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ PostalCodeSearchCriteria
Returns a new instance of PostalCodeSearchCriteria.
28 29 30 31 32 33 34 |
# File 'lib/geonames/postal_code_search_criteria.rb', line 28 def initialize(params={}) params.each do |attr, value| self.public_send("#{attr}=", value) end if params @is_or_operator = false end |
Instance Attribute Details
#country_code ⇒ Object
Returns the value of attribute country_code.
24 25 26 |
# File 'lib/geonames/postal_code_search_criteria.rb', line 24 def country_code @country_code end |
#is_or_operator ⇒ Object
Returns the value of attribute is_or_operator.
24 25 26 |
# File 'lib/geonames/postal_code_search_criteria.rb', line 24 def is_or_operator @is_or_operator end |
#latitude ⇒ Object
Returns the value of attribute latitude.
24 25 26 |
# File 'lib/geonames/postal_code_search_criteria.rb', line 24 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
24 25 26 |
# File 'lib/geonames/postal_code_search_criteria.rb', line 24 def longitude @longitude end |
#max_rows ⇒ Object
Returns the value of attribute max_rows.
24 25 26 |
# File 'lib/geonames/postal_code_search_criteria.rb', line 24 def max_rows @max_rows end |
#place_name ⇒ Object
Returns the value of attribute place_name.
24 25 26 |
# File 'lib/geonames/postal_code_search_criteria.rb', line 24 def place_name @place_name end |
#postal_code ⇒ Object
Returns the value of attribute postal_code.
24 25 26 |
# File 'lib/geonames/postal_code_search_criteria.rb', line 24 def postal_code @postal_code end |
#radius ⇒ Object
Returns the value of attribute radius.
24 25 26 |
# File 'lib/geonames/postal_code_search_criteria.rb', line 24 def radius @radius end |
#style ⇒ Object
Returns the value of attribute style.
24 25 26 |
# File 'lib/geonames/postal_code_search_criteria.rb', line 24 def style @style end |
Instance Method Details
#to_query_params_string ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/geonames/postal_code_search_criteria.rb', line 36 def to_query_params_string url = '' url << "&postalcode=" + CGI.escape(@postal_code) unless @postal_code.nil? url << "&placename=" + CGI.escape(@place_name) unless @place_name.nil? url << "&lat=" + CGI.escape(@latitude.to_s) unless @latitude.nil? url << "&lng=" + CGI.escape(@longitude.to_s) unless @longitude.nil? url << "&style=" + CGI.escape(@style) unless @style.nil? url << "&country=" + CGI.escape(@country_code) unless @country_code.nil? url << "&maxRows=" + CGI.escape(@max_rows.to_s) unless @max_rows.nil? url << "&radius=" + CGI.escape(@radius.to_s) unless @radius.nil? url << "&operator=OR" if @is_or_operator url end |