city_grid 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .rvmrc
@@ -0,0 +1,22 @@
1
+ module CityGrid
2
+ class Api
3
+
4
+ attr_reader :request_opts
5
+
6
+ def initialize request_opts={}
7
+ @request_opts = request_opts
8
+ end
9
+
10
+ def results
11
+ request.parsed_response
12
+ end
13
+
14
+ def request
15
+ @request ||= Request.new(uri, request_opts)
16
+ end
17
+
18
+ def uri
19
+ raise "must be called from a subclass of Api"
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,11 @@
1
+ module CityGrid
2
+ class Offers < Api
3
+ def uri
4
+ if request_opts.has_key?(:lat) && request_opts.has_key?(:lon)
5
+ '/offers/v2/search/latlon'
6
+ else
7
+ '/offers/v2/search/where'
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module CityGrid
2
+ class Places < Api
3
+ def uri
4
+ if request_opts.has_key?(:lat) && request_opts.has_key?(:lon)
5
+ '/places/v2/search/latlon'
6
+ else
7
+ '/places/v2/search/where'
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,20 +1,5 @@
1
1
  module CityGrid
2
- class Reviews
3
-
4
- attr_reader :request_opts
5
-
6
- def initialize request_opts={}
7
- @request_opts = request_opts
8
- end
9
-
10
- def results
11
- request.parsed_response
12
- end
13
-
14
- def request
15
- @request ||= Request.new(uri, request_opts)
16
- end
17
-
2
+ class Reviews < Api
18
3
  def uri
19
4
  if request_opts.has_key?(:lat) && request_opts.has_key?(:lon)
20
5
  '/reviews/v2/search/latlon'
@@ -1,3 +1,3 @@
1
1
  module CityGrid
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/city_grid.rb CHANGED
@@ -1,7 +1,10 @@
1
1
  require 'city_grid/version'
2
2
  require 'city_grid/config'
3
3
  require 'city_grid/request'
4
+ require 'city_grid/api'
4
5
  require 'city_grid/reviews'
6
+ require 'city_grid/places'
7
+ require 'city_grid/offers'
5
8
 
6
9
  module CityGrid
7
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: city_grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: curb
16
- requirement: &8441580 !ruby/object:Gem::Requirement
16
+ requirement: &16356840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *8441580
24
+ version_requirements: *16356840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &8441040 !ruby/object:Gem::Requirement
27
+ requirement: &16356340 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *8441040
35
+ version_requirements: *16356340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: pry
38
- requirement: &8440540 !ruby/object:Gem::Requirement
38
+ requirement: &16355880 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *8440540
46
+ version_requirements: *16355880
47
47
  description: Ruby wrapper for CityGrid API
48
48
  email:
49
49
  - nicholas.fine@gmail.com
@@ -58,7 +58,10 @@ files:
58
58
  - Rakefile
59
59
  - city_grid.gemspec
60
60
  - lib/city_grid.rb
61
+ - lib/city_grid/api.rb
61
62
  - lib/city_grid/config.rb
63
+ - lib/city_grid/offers.rb
64
+ - lib/city_grid/places.rb
62
65
  - lib/city_grid/request.rb
63
66
  - lib/city_grid/reviews.rb
64
67
  - lib/city_grid/version.rb