google_maps_rails 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf469db968e3dd096eb923c686df7d477b9fe281
4
- data.tar.gz: c094919eecce58fc15a4a3079c70d2dd54519ec5
3
+ metadata.gz: 2ab0ee7a7b2e1c2b546ffa8038dc2ee3c042fc1e
4
+ data.tar.gz: 96f2e1e08d83a9d1b0d5b05b0b815cc6f1d16fa4
5
5
  SHA512:
6
- metadata.gz: c345ecb49b18f520acaeb5bed1ab781b412f6d7e68e147789318d41d190bb8b413f87907876a5d4094d741aed8dae4caafd3ddc17d58e11a0dfa0e901c2d6a22
7
- data.tar.gz: e2c5743538ebe39607de537c69b1302ed8d9c5d6d4df0b03856a0a63427e5037495e57cf6e0bbc9f5f91428664f56c1a52dc8a68d53b58e26e2814f776f0a98a
6
+ metadata.gz: 968201bae93493b52db2dfe5c36a1b4c2fe54761fe942596767a178bd6ef9e46a72979426f812ff974bba07b5b261fa2db003fd66a4cdde29e05a9577e41c192
7
+ data.tar.gz: 794033fdaacfa2cbf8febf416a25520c0c96960858d712bd9cf8db447c847ff475a39fba503c45969e3d3e965e80f508dbcbe489fa1d41bec521c318b58e6b41
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
data/README.md CHANGED
@@ -23,15 +23,22 @@ Or install it yourself as:
23
23
 
24
24
  ## Usage
25
25
 
26
- Add the code in local where you want embed the map. Change params "LONG, LAT, WIDTH, HEIGHT"
26
+ Add the code, and create attributes, in local where you want embed the map.
27
27
 
28
- ```ruby
29
- <%= embed_google_maps(LONG, LAT, WIDTH, HEIGHT) %>
30
- ```
31
- Example (use http://www.latlong.net/)
28
+ | Attribute | Type | Default value |
29
+ | --- | --- | --- |
30
+ | lat | String | nil |
31
+ | lat | String | nil |
32
+ | address | String | nil |
33
+ | width | String | 500 |
34
+ | height | String | 500 |
32
35
 
33
36
  ```ruby
34
- <%= embed_google_maps('-20.262197', '-54.799805', '250', '250') %>
37
+ # Lat and Long
38
+ embed_google_maps(lat: '-20.262197', long: '-54.799805')
39
+
40
+ # Address
41
+ embed_google_maps(address: 'address name and number')
35
42
  ```
36
43
 
37
44
  ## license
@@ -17,8 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_development_dependency 'rails'
21
- spec.add_development_dependency "rspec"
20
+ spec.add_development_dependency 'rails', '~> 0'
21
+ spec.add_development_dependency 'rspec', '~> 0'
22
22
  spec.add_development_dependency "bundler", "~> 1.8"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module GoogleMapsRails
2
- VERSION = "1.0.3"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -1,11 +1,24 @@
1
1
  module GoogleMapsRails
2
2
  module ViewHelpers
3
- def embed_google_maps(lat, long, width = 500, height = 500)
4
- if lat != '' && long != ''
5
- "<iframe src = 'https://maps.google.com/maps?q=#{lat},#{long}&amp;output=embed' frameborder='0' style='border:0' width='#{width}' height='#{height}' allowfullscreen></iframe>"
3
+ def embed_google_maps(options = {})
4
+ width = options[:width] || 500
5
+ height = options[:height] || 500
6
+ lat = options[:lat] || nil
7
+ long = options[:long] || nil
8
+ address = options[:address] || nil
9
+
10
+ if options[:lat] && options[:long]
11
+ "<iframe src='https://maps.google.com/maps?q=#{lat},#{long}&amp;output=embed' frameborder='0' style='border:0' width='#{width}' height='#{height}' allowfullscreen></iframe>"
12
+ elsif options[:address]
13
+ "<iframe src='https://maps.google.com/maps?q=#{prepare_address(address)}&amp;output=embed' frameborder='0' style='border:0' width='#{width}' height='#{height}' allowfullscreen></iframe>"
6
14
  else
7
- "latitude or longitude not found"
15
+ "latitude, longitude or address not found. See documentation"
8
16
  end
9
17
  end
18
+
19
+ def prepare_address(address)
20
+ address.gsub!(',', '%2C')
21
+ address.gsub!(' ', '%20')
22
+ end
10
23
  end
11
24
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_maps_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luiz Picolo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-08 00:00:00.000000000 Z
11
+ date: 2016-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubyforge_project:
108
- rubygems_version: 2.4.8
108
+ rubygems_version: 2.5.1
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: Rails helper for embed Google Maps.