carlosparamio-geoplanet 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +2 -2
- data/geoplanet.gemspec +1 -1
- data/lib/geoplanet/base.rb +3 -2
- data/lib/geoplanet/version.rb +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -8,7 +8,7 @@ but this version supports better usage of matrix and query parameters, uses JSON
|
|
8
8
|
=== Searching for a Location:
|
9
9
|
|
10
10
|
require 'geoplanet'
|
11
|
-
GeoPlanet.
|
11
|
+
GeoPlanet.appid = [Your App ID Here]
|
12
12
|
|
13
13
|
# Search for places that matches "Springfield" (the API returns 1 by default)
|
14
14
|
GeoPlanet::Place.search("Springfield")
|
@@ -24,7 +24,7 @@ but this version supports better usage of matrix and query parameters, uses JSON
|
|
24
24
|
=== Initializing by Where On Earth ID && Associations
|
25
25
|
|
26
26
|
require 'geoplanet'
|
27
|
-
GeoPlanet.
|
27
|
+
GeoPlanet.appid = [Your App ID Here]
|
28
28
|
|
29
29
|
a = GeoPlanet::Place.new(752067) # WoE ID for Algeciras
|
30
30
|
|
data/geoplanet.gemspec
CHANGED
data/lib/geoplanet/base.rb
CHANGED
@@ -13,7 +13,7 @@ module GeoPlanet
|
|
13
13
|
raise ArgumentError, "appid or q filter missing" if query_params[:appid].nil? || resource_path == 'places' && filters[:q].nil? # required
|
14
14
|
|
15
15
|
q = ".q('#{filters[:q]}')" if filters[:q]
|
16
|
-
type = ".type('#{filters[:type]
|
16
|
+
type = ".type('#{filters[:type]}')" if filters[:type]
|
17
17
|
|
18
18
|
query_string = q && type ? "$and(#{q},#{type})" : "#{q}#{type}"
|
19
19
|
|
@@ -58,7 +58,8 @@ module GeoPlanet
|
|
58
58
|
|
59
59
|
def extract_filters(options)
|
60
60
|
filters = %w(q type)
|
61
|
-
|
61
|
+
options[:type] = options[:type].join(",") if options[:type].is_a?(Array)
|
62
|
+
Hash[*(options.select{|k,v| filters.include?(k.to_s)}).flatten]
|
62
63
|
end
|
63
64
|
|
64
65
|
def extract_matrix_params(options)
|
data/lib/geoplanet/version.rb
CHANGED