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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18f957dabe919343b909cf68d2bbb1ee2b1127ce
4
- data.tar.gz: 724d40820c87810e060a8671b57f810070a08e5c
3
+ metadata.gz: 04985d112cda02dec9aca8702fc92402aad0ccb8
4
+ data.tar.gz: c4f2f656abee6f0abfb90676968fbc950bdea25e
5
5
  SHA512:
6
- metadata.gz: e206f19c78823f95e423497643c8ce946a490392f2b9b7909683019b99b89ca5921e9174dc47bd0ac306aaf23de45e2d130b804f62d9ab4cb2545747b0da3731
7
- data.tar.gz: f05b5c75fbdc7a70004701e3f6b9d745fff61542beb4fd865d6356123b0bcd2491bfd3f5fca191edc442bd3d4ff94d14ffea42701efebc2a1e2c39b71ddce453
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
@@ -2,9 +2,26 @@ module Access
2
2
  class Geolocation
3
3
  attr_accessor :lat, :lon
4
4
 
5
- def initialize(geolocation = {})
6
- @lat = geolocation['lat']
7
- @lon = geolocation['lon']
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
@@ -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
@@ -1,4 +1,4 @@
1
1
  module Access
2
- VERSION = "2.0.23"
2
+ VERSION = "2.0.24"
3
3
  end
4
4
 
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.23
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-04 00:00:00.000000000 Z
13
+ date: 2015-11-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler