Class: Geonames::PostalCodeSearchCriteria

Inherits:
Object
  • Object
show all
Defined in:
lib/postal_code_search_criteria.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePostalCodeSearchCriteria

Returns a new instance of PostalCodeSearchCriteria.


35
36
37
# File 'lib/postal_code_search_criteria.rb', line 35

def initialize
  @is_or_operator = false
end

Instance Attribute Details

#country_codeObject

Returns the value of attribute country_code


24
25
26
# File 'lib/postal_code_search_criteria.rb', line 24

def country_code
  @country_code
end

#is_or_operatorObject

Returns the value of attribute is_or_operator


29
30
31
# File 'lib/postal_code_search_criteria.rb', line 29

def is_or_operator
  @is_or_operator
end

#latitudeObject

Returns the value of attribute latitude


25
26
27
# File 'lib/postal_code_search_criteria.rb', line 25

def latitude
  @latitude
end

#longitudeObject

Returns the value of attribute longitude


26
27
28
# File 'lib/postal_code_search_criteria.rb', line 26

def longitude
  @longitude
end

#max_rowsObject

Returns the value of attribute max_rows


28
29
30
# File 'lib/postal_code_search_criteria.rb', line 28

def max_rows
  @max_rows
end

#place_nameObject

Returns the value of attribute place_name


23
24
25
# File 'lib/postal_code_search_criteria.rb', line 23

def place_name
  @place_name
end

#postal_codeObject

Returns the value of attribute postal_code


22
23
24
# File 'lib/postal_code_search_criteria.rb', line 22

def postal_code
  @postal_code
end

#styleObject

Returns the value of attribute style


27
28
29
# File 'lib/postal_code_search_criteria.rb', line 27

def style
  @style
end

Instance Method Details

#to_query_params_stringObject


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/postal_code_search_criteria.rb', line 39

def to_query_params_string
    url = ''

    if !@postal_code.nil? 
      url = url + "&postalcode=" + CGI::escape( @postal_code )
    end
    
    if !@place_name.nil? 
      url = url + "&placename=" + CGI::escape( @place_name )
    end
    
    if !@latitude.nil?
        url = url + "&lat" + CGI::escape( @latitude )
    end
    
    if !@longitude.nil?
        url = url + "&lng" + CGI::escape( @longitude )
    end

    if !@style.nil?
        url = url + "&style" + CGI::escape( @style )
    end
    
    if !@country_code.nil? 
      url = url + "&country=" + CGI::escape( @country_code )
    end
    
    if !@max_rows.nil? 
      url = url + "&maxRows=" + CGI::escape( @max_rows )
    end
    
    if @is_or_operator 
      url = url + "&operator=OR"
    end
    
    url
end