Class: OKCupid::LocationParameter

Inherits:
Object
  • Object
show all
Defined in:
lib/lonely_coder/search/options/location.rb

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ LocationParameter

Returns a new instance of LocationParameter.



3
4
5
# File 'lib/lonely_coder/search/options/location.rb', line 3

def initialize(value)
  @value = value
end

Instance Method Details

#to_paramObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/lonely_coder/search/options/location.rb', line 7

def to_param
  if @value.is_a?(String)
    if @value.downcase == 'near me'
      "locid=0"
    else
      "locid=#{Search.location_id_for(@value)}&lquery=#{URI.escape(@value)}"
    end
  else
    "locid=#{@value}"
  end
end