places 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +50 -0
- data/Rakefile +7 -0
- data/lib/places.rb +23 -0
- data/lib/places/client.rb +96 -0
- data/lib/places/version.rb +3 -0
- data/places.gemspec +29 -0
- data/spec/places/client_spec.rb +67 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/vcr_cassettes/add.yml +32 -0
- data/spec/vcr_cassettes/checkin.yml +28 -0
- data/spec/vcr_cassettes/delete.yml +28 -0
- data/spec/vcr_cassettes/details.yml +76 -0
- data/spec/vcr_cassettes/search.yml +47 -0
- data/spec/vcr_setup.rb +8 -0
- metadata +173 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Google Places
|
2
|
+
|
3
|
+
Ruby wrapper for the [Google Places API](http://code.google.com/apis/maps/documentation/places/).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Inside your Gemfile:
|
8
|
+
gem 'places'
|
9
|
+
|
10
|
+
## Get Google Places API credentials
|
11
|
+
|
12
|
+
Go here and activate it: [https://code.google.com/apis/console](https://code.google.com/apis/console)
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
### Instantiate a client
|
17
|
+
|
18
|
+
>> @client = Places::Client.new(:api_key => 'your_api_key')
|
19
|
+
|
20
|
+
## Examples
|
21
|
+
|
22
|
+
#### Search for a place
|
23
|
+
|
24
|
+
>> @search = @client.search(:lat => 32.8481659, :lng => -97.1952847, :types => "food", :name => "roots")
|
25
|
+
>> @search.results.first.name
|
26
|
+
=> 'Roots Coffeehouse'
|
27
|
+
|
28
|
+
#### Get details for a place
|
29
|
+
|
30
|
+
>> @detail = @client.details(:reference => "CnRpAAAAjVikwLlaJ2WN8i0cPwu3A0zcE9iCSMDihmbn_bkXYkM-7xtRcn-ZAmrQtWAAzxQPYxZmyaCeNIMQ_t_eWNDp1CmviA-iY-M63UjpUywQeR5B1dmZ2_Ne756bAjp2uYXTxobVtLKeWkVmGz2dFUMacRIQ6MbrsRQfx1fIbMf4s-s6RhoU-5Uxc26iNf80jxRypRlMJl_k6Gg")
|
31
|
+
>> @detail.result.name
|
32
|
+
>> 'Roots Coffeehouse'
|
33
|
+
|
34
|
+
#### Check-in to a place
|
35
|
+
|
36
|
+
>> @checkin = @client.checkin(:reference => "CnRpAAAAjVikwLlaJ2WN8i0cPwu3A0zcE9iCSMDihmbn_bkXYkM-7xtRcn-ZAmrQtWAAzxQPYxZmyaCeNIMQ_t_eWNDp1CmviA-iY-M63UjpUywQeR5B1dmZ2_Ne756bAjp2uYXTxobVtLKeWkVmGz2dFUMacRIQ6MbrsRQfx1fIbMf4s-s6RhoU-5Uxc26iNf80jxRypRlMJl_k6Gg")
|
37
|
+
|
38
|
+
#### Add a new place
|
39
|
+
|
40
|
+
>> @add = @client.add(:lat => -33.8669710, :lng => 151.1958750, :accuracy => 50, :name => "Google Shoes!", :types => "shoe_store")
|
41
|
+
|
42
|
+
#### Delete a place
|
43
|
+
|
44
|
+
>> @delete = @client.delete(:reference => "CkQxAAAAgoh_Zw4jcE_9-B1b56AgriFZKVdpgc5yYXtwRAPjs-aWIxgUi6Wl-Qe-DdDP5m7PUCzy9iOqWWmdx4sU53035RIQqqNIGGPevJaTM9l1Xh9hpRoUWxhdGBS0XppFiJhZMXX_jiuDsdY")
|
45
|
+
|
46
|
+
## Copyright
|
47
|
+
|
48
|
+
Contact me if you have any suggestions and feel free to fork it!
|
49
|
+
|
50
|
+
Copyright (c) 2009 Johnny Khai Nguyen, released under the MIT license
|
data/Rakefile
ADDED
data/lib/places.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'httparty'
|
3
|
+
require 'hashie'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
directory = File.expand_path(File.dirname(__FILE__))
|
7
|
+
|
8
|
+
Hash.send :include, Hashie::HashExtensions
|
9
|
+
|
10
|
+
module Places
|
11
|
+
|
12
|
+
def self.configure
|
13
|
+
yield self
|
14
|
+
true
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
attr_accessor :api_key
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
require File.join(directory, 'places', 'client')
|
@@ -0,0 +1,96 @@
|
|
1
|
+
module Places
|
2
|
+
|
3
|
+
class Client
|
4
|
+
include HTTParty
|
5
|
+
base_uri "https://maps.googleapis.com/maps/api/place"
|
6
|
+
|
7
|
+
attr_reader :api_key
|
8
|
+
|
9
|
+
def initialize(options={})
|
10
|
+
@api_key = options[:api_key] || GooglePlaces.api_key
|
11
|
+
end
|
12
|
+
|
13
|
+
def search(options={})
|
14
|
+
radius = options.delete(:radius) || 500
|
15
|
+
sensor = options.delete(:sensor) || false
|
16
|
+
types = options.delete(:types)
|
17
|
+
name = options.delete(:name)
|
18
|
+
lat = options.delete(:lat)
|
19
|
+
lng = options.delete(:lng)
|
20
|
+
location = [lat,lng].join(',')
|
21
|
+
|
22
|
+
options = {
|
23
|
+
:location => location,
|
24
|
+
:radius => radius,
|
25
|
+
:sensor => sensor,
|
26
|
+
:name => name
|
27
|
+
}
|
28
|
+
|
29
|
+
if types
|
30
|
+
types = (types.is_a?(Array) ? types.join('|') : types)
|
31
|
+
options.merge!(:types => types)
|
32
|
+
end
|
33
|
+
|
34
|
+
mashup(self.class.get("/search/json", :query => options.merge(self.default_options)))
|
35
|
+
end
|
36
|
+
|
37
|
+
def details(options={})
|
38
|
+
sensor = options.delete(:sensor) || false
|
39
|
+
reference = options.delete(:reference)
|
40
|
+
options = {:reference => reference, :sensor => sensor}
|
41
|
+
mashup(self.class.get("/details/json", :query => options.merge(self.default_options)))
|
42
|
+
end
|
43
|
+
|
44
|
+
def checkin(options={})
|
45
|
+
sensor = options.delete(:sensor) || false
|
46
|
+
reference = options.delete(:reference)
|
47
|
+
mashup(self.class.post("/check-in/json?sensor=#{sensor}&key=#{@api_key}", :body => {:reference => reference}.to_json))
|
48
|
+
end
|
49
|
+
|
50
|
+
def add(options={})
|
51
|
+
sensor = options.delete(:sensor) || false
|
52
|
+
accuracy = options.delete(:accuracy)
|
53
|
+
types = options.delete(:types)
|
54
|
+
name = options.delete(:name)
|
55
|
+
lat = options.delete(:lat)
|
56
|
+
lng = options.delete(:lng)
|
57
|
+
|
58
|
+
options = {
|
59
|
+
:location => {:lat => lat, :lng => lng},
|
60
|
+
:name => name,
|
61
|
+
:accuracy => accuracy,
|
62
|
+
:types => [types]
|
63
|
+
}
|
64
|
+
|
65
|
+
mashup(self.class.post("/add/json?sensor=#{sensor}&key=#{@api_key}", :body => options.to_json))
|
66
|
+
end
|
67
|
+
|
68
|
+
def delete(options={})
|
69
|
+
sensor = options.delete(:sensor) || false
|
70
|
+
reference = options.delete(:reference)
|
71
|
+
mashup(self.class.post("/delete/json?sensor=#{sensor}&key=#{@api_key}", :body => {:reference => reference}.to_json))
|
72
|
+
end
|
73
|
+
|
74
|
+
protected
|
75
|
+
|
76
|
+
def default_options
|
77
|
+
{ :key => @api_key }
|
78
|
+
end
|
79
|
+
|
80
|
+
def mashup(response)
|
81
|
+
case response.code
|
82
|
+
when 200
|
83
|
+
if response.is_a?(Hash)
|
84
|
+
Hashie::Mash.new(response)
|
85
|
+
else
|
86
|
+
if response.first.is_a?(Hash)
|
87
|
+
response.map{|item| Hashie::Mash.new(item)}
|
88
|
+
else
|
89
|
+
response
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|
data/places.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "places/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "places"
|
7
|
+
s.version = Places::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Johnny Khai Nguyen"]
|
10
|
+
s.email = ["johnnyn@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Ruby wrapper for the Google Places API}
|
13
|
+
s.description = %q{Use this to access the Google Places API in your Ruby application}
|
14
|
+
|
15
|
+
s.rubyforge_project = "places"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency 'httparty'
|
23
|
+
s.add_dependency 'hashie'
|
24
|
+
s.add_dependency 'json'
|
25
|
+
s.add_development_dependency 'rspec'
|
26
|
+
s.add_development_dependency 'webmock'
|
27
|
+
s.add_development_dependency 'vcr'
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Places::Client do
|
4
|
+
|
5
|
+
context 'searching for a place' do
|
6
|
+
use_vcr_cassette 'search'
|
7
|
+
|
8
|
+
it 'should not initialize without an api_key' do
|
9
|
+
lambda { Places::Client.new }.should raise_error
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should initialize with an api_key' do
|
13
|
+
@client = Places::Client.new(:api_key => "foobar")
|
14
|
+
@client.api_key.should == "foobar"
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should request a place search' do
|
18
|
+
@client = Places::Client.new(:api_key => "foobar")
|
19
|
+
@search = @client.search(:lat => 32.8481659, :lng => -97.1952847, :types => "food", :name => "roots")
|
20
|
+
@search.results.size.should == 1
|
21
|
+
@search.results.first.name.should == 'Roots Coffeehouse'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'details for a place' do
|
26
|
+
use_vcr_cassette 'details'
|
27
|
+
|
28
|
+
it "should fetch details of a specific places" do
|
29
|
+
@client = Places::Client.new(:api_key => "foobar")
|
30
|
+
@detail = @client.details(:reference => "CnRpAAAAjVikwLlaJ2WN8i0cPwu3A0zcE9iCSMDihmbn_bkXYkM-7xtRcn-ZAmrQtWAAzxQPYxZmyaCeNIMQ_t_eWNDp1CmviA-iY-M63UjpUywQeR5B1dmZ2_Ne756bAjp2uYXTxobVtLKeWkVmGz2dFUMacRIQ6MbrsRQfx1fIbMf4s-s6RhoU-5Uxc26iNf80jxRypRlMJl_k6Gg")
|
31
|
+
@detail.result.formatted_address.should == "9101 Blvd 26, Suite 101, North Richland Hills, TX 76180, United States"
|
32
|
+
@detail.result.name.should == 'Roots Coffeehouse'
|
33
|
+
@detail.result.id.should == "8e4570eb70ddeea123e33d0c6b584ffe3a967d4e"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'check-in to a place' do
|
38
|
+
use_vcr_cassette 'checkin'
|
39
|
+
|
40
|
+
it "should check-in to a specific place" do
|
41
|
+
@client = Places::Client.new(:api_key => "foobar")
|
42
|
+
@checkin = @client.checkin(:reference => "CnRpAAAAjVikwLlaJ2WN8i0cPwu3A0zcE9iCSMDihmbn_bkXYkM-7xtRcn-ZAmrQtWAAzxQPYxZmyaCeNIMQ_t_eWNDp1CmviA-iY-M63UjpUywQeR5B1dmZ2_Ne756bAjp2uYXTxobVtLKeWkVmGz2dFUMacRIQ6MbrsRQfx1fIbMf4s-s6RhoU-5Uxc26iNf80jxRypRlMJl_k6Gg")
|
43
|
+
@checkin.status.should == "OK"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'adding a place' do
|
48
|
+
use_vcr_cassette 'add'
|
49
|
+
|
50
|
+
it "should add a new place" do
|
51
|
+
@client = Places::Client.new(:api_key => "foobar")
|
52
|
+
@add = @client.add(:lat => -33.8669710, :lng => 151.1958750, :accuracy => 50, :name => "Google Shoes!", :types => "shoe_store")
|
53
|
+
@add.id.should == "a306f93119e8d12eabadb79bd82f0d3e547d0ad2"
|
54
|
+
@add.status.should == "OK"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'deleting a place' do
|
59
|
+
use_vcr_cassette 'delete'
|
60
|
+
|
61
|
+
it "should delete a specific place" do
|
62
|
+
@client = Places::Client.new(:api_key => "foobar")
|
63
|
+
@delete = @client.delete(:reference => "CkQxAAAAgoh_Zw4jcE_9-B1b56AgriFZKVdpgc5yYXtwRAPjs-aWIxgUi6Wl-Qe-DdDP5m7PUCzy9iOqWWmdx4sU53035RIQqqNIGGPevJaTM9l1Xh9hpRoUWxhdGBS0XppFiJhZMXX_jiuDsdY")
|
64
|
+
@delete.status.should == "OK"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: https://maps.googleapis.com:443/maps/api/place/add/json?key=foobar&sensor=false
|
6
|
+
body: "{\"accuracy\":50,\"location\":{\"lat\":-33.866971,\"lng\":151.195875},\"name\":\"Google Shoes!\",\"types\":[\"shoe_store\"]}"
|
7
|
+
headers:
|
8
|
+
response: !ruby/struct:VCR::Response
|
9
|
+
status: !ruby/struct:VCR::ResponseStatus
|
10
|
+
code: 200
|
11
|
+
message: OK
|
12
|
+
headers:
|
13
|
+
content-type:
|
14
|
+
- application/json; charset=UTF-8
|
15
|
+
server:
|
16
|
+
- mafe
|
17
|
+
date:
|
18
|
+
- Sun, 05 Jun 2011 22:38:01 GMT
|
19
|
+
x-xss-protection:
|
20
|
+
- 1; mode=block
|
21
|
+
cache-control:
|
22
|
+
- private
|
23
|
+
vary:
|
24
|
+
- Accept-Language
|
25
|
+
body: |
|
26
|
+
{
|
27
|
+
"id" : "a306f93119e8d12eabadb79bd82f0d3e547d0ad2",
|
28
|
+
"reference" : "CkQxAAAAgoh_Zw4jcE_9-B1b56AgriFZKVdpgc5yYXtwRAPjs-aWIxgUi6Wl-Qe-DdDP5m7PUCzy9iOqWWmdx4sU53035RIQqqNIGGPevJaTM9l1Xh9hpRoUWxhdGBS0XppFiJhZMXX_jiuDsdY",
|
29
|
+
"status" : "OK"
|
30
|
+
}
|
31
|
+
|
32
|
+
http_version: "1.1"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: https://maps.googleapis.com:443/maps/api/place/check-in/json?key=foobar&sensor=false
|
6
|
+
body: "{\"reference\":\"CnRpAAAAjVikwLlaJ2WN8i0cPwu3A0zcE9iCSMDihmbn_bkXYkM-7xtRcn-ZAmrQtWAAzxQPYxZmyaCeNIMQ_t_eWNDp1CmviA-iY-M63UjpUywQeR5B1dmZ2_Ne756bAjp2uYXTxobVtLKeWkVmGz2dFUMacRIQ6MbrsRQfx1fIbMf4s-s6RhoU-5Uxc26iNf80jxRypRlMJl_k6Gg\"}"
|
7
|
+
headers:
|
8
|
+
response: !ruby/struct:VCR::Response
|
9
|
+
status: !ruby/struct:VCR::ResponseStatus
|
10
|
+
code: 200
|
11
|
+
message: OK
|
12
|
+
headers:
|
13
|
+
content-type:
|
14
|
+
- application/json; charset=UTF-8
|
15
|
+
server:
|
16
|
+
- mafe
|
17
|
+
date:
|
18
|
+
- Sun, 05 Jun 2011 18:46:00 GMT
|
19
|
+
x-xss-protection:
|
20
|
+
- 1; mode=block
|
21
|
+
cache-control:
|
22
|
+
- private
|
23
|
+
body: |
|
24
|
+
{
|
25
|
+
"status" : "OK"
|
26
|
+
}
|
27
|
+
|
28
|
+
http_version: "1.1"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: https://maps.googleapis.com:443/maps/api/place/delete/json?key=foobar&sensor=false
|
6
|
+
body: "{\"reference\":\"CkQxAAAAgoh_Zw4jcE_9-B1b56AgriFZKVdpgc5yYXtwRAPjs-aWIxgUi6Wl-Qe-DdDP5m7PUCzy9iOqWWmdx4sU53035RIQqqNIGGPevJaTM9l1Xh9hpRoUWxhdGBS0XppFiJhZMXX_jiuDsdY\"}"
|
7
|
+
headers:
|
8
|
+
response: !ruby/struct:VCR::Response
|
9
|
+
status: !ruby/struct:VCR::ResponseStatus
|
10
|
+
code: 200
|
11
|
+
message: OK
|
12
|
+
headers:
|
13
|
+
content-type:
|
14
|
+
- application/json; charset=UTF-8
|
15
|
+
server:
|
16
|
+
- mafe
|
17
|
+
date:
|
18
|
+
- Sun, 05 Jun 2011 22:41:36 GMT
|
19
|
+
x-xss-protection:
|
20
|
+
- 1; mode=block
|
21
|
+
cache-control:
|
22
|
+
- private
|
23
|
+
body: |
|
24
|
+
{
|
25
|
+
"status" : "OK"
|
26
|
+
}
|
27
|
+
|
28
|
+
http_version: "1.1"
|
@@ -0,0 +1,76 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :get
|
5
|
+
uri: https://maps.googleapis.com:443/maps/api/place/details/json?key=foobar&reference=CnRpAAAAjVikwLlaJ2WN8i0cPwu3A0zcE9iCSMDihmbn_bkXYkM-7xtRcn-ZAmrQtWAAzxQPYxZmyaCeNIMQ_t_eWNDp1CmviA-iY-M63UjpUywQeR5B1dmZ2_Ne756bAjp2uYXTxobVtLKeWkVmGz2dFUMacRIQ6MbrsRQfx1fIbMf4s-s6RhoU-5Uxc26iNf80jxRypRlMJl_k6Gg&sensor=false
|
6
|
+
body:
|
7
|
+
headers:
|
8
|
+
response: !ruby/struct:VCR::Response
|
9
|
+
status: !ruby/struct:VCR::ResponseStatus
|
10
|
+
code: 200
|
11
|
+
message: OK
|
12
|
+
headers:
|
13
|
+
content-type:
|
14
|
+
- application/json; charset=UTF-8
|
15
|
+
server:
|
16
|
+
- mafe
|
17
|
+
date:
|
18
|
+
- Sun, 05 Jun 2011 15:32:44 GMT
|
19
|
+
x-xss-protection:
|
20
|
+
- 1; mode=block
|
21
|
+
cache-control:
|
22
|
+
- private
|
23
|
+
vary:
|
24
|
+
- Accept-Language
|
25
|
+
body: |
|
26
|
+
{
|
27
|
+
"html_attributions" : [],
|
28
|
+
"result" : {
|
29
|
+
"address_components" : [
|
30
|
+
{
|
31
|
+
"long_name" : "9101",
|
32
|
+
"short_name" : "9101",
|
33
|
+
"types" : [ "street_number" ]
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"long_name" : "Blvd 26, Suite 101",
|
37
|
+
"short_name" : "Blvd 26, Suite 101",
|
38
|
+
"types" : [ "route" ]
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"long_name" : "North Richland Hills",
|
42
|
+
"short_name" : "North Richland Hills",
|
43
|
+
"types" : [ "locality", "political" ]
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"long_name" : "TX",
|
47
|
+
"short_name" : "TX",
|
48
|
+
"types" : [ "administrative_area_level_1", "political" ]
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"long_name" : "76180",
|
52
|
+
"short_name" : "76180",
|
53
|
+
"types" : [ "postal_code" ]
|
54
|
+
}
|
55
|
+
],
|
56
|
+
"formatted_address" : "9101 Blvd 26, Suite 101, North Richland Hills, TX 76180, United States",
|
57
|
+
"formatted_phone_number" : "(817) 503-7344",
|
58
|
+
"geometry" : {
|
59
|
+
"location" : {
|
60
|
+
"lat" : 32.8526060,
|
61
|
+
"lng" : -97.19118399999999
|
62
|
+
}
|
63
|
+
},
|
64
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
|
65
|
+
"id" : "8e4570eb70ddeea123e33d0c6b584ffe3a967d4e",
|
66
|
+
"name" : "Roots Coffeehouse",
|
67
|
+
"rating" : 4.60,
|
68
|
+
"reference" : "CnRpAAAA3YgHq1uZnJITbzaknQcij762-bPT_1BUZykuRSh9nCsszGkp_3kUZakJGiM_QKfBLWnvqE_vGR2fjilbxF0x8awlmJWEKDFWMp4ZX7jLWuXOVpqE7u-FwJj9r4tUb7yDZSRDkUSZhji8iMiZr-aJXBIQN2A3BhfTDeN6vBv8nzSyQxoUrnAGcz41OlHk7g3oa4YapsKVBYM",
|
69
|
+
"types" : [ "food", "establishment" ],
|
70
|
+
"url" : "http://maps.google.com/maps/place?cid=12868917690814993239",
|
71
|
+
"vicinity" : "Blvd 26, Suite 101, North Richland Hills"
|
72
|
+
},
|
73
|
+
"status" : "OK"
|
74
|
+
}
|
75
|
+
|
76
|
+
http_version: "1.1"
|
@@ -0,0 +1,47 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :get
|
5
|
+
uri: https://maps.googleapis.com:443/maps/api/place/search/json?key=foobar&location=32.8481659,-97.1952847&name=roots&radius=500&sensor=false&types=food
|
6
|
+
body:
|
7
|
+
headers:
|
8
|
+
response: !ruby/struct:VCR::Response
|
9
|
+
status: !ruby/struct:VCR::ResponseStatus
|
10
|
+
code: 200
|
11
|
+
message: OK
|
12
|
+
headers:
|
13
|
+
content-type:
|
14
|
+
- application/json; charset=UTF-8
|
15
|
+
server:
|
16
|
+
- mafe
|
17
|
+
date:
|
18
|
+
- Sun, 05 Jun 2011 15:19:49 GMT
|
19
|
+
x-xss-protection:
|
20
|
+
- 1; mode=block
|
21
|
+
cache-control:
|
22
|
+
- private
|
23
|
+
vary:
|
24
|
+
- Accept-Language
|
25
|
+
body: |
|
26
|
+
{
|
27
|
+
"html_attributions" : [],
|
28
|
+
"results" : [
|
29
|
+
{
|
30
|
+
"geometry" : {
|
31
|
+
"location" : {
|
32
|
+
"lat" : 32.8526060,
|
33
|
+
"lng" : -97.19118399999999
|
34
|
+
}
|
35
|
+
},
|
36
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
|
37
|
+
"id" : "8e4570eb70ddeea123e33d0c6b584ffe3a967d4e",
|
38
|
+
"name" : "Roots Coffeehouse",
|
39
|
+
"reference" : "CnRoAAAANen2s7DMyGHNyW-MgJokmzmSGP0D7Y-LP5g6KDrI2_P9MOgxq8f50f3U9le53E8YAVbiChe9P-0GFyqn0UMMX6a7wKpgUSwysdiiPpA9jTdygf3gdGYC0W1-C7H2s9j39C7ryP3yFGj-fD2EzDdLZxIQI6G8HpURe4hJKWsxfRsReRoUSO5SZViRU0XOTZ6FMZ1xTB5t02Y",
|
40
|
+
"types" : [ "food", "establishment" ],
|
41
|
+
"vicinity" : "Blvd 26, Suite 101, North Richland Hills"
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"status" : "OK"
|
45
|
+
}
|
46
|
+
|
47
|
+
http_version: "1.1"
|
data/spec/vcr_setup.rb
ADDED
metadata
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: places
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Johnny Khai Nguyen
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-06-05 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: httparty
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: hashie
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: json
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :runtime
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rspec
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
type: :development
|
76
|
+
version_requirements: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: webmock
|
79
|
+
prerelease: false
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
version: "0"
|
89
|
+
type: :development
|
90
|
+
version_requirements: *id005
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: vcr
|
93
|
+
prerelease: false
|
94
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
103
|
+
type: :development
|
104
|
+
version_requirements: *id006
|
105
|
+
description: Use this to access the Google Places API in your Ruby application
|
106
|
+
email:
|
107
|
+
- johnnyn@gmail.com
|
108
|
+
executables: []
|
109
|
+
|
110
|
+
extensions: []
|
111
|
+
|
112
|
+
extra_rdoc_files: []
|
113
|
+
|
114
|
+
files:
|
115
|
+
- .gitignore
|
116
|
+
- Gemfile
|
117
|
+
- README.md
|
118
|
+
- Rakefile
|
119
|
+
- lib/places.rb
|
120
|
+
- lib/places/client.rb
|
121
|
+
- lib/places/version.rb
|
122
|
+
- places.gemspec
|
123
|
+
- spec/places/client_spec.rb
|
124
|
+
- spec/spec_helper.rb
|
125
|
+
- spec/vcr_cassettes/add.yml
|
126
|
+
- spec/vcr_cassettes/checkin.yml
|
127
|
+
- spec/vcr_cassettes/delete.yml
|
128
|
+
- spec/vcr_cassettes/details.yml
|
129
|
+
- spec/vcr_cassettes/search.yml
|
130
|
+
- spec/vcr_setup.rb
|
131
|
+
has_rdoc: true
|
132
|
+
homepage: ""
|
133
|
+
licenses: []
|
134
|
+
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
|
138
|
+
require_paths:
|
139
|
+
- lib
|
140
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
none: false
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
hash: 3
|
146
|
+
segments:
|
147
|
+
- 0
|
148
|
+
version: "0"
|
149
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
+
none: false
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
hash: 3
|
155
|
+
segments:
|
156
|
+
- 0
|
157
|
+
version: "0"
|
158
|
+
requirements: []
|
159
|
+
|
160
|
+
rubyforge_project: places
|
161
|
+
rubygems_version: 1.6.2
|
162
|
+
signing_key:
|
163
|
+
specification_version: 3
|
164
|
+
summary: Ruby wrapper for the Google Places API
|
165
|
+
test_files:
|
166
|
+
- spec/places/client_spec.rb
|
167
|
+
- spec/spec_helper.rb
|
168
|
+
- spec/vcr_cassettes/add.yml
|
169
|
+
- spec/vcr_cassettes/checkin.yml
|
170
|
+
- spec/vcr_cassettes/delete.yml
|
171
|
+
- spec/vcr_cassettes/details.yml
|
172
|
+
- spec/vcr_cassettes/search.yml
|
173
|
+
- spec/vcr_setup.rb
|