google_distance_matrix 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/.gitignore +17 -0
  2. data/.rbenv-version +1 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +106 -0
  6. data/Rakefile +1 -0
  7. data/google_distance_matrix.gemspec +30 -0
  8. data/lib/google_distance_matrix.rb +38 -0
  9. data/lib/google_distance_matrix/client.rb +47 -0
  10. data/lib/google_distance_matrix/configuration.rb +68 -0
  11. data/lib/google_distance_matrix/errors.rb +88 -0
  12. data/lib/google_distance_matrix/log_subscriber.rb +14 -0
  13. data/lib/google_distance_matrix/logger.rb +32 -0
  14. data/lib/google_distance_matrix/matrix.rb +122 -0
  15. data/lib/google_distance_matrix/place.rb +101 -0
  16. data/lib/google_distance_matrix/places.rb +43 -0
  17. data/lib/google_distance_matrix/railtie.rb +9 -0
  18. data/lib/google_distance_matrix/route.rb +49 -0
  19. data/lib/google_distance_matrix/routes_finder.rb +149 -0
  20. data/lib/google_distance_matrix/url_builder.rb +63 -0
  21. data/lib/google_distance_matrix/version.rb +3 -0
  22. data/spec/lib/google_distance_matrix/client_spec.rb +67 -0
  23. data/spec/lib/google_distance_matrix/configuration_spec.rb +63 -0
  24. data/spec/lib/google_distance_matrix/logger_spec.rb +38 -0
  25. data/spec/lib/google_distance_matrix/matrix_spec.rb +169 -0
  26. data/spec/lib/google_distance_matrix/place_spec.rb +93 -0
  27. data/spec/lib/google_distance_matrix/places_spec.rb +77 -0
  28. data/spec/lib/google_distance_matrix/route_spec.rb +28 -0
  29. data/spec/lib/google_distance_matrix/routes_finder_spec.rb +190 -0
  30. data/spec/lib/google_distance_matrix/url_builder_spec.rb +105 -0
  31. data/spec/request_recordings/success +62 -0
  32. data/spec/request_recordings/zero_results +57 -0
  33. data/spec/spec_helper.rb +24 -0
  34. metadata +225 -0
@@ -0,0 +1,57 @@
1
+ {
2
+ "destination_addresses" : [
3
+ "Drammensveien 1, 0271 Oslo, Norway",
4
+ "Skjellestadhagen, 1389 Heggedal, Norway"
5
+ ],
6
+ "origin_addresses" : [
7
+ "Gate, White Springs, FL 32096, USA",
8
+ "Askerveien 1, 1384 Asker, Norway"
9
+ ],
10
+ "rows" : [
11
+ {
12
+ "elements" : [
13
+ {
14
+ "distance" : {
15
+ "text" : "2.0 km",
16
+ "value" : 2032
17
+ },
18
+ "duration" : {
19
+ "text" : "6 mins",
20
+ "value" : 367
21
+ },
22
+ "status" : "OK"
23
+ },
24
+ {
25
+ "status" : "ZERO_RESULTS"
26
+ }
27
+ ]
28
+ },
29
+ {
30
+ "elements" : [
31
+ {
32
+ "distance" : {
33
+ "text" : "21.2 km",
34
+ "value" : 21246
35
+ },
36
+ "duration" : {
37
+ "text" : "22 mins",
38
+ "value" : 1315
39
+ },
40
+ "status" : "OK"
41
+ },
42
+ {
43
+ "distance" : {
44
+ "text" : "9.1 km",
45
+ "value" : 9103
46
+ },
47
+ "duration" : {
48
+ "text" : "15 mins",
49
+ "value" : 878
50
+ },
51
+ "status" : "OK"
52
+ }
53
+ ]
54
+ }
55
+ ],
56
+ "status" : "OK"
57
+ }
@@ -0,0 +1,24 @@
1
+ require 'bundler/setup'
2
+ require 'google_distance_matrix'
3
+
4
+ require 'webmock/rspec'
5
+ require 'shoulda-matchers'
6
+
7
+ WebMock.disable_net_connect!
8
+
9
+ module RecordedRequestHelpers
10
+ def recorded_request_for(name)
11
+ File.new path_to(name)
12
+ end
13
+
14
+ private
15
+
16
+ def path_to(name)
17
+ File.join File.dirname(__FILE__), "request_recordings", name.to_s
18
+ end
19
+ end
20
+
21
+ RSpec.configure do |c|
22
+ c.treat_symbols_as_metadata_keys_with_true_values = true
23
+ c.include RecordedRequestHelpers, :request_recordings
24
+ end
metadata ADDED
@@ -0,0 +1,225 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: google_distance_matrix
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Thorbjørn Hermansen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ prerelease: false
16
+ name: activesupport
17
+ type: :runtime
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 3.2.13
23
+ none: false
24
+ requirement: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ version: 3.2.13
29
+ none: false
30
+ - !ruby/object:Gem::Dependency
31
+ prerelease: false
32
+ name: activemodel
33
+ type: :runtime
34
+ version_requirements: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: 3.2.13
39
+ none: false
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 3.2.13
45
+ none: false
46
+ - !ruby/object:Gem::Dependency
47
+ prerelease: false
48
+ name: google_business_api_url_signer
49
+ type: :runtime
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.1
55
+ none: false
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: 0.0.1
61
+ none: false
62
+ - !ruby/object:Gem::Dependency
63
+ prerelease: false
64
+ name: bundler
65
+ type: :development
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ version: '1.3'
71
+ none: false
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '1.3'
77
+ none: false
78
+ - !ruby/object:Gem::Dependency
79
+ prerelease: false
80
+ name: rspec
81
+ type: :development
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ~>
85
+ - !ruby/object:Gem::Version
86
+ version: '2.13'
87
+ none: false
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ~>
91
+ - !ruby/object:Gem::Version
92
+ version: '2.13'
93
+ none: false
94
+ - !ruby/object:Gem::Dependency
95
+ prerelease: false
96
+ name: shoulda-matchers
97
+ type: :development
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: 2.0.0
103
+ none: false
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ~>
107
+ - !ruby/object:Gem::Version
108
+ version: 2.0.0
109
+ none: false
110
+ - !ruby/object:Gem::Dependency
111
+ prerelease: false
112
+ name: webmock
113
+ type: :development
114
+ version_requirements: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ~>
117
+ - !ruby/object:Gem::Version
118
+ version: '1.11'
119
+ none: false
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: '1.11'
125
+ none: false
126
+ - !ruby/object:Gem::Dependency
127
+ prerelease: false
128
+ name: rake
129
+ type: :development
130
+ version_requirements: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ none: false
136
+ requirement: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ! '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ none: false
142
+ description: Ruby client for The Google Distance Matrix API
143
+ email:
144
+ - thhermansen@gmail.com
145
+ executables: []
146
+ extensions: []
147
+ extra_rdoc_files: []
148
+ files:
149
+ - .gitignore
150
+ - .rbenv-version
151
+ - Gemfile
152
+ - LICENSE.txt
153
+ - README.md
154
+ - Rakefile
155
+ - google_distance_matrix.gemspec
156
+ - lib/google_distance_matrix.rb
157
+ - lib/google_distance_matrix/client.rb
158
+ - lib/google_distance_matrix/configuration.rb
159
+ - lib/google_distance_matrix/errors.rb
160
+ - lib/google_distance_matrix/log_subscriber.rb
161
+ - lib/google_distance_matrix/logger.rb
162
+ - lib/google_distance_matrix/matrix.rb
163
+ - lib/google_distance_matrix/place.rb
164
+ - lib/google_distance_matrix/places.rb
165
+ - lib/google_distance_matrix/railtie.rb
166
+ - lib/google_distance_matrix/route.rb
167
+ - lib/google_distance_matrix/routes_finder.rb
168
+ - lib/google_distance_matrix/url_builder.rb
169
+ - lib/google_distance_matrix/version.rb
170
+ - spec/lib/google_distance_matrix/client_spec.rb
171
+ - spec/lib/google_distance_matrix/configuration_spec.rb
172
+ - spec/lib/google_distance_matrix/logger_spec.rb
173
+ - spec/lib/google_distance_matrix/matrix_spec.rb
174
+ - spec/lib/google_distance_matrix/place_spec.rb
175
+ - spec/lib/google_distance_matrix/places_spec.rb
176
+ - spec/lib/google_distance_matrix/route_spec.rb
177
+ - spec/lib/google_distance_matrix/routes_finder_spec.rb
178
+ - spec/lib/google_distance_matrix/url_builder_spec.rb
179
+ - spec/request_recordings/success
180
+ - spec/request_recordings/zero_results
181
+ - spec/spec_helper.rb
182
+ homepage: ''
183
+ licenses:
184
+ - MIT
185
+ post_install_message:
186
+ rdoc_options: []
187
+ require_paths:
188
+ - lib
189
+ required_ruby_version: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ! '>='
192
+ - !ruby/object:Gem::Version
193
+ segments:
194
+ - 0
195
+ hash: -254032637546983924
196
+ version: '0'
197
+ none: false
198
+ required_rubygems_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ! '>='
201
+ - !ruby/object:Gem::Version
202
+ segments:
203
+ - 0
204
+ hash: -254032637546983924
205
+ version: '0'
206
+ none: false
207
+ requirements: []
208
+ rubyforge_project:
209
+ rubygems_version: 1.8.23
210
+ signing_key:
211
+ specification_version: 3
212
+ summary: Ruby client for The Google Distance Matrix API
213
+ test_files:
214
+ - spec/lib/google_distance_matrix/client_spec.rb
215
+ - spec/lib/google_distance_matrix/configuration_spec.rb
216
+ - spec/lib/google_distance_matrix/logger_spec.rb
217
+ - spec/lib/google_distance_matrix/matrix_spec.rb
218
+ - spec/lib/google_distance_matrix/place_spec.rb
219
+ - spec/lib/google_distance_matrix/places_spec.rb
220
+ - spec/lib/google_distance_matrix/route_spec.rb
221
+ - spec/lib/google_distance_matrix/routes_finder_spec.rb
222
+ - spec/lib/google_distance_matrix/url_builder_spec.rb
223
+ - spec/request_recordings/success
224
+ - spec/request_recordings/zero_results
225
+ - spec/spec_helper.rb