google_places 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,6 +1,6 @@
1
+ .DS_Store
1
2
  *.gem
2
3
  .bundle
3
- Gemfile.lock
4
4
  pkg/*
5
5
  .rvmrc
6
6
  .rspec
@@ -0,0 +1,32 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ google_places (0.0.3)
5
+ httparty
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ crack (0.1.8)
11
+ diff-lcs (1.1.2)
12
+ fakeweb (1.3.0)
13
+ httparty (0.7.7)
14
+ crack (= 0.1.8)
15
+ rspec (2.6.0)
16
+ rspec-core (~> 2.6.0)
17
+ rspec-expectations (~> 2.6.0)
18
+ rspec-mocks (~> 2.6.0)
19
+ rspec-core (2.6.0)
20
+ rspec-expectations (2.6.0)
21
+ diff-lcs (~> 1.1.2)
22
+ rspec-mocks (2.6.0)
23
+ vcr (1.9.0)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ fakeweb
30
+ google_places!
31
+ rspec
32
+ vcr
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "google_places"
6
- s.version = '0.0.3'
6
+ s.version = '0.0.4'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Marcel de Graaf"]
9
9
  s.email = ["mail@marceldegraaf.net"]
@@ -1,17 +1,19 @@
1
1
  module GooglePlaces
2
2
  class Client
3
3
  attr_reader :api_key
4
+ attr_reader :options
4
5
 
5
- def initialize(api_key)
6
+ def initialize(api_key, options = {})
6
7
  @api_key = api_key
8
+ @options = options
7
9
  end
8
10
 
9
11
  def spots(lat, lng, options = {})
10
- Spot.list(lat, lng, @api_key, options)
12
+ Spot.list(lat, lng, @api_key, @options.merge(options))
11
13
  end
12
14
 
13
15
  def spot(reference, options = {})
14
- Spot.find(reference, @api_key, options)
16
+ Spot.find(reference, @api_key, @options.merge(options))
15
17
  end
16
18
  end
17
19
  end
@@ -9,11 +9,13 @@ module GooglePlaces
9
9
  SPOT_URL = 'https://maps.googleapis.com/maps/api/place/details/json'
10
10
 
11
11
  def self.spots(options = {})
12
+ # pp options
12
13
  request = new(SPOTS_LIST_URL, options)
13
14
  request.parsed_response
14
15
  end
15
16
 
16
17
  def self.spot(options = {})
18
+ # pp options
17
19
  request = new(SPOT_URL, options)
18
20
  request.parsed_response
19
21
  end
@@ -1,12 +1,14 @@
1
1
  module GooglePlaces
2
2
  class Spot
3
- attr_accessor :lat, :lng, :name, :icon, :reference, :vicinity, :types, :id, :formatted_phone_number, :formatted_address, :address_components, :rating, :url
3
+ attr_accessor :lat, :lng, :name, :icon, :reference, :vicinity, :types, :id, :formatted_phone_number, :formatted_address, :address_components, :rating, :url, :cid
4
4
 
5
5
  def self.list(lat, lng, api_key, options = {})
6
6
  radius = options.delete(:radius) || 200
7
7
  sensor = options.delete(:sensor) || false
8
8
  types = options.delete(:types)
9
9
  name = options.delete(:name)
10
+ keyword = options.delete(:keyword)
11
+ language = options.delete(:language)
10
12
  location = Location.new(lat, lng)
11
13
  exclude = options.delete(:exclude) || []
12
14
 
@@ -17,7 +19,9 @@ module GooglePlaces
17
19
  :radius => radius,
18
20
  :sensor => sensor,
19
21
  :key => api_key,
20
- :name => name
22
+ :name => name,
23
+ :language => language,
24
+ :keyword => keyword
21
25
  }
22
26
 
23
27
  # Accept Types as a string or array
@@ -34,11 +38,13 @@ module GooglePlaces
34
38
 
35
39
  def self.find(reference, api_key, options = {})
36
40
  sensor = options.delete(:sensor) || false
41
+ language = options.delete(:language)
37
42
 
38
43
  response = Request.spot(
39
44
  :reference => reference,
40
45
  :sensor => sensor,
41
- :key => api_key
46
+ :key => api_key,
47
+ :language => language
42
48
  )
43
49
 
44
50
  self.new(response['result'])
@@ -58,6 +64,7 @@ module GooglePlaces
58
64
  @address_components = json_result_object['address_components']
59
65
  @rating = json_result_object['rating']
60
66
  @url = json_result_object['url']
67
+ @cid = json_result_object['url'].to_i
61
68
  end
62
69
 
63
70
  end
@@ -44,7 +44,7 @@ describe GooglePlaces::Spot do
44
44
 
45
45
  it 'should have Spots with specific types' do
46
46
  @collection.each do |spot|
47
- spot.types.should include('food','establishment')
47
+ spot.types.should include('establishment')
48
48
  end
49
49
  end
50
50
  end
@@ -88,7 +88,7 @@ describe GooglePlaces::Spot do
88
88
 
89
89
  it 'should have Spots with specific types' do
90
90
  @collection.each do |spot|
91
- spot.types.should include('food','establishment')
91
+ spot.types.should include('establishment')
92
92
  end
93
93
  end
94
94
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_places
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marcel de Graaf
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-21 00:00:00 +02:00
19
- default_executable:
18
+ date: 2011-12-05 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: httparty
@@ -86,6 +85,7 @@ extra_rdoc_files: []
86
85
  files:
87
86
  - .gitignore
88
87
  - Gemfile
88
+ - Gemfile.lock
89
89
  - README.rdoc
90
90
  - Rakefile
91
91
  - google_places.gemspec
@@ -101,7 +101,6 @@ files:
101
101
  - spec/google_places/spot_spec.rb
102
102
  - spec/spec_helper.rb
103
103
  - spec/vcr_setup.rb
104
- has_rdoc: true
105
104
  homepage: https://github.com/marceldegraaf/google_places
106
105
  licenses: []
107
106
 
@@ -131,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
130
  requirements: []
132
131
 
133
132
  rubyforge_project:
134
- rubygems_version: 1.5.0
133
+ rubygems_version: 1.8.6
135
134
  signing_key:
136
135
  specification_version: 3
137
136
  summary: A Ruby wrapper around the Google Places API.