google_api_directions 0.0.1 → 0.0.2

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: 6c2ce4804b03002331d072204d71546393d2dead
4
- data.tar.gz: 12a5fd78c0aa72fe45f04451b027abce3000e318
3
+ metadata.gz: aa2713a83d0592cbad5efae3fc754321a1921d3f
4
+ data.tar.gz: 97d825b53e959ef756da1914f9c0bc2c4ce446d8
5
5
  SHA512:
6
- metadata.gz: 1a13bfc073f3ad2dd05f1e34f873ccfc0e286a7febad5e3a8086fe2af1ed55122bcc2bba52851e49445cc3c0fa97b31dad28b36268513b662d543149ed1cd0a0
7
- data.tar.gz: 7ed64741b2d1135777df6ba3060330c85ebd7ead13c00d5bcb32592987a976b5d341f7000df16c3bbd82fa9d19c12e3edfdf89e93d8a42c2128b53bb6f8e621d
6
+ metadata.gz: 5c88215f5939691ca59999598fccb1065170ccadaae19a2609e22bcf9635c300d84c263ca2a162d9bc74f787522ff2f28d1c66447ef83645f106207e5f542635
7
+ data.tar.gz: b9aeb11de01363c8e96e8be29ab0e6abce268bac163c5e6f70a4a7c8fb22529c3c4ce5acf4d04f7bdb718d5f8a39dfcc0dd71f23dd7c3881d2a7a6848ca25e50
data/README.md CHANGED
@@ -26,7 +26,7 @@ Create a new instance of GoogleDirections.
26
26
  g = GoogleApiDirections::GoogleDirections.new
27
27
 
28
28
  Let's get the directions. The first paramameter is the origin, the second one is the destination
29
- and the third one is the language to be used for the directions and it's optional.
29
+ and the third one is the language to be used for the directions and it's optional ("en" is default).
30
30
  **Watch out couse Exceptions can be thrown here.**
31
31
 
32
32
  result = g.directions("Fittjavägen 1 Norsborg", "Slottsbacken 1 Stockholm", "sv")
@@ -7,9 +7,7 @@ module GoogleApiDirections
7
7
  class GoogleDirections
8
8
  def initialize(apikey = "")
9
9
  @apikey = ""
10
- @apikey = "&key" + apikey unless apikey.empty?
11
-
12
-
10
+ @apikey = "&key=" + apikey unless apikey.empty?
13
11
  @uri = "http://maps.googleapis.com/maps/api/directions/json?origin="
14
12
  @directions = []
15
13
  end
@@ -18,8 +16,8 @@ module GoogleApiDirections
18
16
  raise ArgumentError, "Argument(s) are missing or are empty" if origin.strip.empty? || destination.strip.empty?
19
17
 
20
18
  @directions.clear unless @directions.empty?
19
+ set_uri(origin, destination, language)
21
20
 
22
- @uri = @uri + URI::encode(origin) + "&destination=" + URI::encode(destination) + "&language=" + language + "&sensor=false" + @apikey
23
21
  begin
24
22
  resp = Net::HTTP.get_response(URI.parse(@uri))
25
23
  data = resp.body
@@ -43,6 +41,9 @@ module GoogleApiDirections
43
41
  text.gsub(%r{</?[^>]+?>}, " ")
44
42
  end
45
43
 
44
+ def set_uri(origin, destination, language)
45
+ @uri = @uri + URI::encode(origin) + "&destination=" + URI::encode(destination) + "&language=" + language + "&sensor=false" + @apikey
46
+ end
46
47
  end
47
48
 
48
49
  end
@@ -1,3 +1,3 @@
1
1
  module GoogleApiDirections
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_api_directions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jone Samra