access 2.0.23 → 2.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/access/api.rb +16 -0
- data/lib/access/geolocation.rb +20 -3
- data/lib/access/response.rb +7 -0
- data/lib/access/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04985d112cda02dec9aca8702fc92402aad0ccb8
|
4
|
+
data.tar.gz: c4f2f656abee6f0abfb90676968fbc950bdea25e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8803ec8459df409069a76bc648f4b996482c44cbf7f86dd5335e3d54a86226f28708aec3328ffe3f29886242cfb7066bfd853c33947c4715314f69063728a754
|
7
|
+
data.tar.gz: 817797c362bf4f8c7341bd8362984d0f39733f571e7134d09404b8efaa034b5669190bc830915ba68ea4f088668430e214156382afcfc68345370f85b3b6d8f3
|
data/lib/access/api.rb
CHANGED
@@ -340,6 +340,22 @@ module Access
|
|
340
340
|
FavoriteResponse.new(response)
|
341
341
|
end
|
342
342
|
end
|
343
|
+
|
344
|
+
## Geolocation
|
345
|
+
|
346
|
+
def geolocation_search(options = {})
|
347
|
+
request.get('/geolocation', 'offer', options) do |response|
|
348
|
+
GeolocationResponse.new(response)
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
def geolocation_find(options = {})
|
353
|
+
request.get('/geolocation/find_location', 'offer', options) do |response|
|
354
|
+
GeolocationResponse.new(response)
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
|
343
359
|
private
|
344
360
|
|
345
361
|
def request
|
data/lib/access/geolocation.rb
CHANGED
@@ -2,9 +2,26 @@ module Access
|
|
2
2
|
class Geolocation
|
3
3
|
attr_accessor :lat, :lon
|
4
4
|
|
5
|
-
def
|
6
|
-
|
7
|
-
|
5
|
+
def self.search(options = {})
|
6
|
+
Access::Api.new.geolocation_search options
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.find(options = {})
|
10
|
+
Access::Api.new.geolocation_find options
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.process_batch(chunk)
|
14
|
+
chunk.map { |location| new(location) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(values)
|
18
|
+
self.class.class_eval {attr_reader *values.keys }
|
19
|
+
values.each do |attribute_name, attribute_value|
|
20
|
+
self.instance_variable_set("@#{attribute_name}", attribute_value)
|
21
|
+
end
|
22
|
+
|
23
|
+
@lat = @geolocation['lat']
|
24
|
+
@lon = @geolocation['lon']
|
8
25
|
end
|
9
26
|
|
10
27
|
end
|
data/lib/access/response.rb
CHANGED
@@ -164,4 +164,11 @@ module Access
|
|
164
164
|
@favorites = Access::Favorite.process_batch(@favorites) if @favorites
|
165
165
|
end
|
166
166
|
end
|
167
|
+
|
168
|
+
class GeolocationResponse < Response
|
169
|
+
def process_data
|
170
|
+
@locations = Access::Geolocation.process_batch(@locations) if @locations
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
167
174
|
end
|
data/lib/access/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: access
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Eggett
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-11-
|
13
|
+
date: 2015-11-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|