mapbox-sdk 1.0.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +9 -0
- data/.travis.yml +9 -0
- data/CHANGELOG.md +45 -0
- data/Gemfile +6 -2
- data/README.md +27 -25
- data/docs/directions.md +31 -0
- data/docs/geocoding.md +15 -0
- data/docs/isochrone.md +11 -0
- data/docs/mapmatching.md +43 -0
- data/docs/matrix.md +38 -0
- data/docs/optimization.md +52 -0
- data/docs/tilequery.md +12 -0
- data/lib/mapbox-sdk.rb +1 -0
- data/lib/mapbox.rb +24 -8
- data/lib/mapbox/directions.rb +53 -11
- data/lib/mapbox/geocoder.rb +41 -4
- data/lib/mapbox/isochrone.rb +35 -0
- data/lib/mapbox/map_matching.rb +57 -0
- data/lib/mapbox/matrix.rb +32 -0
- data/lib/mapbox/optimization.rb +47 -0
- data/lib/mapbox/tilequery.rb +15 -0
- data/mapbox-sdk.gemspec +2 -3
- data/test/all_tests.rb +4 -0
- data/test/directions_test.rb +7 -5
- data/test/geocoding_test.rb +50 -3
- data/test/isochrone_test.rb +15 -0
- data/test/map_matching_test.rb +46 -0
- data/test/mapbox_test.rb +23 -0
- data/test/matrix_test.rb +40 -0
- data/test/optimization_test.rb +56 -0
- data/test/tilequery_test.rb +15 -0
- metadata +45 -33
- data/Gemfile.lock +0 -64
data/test/matrix_test.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'mapbox'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'mocha/setup'
|
4
|
+
require 'shoulda'
|
5
|
+
|
6
|
+
module Mapbox
|
7
|
+
class MatrixTest < Test::Unit::TestCase
|
8
|
+
should "#matrix with just coordinates and profile" do
|
9
|
+
Mapbox.access_token = ENV["MapboxAccessToken"]
|
10
|
+
result = Mapbox::Matrix.matrix([{
|
11
|
+
"longitude" => -122.42,
|
12
|
+
"latitude" => 37.78
|
13
|
+
}, {
|
14
|
+
"longitude" => -122.45,
|
15
|
+
"latitude" => 37.91
|
16
|
+
}, {
|
17
|
+
"longitude" => -122.48,
|
18
|
+
"latitude" => 37.73
|
19
|
+
}], "driving")
|
20
|
+
assert result
|
21
|
+
end
|
22
|
+
should "#matrix with optional params" do
|
23
|
+
Mapbox.access_token = ENV["MapboxAccessToken"]
|
24
|
+
result = Mapbox::Matrix.matrix([{
|
25
|
+
"longitude" => -122.42,
|
26
|
+
"latitude" => 37.78
|
27
|
+
}, {
|
28
|
+
"longitude" => -122.45,
|
29
|
+
"latitude" => 37.91
|
30
|
+
}, {
|
31
|
+
"longitude" => -122.48,
|
32
|
+
"latitude" => 37.73
|
33
|
+
}], "cycling", {
|
34
|
+
annotations: ["duration", "distance"],
|
35
|
+
approaches: ["curb","curb","curb"]
|
36
|
+
})
|
37
|
+
assert result
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'mapbox'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'mocha/setup'
|
4
|
+
require 'shoulda'
|
5
|
+
|
6
|
+
module Mapbox
|
7
|
+
class MatrixTest < Test::Unit::TestCase
|
8
|
+
should "#optimization with just coordinates and profile" do
|
9
|
+
Mapbox.access_token = ENV["MapboxAccessToken"]
|
10
|
+
result = Mapbox::Optimization.optimization([{
|
11
|
+
"longitude" => -122.42,
|
12
|
+
"latitude" => 37.78
|
13
|
+
}, {
|
14
|
+
"longitude" => -122.45,
|
15
|
+
"latitude" => 37.91
|
16
|
+
}, {
|
17
|
+
"longitude" => -122.48,
|
18
|
+
"latitude" => 37.73
|
19
|
+
}], "walking")
|
20
|
+
assert result
|
21
|
+
end
|
22
|
+
should "#optimization with optional params" do
|
23
|
+
Mapbox.access_token = ENV["MapboxAccessToken"]
|
24
|
+
result = Mapbox::Optimization.optimization([{
|
25
|
+
"longitude" => -122.42,
|
26
|
+
"latitude" => 37.78
|
27
|
+
}, {
|
28
|
+
"longitude" => -122.45,
|
29
|
+
"latitude" => 37.91
|
30
|
+
}, {
|
31
|
+
"longitude" => -122.48,
|
32
|
+
"latitude" => 37.73
|
33
|
+
}], "cycling", {
|
34
|
+
annotations: ["duration", "distance"],
|
35
|
+
approaches: ["curb","curb","curb"]
|
36
|
+
})
|
37
|
+
assert result
|
38
|
+
end
|
39
|
+
should "#optimization with an empty bearing" do
|
40
|
+
Mapbox.access_token = ENV["MapboxAccessToken"]
|
41
|
+
result = Mapbox::Optimization.optimization([{
|
42
|
+
"longitude" => -122.42,
|
43
|
+
"latitude" => 37.78
|
44
|
+
}, {
|
45
|
+
"longitude" => -122.45,
|
46
|
+
"latitude" => 37.91
|
47
|
+
}, {
|
48
|
+
"longitude" => -122.48,
|
49
|
+
"latitude" => 37.73
|
50
|
+
}], "driving", {
|
51
|
+
bearings: "45,90;;90,1"
|
52
|
+
})
|
53
|
+
assert result
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'mapbox'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'mocha/setup'
|
4
|
+
require 'shoulda'
|
5
|
+
|
6
|
+
module Mapbox
|
7
|
+
class TilequeryTest < Test::Unit::TestCase
|
8
|
+
should "#tilequery" do
|
9
|
+
Mapbox.access_token = ENV["MapboxAccessToken"]
|
10
|
+
result = Mapbox::Tilequery.tilequery(
|
11
|
+
"mapbox.mapbox-streets-v7", {"longitude" => -122.42901, "latitude" => 37.80633}, 5, 10)
|
12
|
+
assert result
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,97 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mapbox-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom MacWright
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: json
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.8.1
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 1.8.1
|
26
|
+
version: 2.1.0
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: mocha
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- - ~>
|
31
|
+
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
33
|
version: 0.13.2
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- - ~>
|
38
|
+
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: 0.13.2
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: shoulda
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- - ~>
|
45
|
+
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
47
|
version: 3.4.0
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- - ~>
|
52
|
+
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: 3.4.0
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: test-unit
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- -
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
61
|
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- -
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: rake
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- -
|
73
|
+
- - ">="
|
88
74
|
- !ruby/object:Gem::Version
|
89
75
|
version: '0'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- -
|
80
|
+
- - ">="
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
83
|
description: ''
|
@@ -101,20 +87,41 @@ executables: []
|
|
101
87
|
extensions: []
|
102
88
|
extra_rdoc_files: []
|
103
89
|
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
92
|
+
- CHANGELOG.md
|
104
93
|
- Gemfile
|
105
|
-
- Gemfile.lock
|
106
94
|
- LICENSE
|
107
95
|
- README.md
|
108
96
|
- Rakefile
|
97
|
+
- docs/directions.md
|
98
|
+
- docs/geocoding.md
|
99
|
+
- docs/isochrone.md
|
100
|
+
- docs/mapmatching.md
|
101
|
+
- docs/matrix.md
|
102
|
+
- docs/optimization.md
|
103
|
+
- docs/tilequery.md
|
104
|
+
- lib/mapbox-sdk.rb
|
109
105
|
- lib/mapbox.rb
|
110
106
|
- lib/mapbox/api_operations.rb
|
111
107
|
- lib/mapbox/authentication_error.rb
|
112
108
|
- lib/mapbox/directions.rb
|
113
109
|
- lib/mapbox/geocoder.rb
|
110
|
+
- lib/mapbox/isochrone.rb
|
111
|
+
- lib/mapbox/map_matching.rb
|
112
|
+
- lib/mapbox/matrix.rb
|
113
|
+
- lib/mapbox/optimization.rb
|
114
|
+
- lib/mapbox/tilequery.rb
|
114
115
|
- mapbox-sdk.gemspec
|
116
|
+
- test/all_tests.rb
|
115
117
|
- test/directions_test.rb
|
116
118
|
- test/geocoding_test.rb
|
119
|
+
- test/isochrone_test.rb
|
120
|
+
- test/map_matching_test.rb
|
117
121
|
- test/mapbox_test.rb
|
122
|
+
- test/matrix_test.rb
|
123
|
+
- test/optimization_test.rb
|
124
|
+
- test/tilequery_test.rb
|
118
125
|
homepage: https://mapbox.com/developers
|
119
126
|
licenses:
|
120
127
|
- MIT
|
@@ -125,21 +132,26 @@ require_paths:
|
|
125
132
|
- lib
|
126
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
127
134
|
requirements:
|
128
|
-
- -
|
135
|
+
- - ">="
|
129
136
|
- !ruby/object:Gem::Version
|
130
137
|
version: '0'
|
131
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
139
|
requirements:
|
133
|
-
- -
|
140
|
+
- - ">="
|
134
141
|
- !ruby/object:Gem::Version
|
135
142
|
version: '0'
|
136
143
|
requirements: []
|
137
|
-
|
138
|
-
rubygems_version: 2.0.14
|
144
|
+
rubygems_version: 3.1.4
|
139
145
|
signing_key:
|
140
146
|
specification_version: 4
|
141
147
|
summary: Ruby bindings for the Mapbox API
|
142
148
|
test_files:
|
149
|
+
- test/all_tests.rb
|
143
150
|
- test/directions_test.rb
|
144
151
|
- test/geocoding_test.rb
|
152
|
+
- test/isochrone_test.rb
|
153
|
+
- test/map_matching_test.rb
|
145
154
|
- test/mapbox_test.rb
|
155
|
+
- test/matrix_test.rb
|
156
|
+
- test/optimization_test.rb
|
157
|
+
- test/tilequery_test.rb
|
data/Gemfile.lock
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
mapbox (1.0.0)
|
5
|
-
json (~> 1.8.1)
|
6
|
-
rest-client (~> 1.4)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
activesupport (4.2.3)
|
12
|
-
i18n (~> 0.7)
|
13
|
-
json (~> 1.7, >= 1.7.7)
|
14
|
-
minitest (~> 5.1)
|
15
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
16
|
-
tzinfo (~> 1.1)
|
17
|
-
bourne (1.5.0)
|
18
|
-
mocha (>= 0.13.2, < 0.15)
|
19
|
-
domain_name (0.5.24)
|
20
|
-
unf (>= 0.0.5, < 1.0.0)
|
21
|
-
http-cookie (1.0.2)
|
22
|
-
domain_name (~> 0.5)
|
23
|
-
i18n (0.7.0)
|
24
|
-
json (1.8.3)
|
25
|
-
metaclass (0.0.4)
|
26
|
-
mime-types (2.6.1)
|
27
|
-
minitest (5.7.0)
|
28
|
-
mocha (0.13.3)
|
29
|
-
metaclass (~> 0.0.1)
|
30
|
-
netrc (0.10.3)
|
31
|
-
power_assert (0.2.4)
|
32
|
-
rake (10.4.2)
|
33
|
-
rest-client (1.8.0)
|
34
|
-
http-cookie (>= 1.0.2, < 2.0)
|
35
|
-
mime-types (>= 1.16, < 3.0)
|
36
|
-
netrc (~> 0.7)
|
37
|
-
shoulda (3.4.0)
|
38
|
-
shoulda-context (~> 1.0, >= 1.0.1)
|
39
|
-
shoulda-matchers (~> 1.0, >= 1.4.1)
|
40
|
-
shoulda-context (1.2.1)
|
41
|
-
shoulda-matchers (1.5.6)
|
42
|
-
activesupport (>= 3.0.0)
|
43
|
-
bourne (~> 1.3)
|
44
|
-
test-unit (3.1.2)
|
45
|
-
power_assert
|
46
|
-
thread_safe (0.3.5)
|
47
|
-
tzinfo (1.2.2)
|
48
|
-
thread_safe (~> 0.1)
|
49
|
-
unf (0.1.4)
|
50
|
-
unf_ext
|
51
|
-
unf_ext (0.0.7.1)
|
52
|
-
|
53
|
-
PLATFORMS
|
54
|
-
ruby
|
55
|
-
|
56
|
-
DEPENDENCIES
|
57
|
-
mapbox!
|
58
|
-
mocha (~> 0.13.2)
|
59
|
-
rake
|
60
|
-
shoulda (~> 3.4.0)
|
61
|
-
test-unit
|
62
|
-
|
63
|
-
BUNDLED WITH
|
64
|
-
1.10.6
|