iwannagothere 0.0.1 → 0.0.2
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 +3 -0
- data/Rakefile +21 -0
- data/examples/all_methods.rb +3 -5
- data/iwannagothere.gemspec +54 -0
- data/lib/iwannagothere/client.rb +7 -3
- data/lib/iwannagothere/item.rb +6 -1
- metadata +7 -5
data/README.rdoc
CHANGED
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gemspec|
|
7
|
+
gemspec.name = "iwannagothere"
|
8
|
+
gemspec.version = "0.0.2"
|
9
|
+
gemspec.summary = "Ruby wrapper for iwannagothere API "
|
10
|
+
gemspec.description = "Ruby wrapper for iwannagothere API "
|
11
|
+
gemspec.email = "jrdi.villar@gmail.com"
|
12
|
+
gemspec.homepage = "https://github.com/jrd/iwannagothere"
|
13
|
+
gemspec.authors = ["Jordi Villar"]
|
14
|
+
gemspec.add_dependency("httparty")
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
19
|
+
end
|
20
|
+
|
21
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/examples/all_methods.rb
CHANGED
@@ -9,8 +9,6 @@ puts p.guides
|
|
9
9
|
puts c.user_information(1)
|
10
10
|
puts c.guide_information(120)
|
11
11
|
puts i = c.item_information(120)
|
12
|
-
|
13
|
-
puts r.
|
14
|
-
|
15
|
-
puts "Esto falla porque este item solo tiene una foto"
|
16
|
-
puts i.photos
|
12
|
+
puts i.photos
|
13
|
+
puts r = c.item_information(6426)
|
14
|
+
puts r.photos
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{iwannagothere}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jordi Villar"]
|
12
|
+
s.date = %q{2010-11-20}
|
13
|
+
s.description = %q{Ruby wrapper for iwannagothere API }
|
14
|
+
s.email = %q{jrdi.villar@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.md",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"README.md",
|
21
|
+
"examples/all_methods.rb",
|
22
|
+
"lib/core_ext/string.rb",
|
23
|
+
"lib/iwannagothere.rb",
|
24
|
+
"lib/iwannagothere/client.rb",
|
25
|
+
"lib/iwannagothere/element.rb",
|
26
|
+
"lib/iwannagothere/item.rb",
|
27
|
+
"lib/iwannagothere/item_route.rb",
|
28
|
+
"lib/iwannagothere/photo.rb",
|
29
|
+
"lib/iwannagothere/place.rb",
|
30
|
+
"lib/iwannagothere/urls.rb",
|
31
|
+
"lib/iwannagothere/user.rb"
|
32
|
+
]
|
33
|
+
s.homepage = %q{https://github.com/jrd/iwannagothere}
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubygems_version = %q{1.3.7}
|
36
|
+
s.summary = %q{Ruby wrapper for iwannagothere API}
|
37
|
+
s.test_files = [
|
38
|
+
"examples/all_methods.rb"
|
39
|
+
]
|
40
|
+
|
41
|
+
if s.respond_to? :specification_version then
|
42
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
43
|
+
s.specification_version = 3
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
47
|
+
else
|
48
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
49
|
+
end
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
data/lib/iwannagothere/client.rb
CHANGED
@@ -30,9 +30,13 @@ module IWannaGoThere
|
|
30
30
|
|
31
31
|
private
|
32
32
|
def geoname_id(q)
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
if q.is_a? String
|
34
|
+
geo_options = { :query => { :name => q, :maxRows => "1" }}
|
35
|
+
r = IWannaGoThere.get(Urls::GEO_URL, geo_options)
|
36
|
+
r["geonames"]["geoname"]["geonameId"]
|
37
|
+
elsif q.is_a? Integer
|
38
|
+
q
|
39
|
+
end
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
data/lib/iwannagothere/item.rb
CHANGED
@@ -7,7 +7,12 @@ module IWannaGoThere
|
|
7
7
|
|
8
8
|
def photos(size = 'square', limit = 10)
|
9
9
|
r = IWannaGoThere.get(@urls[:item_photos].params({ :item_id => @id || @item_id }), @options, { :limit => limit, :size => size })
|
10
|
-
|
10
|
+
|
11
|
+
if r['pictures']['picture'].is_a? Array
|
12
|
+
r['pictures']['picture'].collect{ |p| Photo.new( p ) }
|
13
|
+
elsif r['pictures']['picture'].is_a? Hash
|
14
|
+
r['pictures']['picture'].collect{ |p| Photo.new( r['pictures']['picture'] ) }
|
15
|
+
end
|
11
16
|
end
|
12
17
|
end
|
13
18
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iwannagothere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jordi Villar
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-23 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -43,7 +43,10 @@ extra_rdoc_files:
|
|
43
43
|
- README.rdoc
|
44
44
|
files:
|
45
45
|
- README.md
|
46
|
+
- README.rdoc
|
47
|
+
- Rakefile
|
46
48
|
- examples/all_methods.rb
|
49
|
+
- iwannagothere.gemspec
|
47
50
|
- lib/core_ext/string.rb
|
48
51
|
- lib/iwannagothere.rb
|
49
52
|
- lib/iwannagothere/client.rb
|
@@ -54,7 +57,6 @@ files:
|
|
54
57
|
- lib/iwannagothere/place.rb
|
55
58
|
- lib/iwannagothere/urls.rb
|
56
59
|
- lib/iwannagothere/user.rb
|
57
|
-
- README.rdoc
|
58
60
|
has_rdoc: true
|
59
61
|
homepage: https://github.com/jrd/iwannagothere
|
60
62
|
licenses: []
|