nokia-here 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +74 -0
- data/Rakefile +2 -0
- data/lib/nokia/here.rb +24 -0
- data/lib/nokia/here/resource/base.rb +52 -0
- data/lib/nokia/here/resource/geocoder.rb +45 -0
- data/lib/nokia/here/resource/routing/base.rb +25 -0
- data/lib/nokia/here/resource/routing/isoline.rb +25 -0
- data/lib/nokia/here/resource/routing/link_info.rb +22 -0
- data/lib/nokia/here/resource/routing/matrix.rb +18 -0
- data/lib/nokia/here/resource/routing/route.rb +30 -0
- data/lib/nokia/here/resource/transit/base.rb +11 -0
- data/lib/nokia/here/resource/transit/isochrone.rb +26 -0
- data/lib/nokia/here/version.rb +5 -0
- data/nokia-here.gemspec +25 -0
- data/spec/geocoder_spec.rb +27 -0
- data/spec/isochrone_spec.rb +16 -0
- data/spec/isoline_spec.rb +34 -0
- data/spec/matrix_spec.rb +20 -0
- data/spec/route_spec.rb +19 -0
- data/spec/spec_helper.rb +17 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: eda42a4b8b52039dea9b2525bbc804da08605b99
|
4
|
+
data.tar.gz: e286b6d26644a1dfd6a0b47c48ee7c4d257f4be6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9e6761824436a6e48aa356e3ec04bfef14fd93a63266d7a843fdc639faae16a2eeaf7afa6425c8c71eceba9586a939d9663f423e976682c83599f183b0562b53
|
7
|
+
data.tar.gz: 37ed21803a94d30f9347d5da29c605d01513953691c0e8277808171df2fd0141d8866302bdbe8983ab2cba5b80abf5196e17c1f7437b794c6797f39a621ba0f8
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
|
24
|
+
spec/app_setup.rb
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 yunwei
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Nokia::Here
|
2
|
+
|
3
|
+
This is a ruby gem for Nokia here map rest api. It is still on a early developing stage. Only Routing APIs are implemented.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'nokia-here'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install nokia-here
|
18
|
+
|
19
|
+
And then require it manually:
|
20
|
+
|
21
|
+
require 'nokia/here'
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
Configuration:
|
25
|
+
```ruby
|
26
|
+
Nokia::Here.app_id = 'YOUR_APP_ID'
|
27
|
+
Nokia::Here.app_code = 'YOUR_APP_CODE'
|
28
|
+
```
|
29
|
+
Resourses and Methods:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# Routing API, not fully tested.
|
33
|
+
Nokia::Here::Resource::Routing::Isoline.get options
|
34
|
+
Nokia::Here::Resource::Routing::LinkInfo.get options
|
35
|
+
Nokia::Here::Resource::Routing::Matrix.get options
|
36
|
+
Nokia::Here::Resource::Routing::Route.calculate_route options
|
37
|
+
Nokia::Here::Resource::Routing::Route.get_route options
|
38
|
+
|
39
|
+
#Transit API, not tested
|
40
|
+
Nokia::Here::Resource::Transit::Isochrone.search options
|
41
|
+
|
42
|
+
#Geocoding API
|
43
|
+
Nokia::Here::Resource::Geocoder.geocde
|
44
|
+
Nokia::Here::Resource::Geocoder.reverse_geocde
|
45
|
+
Nokia::Here::Resource::Geocoder.multi_reverse_geocode
|
46
|
+
|
47
|
+
# Example:
|
48
|
+
options = {
|
49
|
+
mode: 'fastest;car;traffic:enabled',
|
50
|
+
rangetype: 'time',
|
51
|
+
start: 'geo!-37.8089497,144.9731852',
|
52
|
+
range: 600,
|
53
|
+
departure: Time.now.xmlschema
|
54
|
+
}
|
55
|
+
res = Nokia::Here::Resource::Routing::Isoline.get options
|
56
|
+
# => returns JSON formatted string. You might wanna
|
57
|
+
response_hash = JSON.parse(res)
|
58
|
+
```
|
59
|
+
|
60
|
+
For detailed parameters and options please refer to offical nokia here rest api documents
|
61
|
+
|
62
|
+
|
63
|
+
## TODO
|
64
|
+
More tests and API to be added.
|
65
|
+
|
66
|
+
## Contributing
|
67
|
+
|
68
|
+
Welcome to add testing or to implement other resources API.
|
69
|
+
|
70
|
+
1. Fork it ( https://github.com/[my-github-username]/nokia-here/fork )
|
71
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
72
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
73
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
74
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/nokia/here.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require "nokia/here/version"
|
2
|
+
|
3
|
+
module Nokia
|
4
|
+
module Here
|
5
|
+
require 'rest-client'
|
6
|
+
require "nokia/here/resource/base"
|
7
|
+
#routing
|
8
|
+
require "nokia/here/resource/routing/base"
|
9
|
+
require "nokia/here/resource/routing/isoline"
|
10
|
+
require "nokia/here/resource/routing/link_info"
|
11
|
+
require "nokia/here/resource/routing/matrix"
|
12
|
+
require "nokia/here/resource/routing/route"
|
13
|
+
#geocoder
|
14
|
+
require "nokia/here/resource/geocoder"
|
15
|
+
#transit
|
16
|
+
require "nokia/here/resource/transit/base"
|
17
|
+
require 'nokia/here/resource/transit/isochrone'
|
18
|
+
|
19
|
+
class << self
|
20
|
+
attr_accessor :app_id, :app_code, :env
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Nokia
|
2
|
+
module Here
|
3
|
+
module Resource
|
4
|
+
class Base
|
5
|
+
|
6
|
+
BASE_URL = 'https://transit.api.here.com'
|
7
|
+
TEST_URL = 'https://cit.transit.api.here.com'
|
8
|
+
PATH = '/metarouter/rest/routeservice/v2' #default path
|
9
|
+
|
10
|
+
attr_accessor :method_name, :base_url, :test_url, :path
|
11
|
+
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@base_url = BASE_URL
|
15
|
+
@test_url = TEST_URL
|
16
|
+
@path = PATH
|
17
|
+
@method_name = 'getroute' # getroute as default method.
|
18
|
+
end
|
19
|
+
|
20
|
+
def request_url(format: 'json')
|
21
|
+
format ||= 'json'
|
22
|
+
url = Nokia::Here.env == 'test' ? self.test_url : self.base_url
|
23
|
+
url = File.join(url, self.path , "#{self.method_name}.#{format}")
|
24
|
+
puts url
|
25
|
+
url
|
26
|
+
end
|
27
|
+
|
28
|
+
def prepare_the_request(options={})
|
29
|
+
params = options.merge(:app_id=>Nokia::Here.app_id, :app_code => Nokia::Here.app_code)
|
30
|
+
end
|
31
|
+
|
32
|
+
def get(options={})
|
33
|
+
res = RestClient.get(self.request_url(format: options[:format]), params: self.prepare_the_request(options))
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.get(options={})
|
37
|
+
self.new.get(options)
|
38
|
+
end
|
39
|
+
|
40
|
+
# direct call to instance methods as class methods.
|
41
|
+
def self.method_missing(method_sym, *arg, &block)
|
42
|
+
if self.instance_methods.include?(method_sym)
|
43
|
+
self.new.send(method_sym, *arg, &block)
|
44
|
+
else
|
45
|
+
super
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Nokia
|
2
|
+
module Here
|
3
|
+
module Resource
|
4
|
+
class Geocoder < Nokia::Here::Resource::Base
|
5
|
+
|
6
|
+
BASE_URL = 'http://geocoder.api.here.com'
|
7
|
+
TEST_URL = 'http://geocoder.cit.api.here.com'
|
8
|
+
PATH = '/6.2/'
|
9
|
+
|
10
|
+
attr_accessor :method_name, :base_url, :test_url, :path
|
11
|
+
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@base_url = BASE_URL
|
15
|
+
@test_url = TEST_URL
|
16
|
+
@path = PATH
|
17
|
+
@method_name = 'geocode'
|
18
|
+
end
|
19
|
+
|
20
|
+
def geocode(options={})
|
21
|
+
@method_name = 'geocode'
|
22
|
+
get(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def search(options={})
|
26
|
+
@method_name = 'search'
|
27
|
+
get(options)
|
28
|
+
end
|
29
|
+
|
30
|
+
def reverse_geocode(options={})
|
31
|
+
@base_url = 'http://reverse.geocoder.api.here.com'
|
32
|
+
@test_url = 'http://reverse.geocoder.cit.api.here.com'
|
33
|
+
@method_name = 'reversegeocode'
|
34
|
+
get(options)
|
35
|
+
end
|
36
|
+
|
37
|
+
def multi_reverse_geocode(options={})
|
38
|
+
@base_url = 'http://reverse.geocoder.api.here.com'
|
39
|
+
@test_url = 'http://reverse.geocoder.cit.api.here.com'
|
40
|
+
@method_name = 'multi-reversegeocode'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Nokia
|
2
|
+
module Here
|
3
|
+
module Resource
|
4
|
+
module Routing
|
5
|
+
class Base < Nokia::Here::Resource::Base
|
6
|
+
|
7
|
+
BASE_URL = 'http://route.api.here.com'
|
8
|
+
TEST_URL = 'http://route.cit.api.here.com'
|
9
|
+
PATH = '/routing/7.2/'
|
10
|
+
|
11
|
+
attr_accessor :method_name, :base_url, :test_url, :path
|
12
|
+
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@base_url = BASE_URL
|
16
|
+
@test_url = TEST_URL
|
17
|
+
@path = PATH
|
18
|
+
@method_name = 'getroute' # getroute as default method.
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Nokia
|
2
|
+
module Here
|
3
|
+
module Resource
|
4
|
+
module Routing
|
5
|
+
class Isoline < Base
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
super()
|
9
|
+
@base_url = 'http://isoline.route.api.here.com'
|
10
|
+
@test_url = 'http://isoline.route.cit.api.here.com'
|
11
|
+
@method_name = 'calculateisoline'
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(options={})
|
15
|
+
destination = options[:destination]
|
16
|
+
start = options[:start]
|
17
|
+
raise "One of destination or start must be supplied" unless destination or start
|
18
|
+
super(options)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Nokia
|
2
|
+
module Here
|
3
|
+
module Resource
|
4
|
+
module Routing
|
5
|
+
class LinkInfo < Base
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
super()
|
9
|
+
@method_name = 'getlinkinfo'
|
10
|
+
end
|
11
|
+
|
12
|
+
def get(options={})
|
13
|
+
raise ":linkids is required" unless options[:linkids]
|
14
|
+
raise "One of :quadKey or :tmcCodes is required" unless options[:quadKey] or options[:tmcCodes]
|
15
|
+
super(options)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Nokia
|
2
|
+
module Here
|
3
|
+
module Resource
|
4
|
+
module Routing
|
5
|
+
class Matrix < Base
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
super()
|
9
|
+
@method_name = 'calculatematrix'
|
10
|
+
@base_url = 'http://matrix.route.api.here.com'
|
11
|
+
@test_url = 'http://matrix.route.cit.api.here.com'
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Nokia
|
2
|
+
module Here
|
3
|
+
module Resource
|
4
|
+
module Routing
|
5
|
+
class Route < Base
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
super()
|
9
|
+
@method_name = 'getroute'
|
10
|
+
end
|
11
|
+
|
12
|
+
def calculate_route(options={})
|
13
|
+
@method_name = 'calculateroute'
|
14
|
+
self.get(options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_route(options={})
|
18
|
+
@method_name = 'getroute'
|
19
|
+
self.get(options)
|
20
|
+
end
|
21
|
+
|
22
|
+
def get(options={})
|
23
|
+
super(options)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Nokia
|
2
|
+
module Here
|
3
|
+
module Resource
|
4
|
+
module Transit
|
5
|
+
class Isochrone < Base
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
super()
|
9
|
+
@path = '/isochrone/v1'
|
10
|
+
end
|
11
|
+
|
12
|
+
def search(options={})
|
13
|
+
@method_name = 'search'
|
14
|
+
raise ":time, :x and :y are required" unless options[:time] and options[:x] and options[:y]
|
15
|
+
self.get(options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.search(options={})
|
19
|
+
self.new.search(options)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/nokia-here.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'nokia/here/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "nokia-here"
|
8
|
+
spec.version = Nokia::Here::VERSION
|
9
|
+
spec.authors = ["yunwei"]
|
10
|
+
spec.email = ["stillwyw@gmail.com"]
|
11
|
+
spec.summary = %q{A gem for Nokia Here map REST api.}
|
12
|
+
spec.description = %q{Nokia Here map REST api.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'rest-client'
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require './lib/nokia/here'
|
2
|
+
require './spec/app_setup'
|
3
|
+
RSpec.describe Nokia::Here::Resource::Geocoder do
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
describe "geocode an address" do
|
8
|
+
it "Should get a invaild isochrone search respond 403" do
|
9
|
+
options = {
|
10
|
+
searchtext: '425 W Randolph Street, Chicago',
|
11
|
+
gen: 9
|
12
|
+
}
|
13
|
+
res = Nokia::Here::Resource::Geocoder.geocode options
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "reverse geocode an point" do
|
18
|
+
it "Should get a invaild isochrone search respond 403" do
|
19
|
+
options = {
|
20
|
+
prox: '50.112,8.683,100',
|
21
|
+
mode: 'retrieveAddresses',
|
22
|
+
gen: 9
|
23
|
+
}
|
24
|
+
res = Nokia::Here::Resource::Geocoder.reverse_geocode options
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require './lib/nokia/here'
|
2
|
+
require './spec/app_setup'
|
3
|
+
RSpec.describe Nokia::Here::Resource::Transit::Isochrone do
|
4
|
+
|
5
|
+
describe "search isochrone" do
|
6
|
+
it "Should get a invaild isochrone search respond 403" do
|
7
|
+
options = {
|
8
|
+
time: '2015-12-16T06:36:40',
|
9
|
+
x: 144.9731852,
|
10
|
+
y: -37.8089497
|
11
|
+
}
|
12
|
+
puts Nokia::Here::Resource::Transit::Isochrone.search options
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require './lib/nokia/here'
|
2
|
+
require './spec/app_setup'
|
3
|
+
RSpec.describe Nokia::Here::Resource::Routing::Isoline do
|
4
|
+
|
5
|
+
describe "get isoline" do
|
6
|
+
it "Should get a vaild isoline json" do
|
7
|
+
options = {
|
8
|
+
mode: 'fastest;car;traffic:enabled',
|
9
|
+
rangetype: 'time',
|
10
|
+
start: 'geo!-37.8089497,144.9731852',
|
11
|
+
range: 600,
|
12
|
+
departure: Time.now.xmlschema
|
13
|
+
}
|
14
|
+
|
15
|
+
res = Nokia::Here::Resource::Routing::Isoline.get options
|
16
|
+
|
17
|
+
expect(res.code).to eq(200)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "Should ask for at least a start or a destination" do
|
21
|
+
options = {
|
22
|
+
mode: 'fastest;car;traffic:enabled',
|
23
|
+
rangetype: 'time',
|
24
|
+
# start: 'geo!-37.8089497,144.9731852',
|
25
|
+
range: 600,
|
26
|
+
departure: Time.now.xmlschema
|
27
|
+
}
|
28
|
+
|
29
|
+
expect{Nokia::Here::Resource::Routing::Isoline.get options}.to raise_error(RuntimeError)
|
30
|
+
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/spec/matrix_spec.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require './lib/nokia/here'
|
2
|
+
require './spec/app_setup'
|
3
|
+
RSpec.describe Nokia::Here::Resource::Routing::Isoline do
|
4
|
+
|
5
|
+
describe "get isoline" do
|
6
|
+
it "Should get a vaild isoline json" do
|
7
|
+
options = {
|
8
|
+
mode: 'fastest;car;traffic:enabled',
|
9
|
+
rangetype: 'time',
|
10
|
+
start: 'geo!-37.8089497,144.9731852',
|
11
|
+
range: 600,
|
12
|
+
departure: Time.now.xmlschema
|
13
|
+
}
|
14
|
+
|
15
|
+
res = Nokia::Here::Resource::Routing::Isoline.get options
|
16
|
+
|
17
|
+
expect(res.code).to eq(200)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/spec/route_spec.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require './lib/nokia/here'
|
2
|
+
require './spec/app_setup'
|
3
|
+
RSpec.describe Nokia::Here::Resource::Routing::Isoline do
|
4
|
+
|
5
|
+
describe "get isoline" do
|
6
|
+
it "Should get a vaild isoline json" do
|
7
|
+
options = {
|
8
|
+
waypoint0: 'geo!51.512,-0.111',
|
9
|
+
waypoint1: 'geo!51.519,-0.074',
|
10
|
+
departure: '2016-01-04T17:00:00+02',
|
11
|
+
mode: 'fastest;publicTransportTimeTable'
|
12
|
+
}
|
13
|
+
|
14
|
+
res = Nokia::Here::Resource::Routing::Route.calculate_route options
|
15
|
+
|
16
|
+
expect(res.code).to eq(200)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
+
config.run_all_when_everything_filtered = true
|
10
|
+
config.filter_run :focus
|
11
|
+
|
12
|
+
# Run specs in random order to surface order dependencies. If you find an
|
13
|
+
# order dependency and want to debug it, you can fix the order by providing
|
14
|
+
# the seed, which is printed after each run.
|
15
|
+
# --seed 1234
|
16
|
+
config.order = 'random'
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nokia-here
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- yunwei
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Nokia Here map REST api.
|
70
|
+
email:
|
71
|
+
- stillwyw@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- lib/nokia/here.rb
|
83
|
+
- lib/nokia/here/resource/base.rb
|
84
|
+
- lib/nokia/here/resource/geocoder.rb
|
85
|
+
- lib/nokia/here/resource/routing/base.rb
|
86
|
+
- lib/nokia/here/resource/routing/isoline.rb
|
87
|
+
- lib/nokia/here/resource/routing/link_info.rb
|
88
|
+
- lib/nokia/here/resource/routing/matrix.rb
|
89
|
+
- lib/nokia/here/resource/routing/route.rb
|
90
|
+
- lib/nokia/here/resource/transit/base.rb
|
91
|
+
- lib/nokia/here/resource/transit/isochrone.rb
|
92
|
+
- lib/nokia/here/version.rb
|
93
|
+
- nokia-here.gemspec
|
94
|
+
- spec/geocoder_spec.rb
|
95
|
+
- spec/isochrone_spec.rb
|
96
|
+
- spec/isoline_spec.rb
|
97
|
+
- spec/matrix_spec.rb
|
98
|
+
- spec/route_spec.rb
|
99
|
+
- spec/spec_helper.rb
|
100
|
+
homepage: ''
|
101
|
+
licenses:
|
102
|
+
- MIT
|
103
|
+
metadata: {}
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 2.4.8
|
121
|
+
signing_key:
|
122
|
+
specification_version: 4
|
123
|
+
summary: A gem for Nokia Here map REST api.
|
124
|
+
test_files:
|
125
|
+
- spec/geocoder_spec.rb
|
126
|
+
- spec/isochrone_spec.rb
|
127
|
+
- spec/isoline_spec.rb
|
128
|
+
- spec/matrix_spec.rb
|
129
|
+
- spec/route_spec.rb
|
130
|
+
- spec/spec_helper.rb
|