gmaps4rails 1.5.8 → 2.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +12 -0
- data/.travis.yml +9 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +149 -0
- data/Guardfile.old +24 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +129 -0
- data/Rakefile +4 -0
- data/app/views/gmaps4rails/_gmaps4rails.html.erb +20 -0
- data/gmaps4rails.gemspec +38 -0
- data/lib/generators/gmaps4rails/install_generator.rb +43 -0
- data/lib/generators/templates/README +2 -0
- data/lib/gmaps4rails.rb +26 -0
- data/lib/gmaps4rails/acts_as_gmappable.rb +54 -0
- data/lib/gmaps4rails/api_wrappers/base_net_methods.rb +40 -0
- data/lib/gmaps4rails/api_wrappers/direction.rb +87 -0
- data/lib/gmaps4rails/api_wrappers/geocoder.rb +54 -0
- data/lib/gmaps4rails/api_wrappers/places.rb +74 -0
- data/lib/gmaps4rails/base.rb +126 -0
- data/lib/gmaps4rails/extensions/enumerable.rb +14 -0
- data/lib/gmaps4rails/extensions/hash.rb +9 -0
- data/lib/gmaps4rails/helper/gmaps4rails_helper.rb +33 -0
- data/lib/gmaps4rails/js_builder.rb +154 -0
- data/lib/gmaps4rails/json_builder.rb +140 -0
- data/lib/gmaps4rails/model_handler.rb +101 -0
- data/lib/gmaps4rails/version.rb +3 -0
- data/lib/gmaps4rails/view_helper.rb +172 -0
- data/lib/tasks/jasmine.rake +8 -0
- data/public/javascripts/gmaps4rails/all.js +2144 -0
- data/public/javascripts/gmaps4rails/base.js +792 -0
- data/public/javascripts/gmaps4rails/google.js +556 -0
- data/public/javascripts/gmaps4rails/openlayers.js +377 -0
- data/public/stylesheets/gmaps4rails.css +24 -0
- data/spec/dummy/.gitignore +3 -0
- data/spec/dummy/.rspec +1 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +18 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/assets/stylesheets/gmaps4rails.css +24 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/users_controller.rb +105 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/place.rb +16 -0
- data/spec/dummy/app/models/user.rb +12 -0
- data/spec/dummy/app/views/layouts/application.html.erb +17 -0
- data/spec/dummy/app/views/users/_form.html.erb +37 -0
- data/spec/dummy/app/views/users/edit.html.erb +6 -0
- data/spec/dummy/app/views/users/index.html.erb +268 -0
- data/spec/dummy/app/views/users/new.html.erb +5 -0
- data/spec/dummy/app/views/users/show.html.erb +30 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +62 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/gmaps4rails.rb +1 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +60 -0
- data/spec/dummy/db/migrate/20120408170155_create_users.rb +16 -0
- data/spec/dummy/db/schema.rb +29 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/javascripts/Player.js +22 -0
- data/spec/dummy/public/javascripts/Song.js +7 -0
- data/spec/dummy/public/logo.png +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/place_factory.rb +16 -0
- data/spec/factories/user_factory.rb +23 -0
- data/spec/fixtures/google_direction_valid.json +65 -0
- data/spec/fixtures/google_geocoding_toulon_france.json +58 -0
- data/spec/fixtures/google_places_valid.json +45 -0
- data/spec/fixtures/google_wrong_geocoding.json +4 -0
- data/spec/launchers/all_but_requests.rb +0 -0
- data/spec/launchers/all_specs.rb +0 -0
- data/spec/launchers/requests.rb +0 -0
- data/spec/lib/base_spec.rb +59 -0
- data/spec/lib/direction_spec.rb +53 -0
- data/spec/lib/geocoder_spec.rb +46 -0
- data/spec/lib/js_builder_spec.rb +134 -0
- data/spec/lib/json_builder_spec.rb +232 -0
- data/spec/lib/places_spec.rb +25 -0
- data/spec/models/place_spec.rb +39 -0
- data/spec/models/user_spec.rb +187 -0
- data/spec/spec_helper.rb +38 -0
- data/spec/support/geocoding.rb +40 -0
- data/spec/support/matchers.rb +73 -0
- data/todo +0 -0
- data/vendor/assets/javascripts/gmaps4rails/all.js +1 -0
- data/vendor/assets/javascripts/gmaps4rails/base.coffee +1 -0
- data/vendor/assets/javascripts/gmaps4rails/base/common.coffee +43 -0
- data/vendor/assets/javascripts/gmaps4rails/base/configuration.coffee +7 -0
- data/vendor/assets/javascripts/gmaps4rails/base/gmaps.coffee +13 -0
- data/vendor/assets/javascripts/gmaps4rails/base/interfaces/basic_interface.coffee +15 -0
- data/vendor/assets/javascripts/gmaps4rails/base/interfaces/controller_interface.coffee +15 -0
- data/vendor/assets/javascripts/gmaps4rails/base/interfaces/map_interface.coffee +27 -0
- data/vendor/assets/javascripts/gmaps4rails/base/interfaces/marker_interface.coffee +15 -0
- data/vendor/assets/javascripts/gmaps4rails/base/main.coffee +124 -0
- data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/circle_controller.coffee +29 -0
- data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/kml_controller.coffee +5 -0
- data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/marker_controller.coffee +76 -0
- data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/polygon_controller.coffee +29 -0
- data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/polyline_controller.coffee +29 -0
- data/vendor/assets/javascripts/gmaps4rails/base/objects/circle.coffee +12 -0
- data/vendor/assets/javascripts/gmaps4rails/base/objects/kml.coffee +8 -0
- data/vendor/assets/javascripts/gmaps4rails/base/objects/map.coffee +62 -0
- data/vendor/assets/javascripts/gmaps4rails/base/objects/marker.coffee +24 -0
- data/vendor/assets/javascripts/gmaps4rails/base/objects/polygon.coffee +11 -0
- data/vendor/assets/javascripts/gmaps4rails/base/objects/polyline.coffee +11 -0
- data/vendor/assets/javascripts/gmaps4rails/bing.coffee +1 -0
- data/vendor/assets/javascripts/gmaps4rails/bing/main.coffee +29 -0
- data/vendor/assets/javascripts/gmaps4rails/bing/objects/map.coffee +63 -0
- data/vendor/assets/javascripts/gmaps4rails/bing/objects/marker.coffee +78 -0
- data/vendor/assets/javascripts/gmaps4rails/bing/shared.coffee +20 -0
- data/vendor/assets/javascripts/gmaps4rails/google.coffee +1 -0
- data/vendor/assets/javascripts/gmaps4rails/google/main.coffee +47 -0
- data/vendor/assets/javascripts/gmaps4rails/google/objects/circle.coffee +38 -0
- data/vendor/assets/javascripts/gmaps4rails/google/objects/kml.coffee +16 -0
- data/vendor/assets/javascripts/gmaps4rails/google/objects/map.coffee +71 -0
- data/vendor/assets/javascripts/gmaps4rails/google/objects/marker.coffee +114 -0
- data/vendor/assets/javascripts/gmaps4rails/google/objects/polygon.coffee +38 -0
- data/vendor/assets/javascripts/gmaps4rails/google/objects/polyline.coffee +49 -0
- data/vendor/assets/javascripts/gmaps4rails/google/shared.coffee +27 -0
- data/vendor/assets/javascripts/gmaps4rails/openlayers.coffee +1 -0
- data/vendor/assets/javascripts/gmaps4rails/openlayers/main.coffee +138 -0
- data/vendor/assets/javascripts/gmaps4rails/openlayers/objects/map.coffee +49 -0
- data/vendor/assets/javascripts/gmaps4rails/openlayers/objects/marker.coffee +68 -0
- data/vendor/assets/javascripts/gmaps4rails/openlayers/objects/polyline.coffee +39 -0
- data/vendor/assets/javascripts/gmaps4rails/openlayers/shared.coffee +19 -0
- metadata +378 -14
- checksums.yaml +0 -7
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended to check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(:version => 20120408170155) do
|
15
|
+
|
16
|
+
create_table "users", :force => true do |t|
|
17
|
+
t.string "name"
|
18
|
+
t.string "address"
|
19
|
+
t.string "norm_address"
|
20
|
+
t.string "sec_address"
|
21
|
+
t.string "picture"
|
22
|
+
t.float "latitude"
|
23
|
+
t.float "longitude"
|
24
|
+
t.boolean "gmaps"
|
25
|
+
t.datetime "created_at", :null => false
|
26
|
+
t.datetime "updated_at", :null => false
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
function Player() {
|
2
|
+
}
|
3
|
+
Player.prototype.play = function(song) {
|
4
|
+
this.currentlyPlayingSong = song;
|
5
|
+
this.isPlaying = true;
|
6
|
+
};
|
7
|
+
|
8
|
+
Player.prototype.pause = function() {
|
9
|
+
this.isPlaying = false;
|
10
|
+
};
|
11
|
+
|
12
|
+
Player.prototype.resume = function() {
|
13
|
+
if (this.isPlaying) {
|
14
|
+
throw new Error("song is already playing");
|
15
|
+
}
|
16
|
+
|
17
|
+
this.isPlaying = true;
|
18
|
+
};
|
19
|
+
|
20
|
+
Player.prototype.makeFavorite = function() {
|
21
|
+
this.currentlyPlayingSong.persistFavoriteStatus(true);
|
22
|
+
};
|
Binary file
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :user do
|
3
|
+
|
4
|
+
trait :paris do
|
5
|
+
address "Paris, France"
|
6
|
+
end
|
7
|
+
|
8
|
+
trait :with_pic do
|
9
|
+
picture "http://www.blankdots.com/img/github-32x32.png"
|
10
|
+
end
|
11
|
+
|
12
|
+
trait :invalid do
|
13
|
+
address "home"
|
14
|
+
end
|
15
|
+
|
16
|
+
name "Guinea Pig"
|
17
|
+
address "Toulon, France"
|
18
|
+
|
19
|
+
factory :user_paris, :traits => [:paris]
|
20
|
+
factory :user_with_pic, :traits => [:with_pic]
|
21
|
+
factory :invalid_user, :traits => [:invalid]
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
{
|
2
|
+
"status": "OK",
|
3
|
+
"routes": [ {
|
4
|
+
"summary": "I-40 W",
|
5
|
+
"legs": [ {
|
6
|
+
"steps": [ {
|
7
|
+
"travel_mode": "DRIVING",
|
8
|
+
"start_location": {
|
9
|
+
"lat": 41.8507300,
|
10
|
+
"lng": -87.6512600
|
11
|
+
},
|
12
|
+
"end_location": {
|
13
|
+
"lat": 41.8525800,
|
14
|
+
"lng": -87.6514100
|
15
|
+
},
|
16
|
+
"polyline": {
|
17
|
+
"points": "a~l~Fjk~uOwHJy@P"
|
18
|
+
},
|
19
|
+
"duration": {
|
20
|
+
"value": 19,
|
21
|
+
"text": "1 min"
|
22
|
+
},
|
23
|
+
"html_instructions": "Head \u003cb\u003enorth\u003c/b\u003e on \u003cb\u003eS Morgan St\u003c/b\u003e toward \u003cb\u003eW Cermak Rd\u003c/b\u003e",
|
24
|
+
"distance": {
|
25
|
+
"value": 207,
|
26
|
+
"text": "0.1 mi"
|
27
|
+
}
|
28
|
+
}],
|
29
|
+
"duration": {
|
30
|
+
"value": 74384,
|
31
|
+
"text": "20 hours 40 mins"
|
32
|
+
},
|
33
|
+
"distance": {
|
34
|
+
"value": 2137146,
|
35
|
+
"text": "1,328 mi"
|
36
|
+
},
|
37
|
+
"start_location": {
|
38
|
+
"lat": 35.4675602,
|
39
|
+
"lng": -97.5164276
|
40
|
+
},
|
41
|
+
"end_location": {
|
42
|
+
"lat": 34.0522342,
|
43
|
+
"lng": -118.2436849
|
44
|
+
},
|
45
|
+
"start_address": "Oklahoma City, OK, USA",
|
46
|
+
"end_address": "Los Angeles, CA, USA"
|
47
|
+
} ],
|
48
|
+
"copyrights": "Map data ©2010 Google, Sanborn",
|
49
|
+
"overview_polyline": {
|
50
|
+
"points": "a~l~Fjk~uOnzh@vlbBtc~@tsE`vnApw{A`dw@~w\\|tNtqf@l{Yd_Fblh@rxo@b}@xxSfytAblk@xxaBeJxlcBb~t@zbh@jc|Bx}C`rv@rw|@rlhA~dVzeo@vrSnc}Axf]fjz@xfFbw~@dz{A~d{A|zOxbrBbdUvpo@`cFp~xBc`Hk@nurDznmFfwMbwz@bbl@lq~@loPpxq@bw_@v|{CbtY~jGqeMb{iF|n\\~mbDzeVh_Wr|Efc\\x`Ij{kE}mAb~uF{cNd}xBjp]fulBiwJpgg@|kHntyArpb@bijCk_Kv~eGyqTj_|@`uV`k|DcsNdwxAott@r}q@_gc@nu`CnvHx`k@dse@j|p@zpiAp|gEicy@`omFvaErfo@igQxnlApqGze~AsyRzrjAb__@ftyB}pIlo_BflmA~yQftNboWzoAlzp@mz`@|}_@fda@jakEitAn{fB_a]lexClshBtmqAdmY_hLxiZd~XtaBndgC"
|
51
|
+
},
|
52
|
+
"warnings": [ ],
|
53
|
+
"waypoint_order": [ 0, 1 ],
|
54
|
+
"bounds": {
|
55
|
+
"southwest": {
|
56
|
+
"lat": 34.0523600,
|
57
|
+
"lng": -118.2435600
|
58
|
+
},
|
59
|
+
"northeast": {
|
60
|
+
"lat": 41.8781100,
|
61
|
+
"lng": -87.6297900
|
62
|
+
}
|
63
|
+
}
|
64
|
+
} ]
|
65
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
{
|
2
|
+
"results" : [
|
3
|
+
{
|
4
|
+
"address_components" : [
|
5
|
+
{
|
6
|
+
"long_name" : "Toulon",
|
7
|
+
"short_name" : "Toulon",
|
8
|
+
"types" : [ "locality", "political" ]
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"long_name" : "Département Var",
|
12
|
+
"short_name" : "83",
|
13
|
+
"types" : [ "administrative_area_level_2", "political" ]
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"long_name" : "Provence-Alpes-Côte d'Azur",
|
17
|
+
"short_name" : "PACA",
|
18
|
+
"types" : [ "administrative_area_level_1", "political" ]
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"long_name" : "France",
|
22
|
+
"short_name" : "FR",
|
23
|
+
"types" : [ "country", "political" ]
|
24
|
+
}
|
25
|
+
],
|
26
|
+
"formatted_address" : "Toulon, France",
|
27
|
+
"geometry" : {
|
28
|
+
"bounds" : {
|
29
|
+
"northeast" : {
|
30
|
+
"lat" : 43.1716730,
|
31
|
+
"lng" : 5.987382999999999
|
32
|
+
},
|
33
|
+
"southwest" : {
|
34
|
+
"lat" : 43.1010490,
|
35
|
+
"lng" : 5.8794790
|
36
|
+
}
|
37
|
+
},
|
38
|
+
"location" : {
|
39
|
+
"lat" : 43.1242280,
|
40
|
+
"lng" : 5.9280
|
41
|
+
},
|
42
|
+
"location_type" : "APPROXIMATE",
|
43
|
+
"viewport" : {
|
44
|
+
"northeast" : {
|
45
|
+
"lat" : 43.1567950,
|
46
|
+
"lng" : 5.99202970
|
47
|
+
},
|
48
|
+
"southwest" : {
|
49
|
+
"lat" : 43.09164370,
|
50
|
+
"lng" : 5.86397030
|
51
|
+
}
|
52
|
+
}
|
53
|
+
},
|
54
|
+
"types" : [ "locality", "political" ]
|
55
|
+
}
|
56
|
+
],
|
57
|
+
"status" : "OK"
|
58
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
{
|
2
|
+
"html_attributions" : [
|
3
|
+
"Listings by \u003ca href=\"http://www.yellowpages.com.au/\"\u003eYellow Pages\u003c/a\u003e"
|
4
|
+
],
|
5
|
+
"results" : [
|
6
|
+
{
|
7
|
+
"geometry" : {
|
8
|
+
"location" : {
|
9
|
+
"lat" : -33.8719830,
|
10
|
+
"lng" : 151.1990860
|
11
|
+
}
|
12
|
+
},
|
13
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
14
|
+
"id" : "677679492a58049a7eae079e0890897eb953d79b",
|
15
|
+
"name" : "Zaaffran Restaurant - BBQ and GRILL, Darling Harbour",
|
16
|
+
"rating" : 3.90,
|
17
|
+
"reference" : "CpQBjAAAAHDHuimUQATR6gfoWNmZlk5dKUKq_n46BpSzPQCjk1m9glTKkiAHH_Gs4xGttdOSj35WJJDAV90dAPnNnZK2OaxMgogdeHKQhIedh6UduFrW53wtwXigUfpAzsCgIzYNI0UQtCj38cr_DE56RH4Wi9d2bWbbIuRyDX6tx2Fmk2EQzO_lVJ-oq4ZY5uI6I75RnxIQJ6smWUVVIHup9Jvc517DKhoUidfNPyQZZIgGiXS_SwGQ1wg0gtc",
|
18
|
+
"types" : [ "restaurant", "food", "establishment" ],
|
19
|
+
"vicinity" : "Harbourside Centre 10 Darling Drive, Darling Harbour, Sydney"
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"geometry" : {
|
23
|
+
"location" : {
|
24
|
+
"lat" : -33.8722580,
|
25
|
+
"lng" : 151.1986550
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
|
29
|
+
"id" : "27ea39c8fed1c0437069066b8dccf958a2d06f19",
|
30
|
+
"name" : "Criniti's Darling Harbour",
|
31
|
+
"rating" : 3.60,
|
32
|
+
"reference" : "CnRwAAAA-5kh5WZ3m1CMTO3LslvhRtAYsrOcQP7wB9AE1bV5R6Bd46NN5wB16MtImXWQ9eS1nWVbV_j-8iXYXRpU13Efp1t_d-Dp4WfEsFcYj-_g6db1SC1vAukyeCyotjS5xrwhzqWWAhgmA4qIliWeev2u1BIQprWzxl_hkj_w3QdTiUBYKxoUDVTjF4RugJdaJWkC4n6w6pSajKw",
|
33
|
+
"types" : [ "restaurant", "food", "establishment" ],
|
34
|
+
"vicinity" : "Shop 461, 2-10 Darling Drive, Harbourside Shopping Centre, DARLING HARBOUR",
|
35
|
+
"events" : [
|
36
|
+
{
|
37
|
+
"event_id" : "7lH_gK1GphU",
|
38
|
+
"summary" : "Google Maps Developer Meetup: Rockin' out with the Places API",
|
39
|
+
"url" : "https://developers.google.com/maps/documentation/places"
|
40
|
+
}
|
41
|
+
]
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"status" : "OK"
|
45
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Geocoding
|
4
|
+
|
5
|
+
set_gmaps4rails_options!
|
6
|
+
|
7
|
+
describe "condition_eval" do
|
8
|
+
|
9
|
+
let(:user) { Factory(:user) }
|
10
|
+
|
11
|
+
before(:each) do
|
12
|
+
Geocoding.stub_geocoding
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should trigger method if symbol passed" do
|
16
|
+
User.class_eval do
|
17
|
+
def gmaps4rails_options
|
18
|
+
DEFAULT_CONFIG_HASH.merge({ :validation => :published? })
|
19
|
+
end
|
20
|
+
|
21
|
+
def published?; true; end
|
22
|
+
end
|
23
|
+
user.should_receive :published?
|
24
|
+
Gmaps4rails.condition_eval(user, user.gmaps4rails_options[:validation])
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should evaluate lambda if provided" do
|
28
|
+
user.instance_eval do
|
29
|
+
def gmaps4rails_options
|
30
|
+
DEFAULT_CONFIG_HASH.merge({ :validation => lambda { |object| object.test_me(:foo, :bar) } })
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_me(a,b)
|
34
|
+
"#{a}, #{b}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
user.should_receive(:test_me).with(:foo, :bar)
|
38
|
+
Gmaps4rails.condition_eval(user, user.gmaps4rails_options[:validation])
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should simply accept a true value" do
|
42
|
+
user.instance_eval do
|
43
|
+
def gmaps4rails_options
|
44
|
+
DEFAULT_CONFIG_HASH.merge({ :validation => true })
|
45
|
+
end
|
46
|
+
end
|
47
|
+
Gmaps4rails.condition_eval(user, user.gmaps4rails_options[:validation]).should be_true
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should simply accept a false value" do
|
51
|
+
user.instance_eval do
|
52
|
+
def gmaps4rails_options
|
53
|
+
DEFAULT_CONFIG_HASH.merge({ :validation => false })
|
54
|
+
end
|
55
|
+
end
|
56
|
+
Gmaps4rails.condition_eval(user, user.gmaps4rails_options[:validation]).should be_false
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|