mattt-yahoo-geoplanet 0.1.0 → 0.2.0
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/lib/yahoo-geoplanet/base.rb +8 -1
- data/lib/yahoo-geoplanet/place.rb +2 -2
- data/lib/yahoo-geoplanet/version.rb +1 -1
- data/yahoo-geoplanet.gemspec +1 -1
- metadata +3 -1
data/lib/yahoo-geoplanet/base.rb
CHANGED
|
@@ -16,8 +16,15 @@ module Yahoo
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def api_path(resource, id, collection, *args)
|
|
19
|
+
args = args.extract_options!
|
|
20
|
+
count = args.delete(:count)
|
|
21
|
+
start = args.delete(:start)
|
|
22
|
+
collection += ";count=#{count}" if count
|
|
23
|
+
collection += ";start=#{start}" if start
|
|
24
|
+
|
|
19
25
|
parameters = [resource, id, collection, *args].compact
|
|
20
|
-
return parameters.collect!{|param| CGI::escape(param.to_s).downcase}.join('/')
|
|
26
|
+
# return parameters.collect!{|param| CGI::escape(param.to_s).downcase}.join('/')
|
|
27
|
+
return parameters.collect!{|param| param.to_s.downcase}.join('/')
|
|
21
28
|
end
|
|
22
29
|
end
|
|
23
30
|
|
|
@@ -39,8 +39,8 @@ module Yahoo
|
|
|
39
39
|
|
|
40
40
|
# Association Collections
|
|
41
41
|
["parent", "ancestors", "belongtos", "neighbors", "siblings", "children"].each do |association|
|
|
42
|
-
define_method(association.to_sym) do
|
|
43
|
-
xml = self.class.fetch_and_parse(self.class.api_path(self.class.name, @woe_id, association), :select => :long)
|
|
42
|
+
define_method(association.to_sym) do |*options|
|
|
43
|
+
xml = self.class.fetch_and_parse(self.class.api_path(self.class.name, @woe_id, association, *options), :select => :long)
|
|
44
44
|
value = xml.search(self.class.name.downcase).collect{|elem| self.class.new(elem)}
|
|
45
45
|
return association.singularize == association ? value.first : value
|
|
46
46
|
end
|
data/yahoo-geoplanet.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mattt-yahoo-geoplanet
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mattt Thompson
|
|
@@ -14,6 +14,7 @@ default_executable:
|
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: hpricot
|
|
17
|
+
type: :runtime
|
|
17
18
|
version_requirement:
|
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
|
19
20
|
requirements:
|
|
@@ -23,6 +24,7 @@ dependencies:
|
|
|
23
24
|
version:
|
|
24
25
|
- !ruby/object:Gem::Dependency
|
|
25
26
|
name: activesupport
|
|
27
|
+
type: :runtime
|
|
26
28
|
version_requirement:
|
|
27
29
|
version_requirements: !ruby/object:Gem::Requirement
|
|
28
30
|
requirements:
|