yelpster 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,64 +2,64 @@ require 'yelpster/v2/request'
2
2
 
3
3
  class Yelp
4
4
  module V2
5
- module Search
6
- module Request
7
- class Base < Yelp::V2::Request
8
- #------------------------General Search Params -----------------
9
- # string representing the name of business or search term being
5
+ module Search
6
+ module Request
7
+ class Base < Yelp::V2::Request
8
+ #------------------------General Search Params -----------------
9
+ # string representing the name of business or search term being
10
10
  #requested.
11
- attr_reader :term
11
+ attr_reader :term
12
12
 
13
13
  # integer representing number of business results to return
14
- attr_reader :limit
15
-
16
- # integer representing number of results to skip (for pagination)
17
- attr_reader :offset
18
-
19
- # integer for specifying how to sort results
20
- # Sort Mode:
21
- # 0 = Best matched (default)
22
- # 1 = Distance
23
- # 2 = Highest rated
24
- # see www.yelp.com/developers/documentation/v2/search_api for more info
25
- attr_reader :sort
26
-
27
- # string specifying which business category to search in
28
- # see www.yelp.com/developers/documentation/category_list for list of
29
- # categories
30
- attr_reader :category_filter
31
-
32
- # integer specifying the search radius in meters
33
- attr_reader :radius_filter
34
-
14
+ attr_reader :limit
15
+
16
+ # integer representing number of results to skip (for pagination)
17
+ attr_reader :offset
18
+
19
+ # integer for specifying how to sort results
20
+ # Sort Mode:
21
+ # 0 = Best matched (default)
22
+ # 1 = Distance
23
+ # 2 = Highest rated
24
+ # see www.yelp.com/developers/documentation/v2/search_api for more info
25
+ attr_reader :sort
26
+
27
+ # string specifying which business category to search in
28
+ # see www.yelp.com/developers/documentation/category_list for list of
29
+ # categories
30
+ attr_reader :category_filter
31
+
32
+ # integer specifying the search radius in meters
33
+ attr_reader :radius_filter
34
+
35
35
  # boolean representing if business has a deal available
36
36
  attr_reader :deals_filter
37
- #---------------------------------------------------------------
37
+ #---------------------------------------------------------------
38
+
39
+ #--------------------------- Locale Params ---------------------
40
+ # string representing default country to use while parsing location field
41
+ attr_reader :cc
42
+
43
+ # string representing which language of reviews to return
44
+ attr_reader :lang
45
+ #---------------------------------------------------------------
38
46
 
39
- #--------------------------- Locale Params ---------------------
40
- # string representing default country to use while parsing location field
41
- attr_reader :cc
42
-
43
- # string representing which language of reviews to return
44
- attr_reader :lang
45
- #---------------------------------------------------------------
46
-
47
- def base_url
48
- 'http://api.yelp.com/v2/search'
49
- end
47
+ def base_url
48
+ 'http://api.yelp.com/v2/search'
49
+ end
50
50
 
51
- def to_yelp_params
52
- super.merge(:term => term,
53
- :limit => limit,
54
- :offset => offset,
55
- :sort => sort,
56
- :category_filter => category_filter,
57
- :radius_filter => radius_filter,
58
- :deals_filter => deals_filter,
59
- :cc => cc,
60
- :lang => lang)
61
- end
62
- end
51
+ def to_yelp_params
52
+ super.merge(:term => term,
53
+ :limit => limit,
54
+ :offset => offset,
55
+ :sort => sort,
56
+ :category_filter => category_filter,
57
+ :radius_filter => radius_filter,
58
+ :deals_filter => deals_filter,
59
+ :cc => cc,
60
+ :lang => lang)
61
+ end
62
+ end
63
63
  end
64
64
  end
65
65
  end
@@ -2,28 +2,28 @@ require 'yelpster/v2/search/request/base'
2
2
 
3
3
  class Yelp
4
4
  module V2
5
- module Search
6
- module Request
7
- # Describes a request to search for businesses
8
- # within a geo-point-specific bounding box
9
- #
10
- class BoundingBox < Yelp::V2::Search::Request::Base
11
- # REQUIRED - double, bottom right latitude of bounding box (SOUTH-WEST LAT)
12
- attr_reader :sw_latitude
13
-
14
- # REQUIRED - double, bottom right longitude of bounding box (SOUTH-WEST LONG)
15
- attr_reader :sw_longitude
16
-
17
- # REQUIRED - double, top left latitude of bounding box (NORTH-EAST LAT)
18
- attr_reader :ne_latitude
19
-
20
- # REQUIRED - double, top left longitude of bounding box (NORTH-EAST LONG)
21
- attr_reader :ne_longitude
5
+ module Search
6
+ module Request
7
+ # Describes a request to search for businesses
8
+ # within a geo-point-specific bounding box
9
+ #
10
+ class BoundingBox < Yelp::V2::Search::Request::Base
11
+ # REQUIRED - double, bottom right latitude of bounding box (SOUTH-WEST LAT)
12
+ attr_reader :sw_latitude
22
13
 
23
- def to_yelp_params
24
- super.merge(:bounds => "#{sw_latitude},#{sw_longitude}|#{ne_latitude},#{ne_longitude}")
25
- end
26
- end
14
+ # REQUIRED - double, bottom right longitude of bounding box (SOUTH-WEST LONG)
15
+ attr_reader :sw_longitude
16
+
17
+ # REQUIRED - double, top left latitude of bounding box (NORTH-EAST LAT)
18
+ attr_reader :ne_latitude
19
+
20
+ # REQUIRED - double, top left longitude of bounding box (NORTH-EAST LONG)
21
+ attr_reader :ne_longitude
22
+
23
+ def to_yelp_params
24
+ super.merge(:bounds => "#{sw_latitude},#{sw_longitude}|#{ne_latitude},#{ne_longitude}")
25
+ end
26
+ end
27
27
  end
28
28
  end
29
29
  end
@@ -2,52 +2,52 @@ require 'yelpster/v2/search/request/base'
2
2
 
3
3
  class Yelp
4
4
  module V2
5
- module Search
6
- module Request
7
- # Describes a request to search for the name of a neighborhood at a
8
- # specific geo-point location.
9
- #
10
- class GeoPoint < Yelp::V2::Search::Request::Base
11
- # REQUIRED - double, latitude of geo-point to search
12
- attr_reader :latitude
13
-
14
- # REQUIRED - double, longitude of geo-point to search
15
- attr_reader :longitude
16
-
17
- # OPTIONAL - double, accuracy of latitude and longitude of geo-point to search
18
- attr_reader :accuracy
19
-
20
- # OPTIONAL - double, altitude of geo-point to search
21
- attr_reader :altitude
22
-
23
- # OPTIONAL - double, accuracy of altitude geo-point to search
24
- attr_reader :altitude_accuracy
25
-
26
- def initialize(params)
27
- # we explicitly initialize the location fields since we reference
28
- # them later when building a full location string and we want
29
- # to know they were initialized properly (and avoid warnings)
30
- # 50 and -100 default values are provided as they lie within yelp API's geo-location range
31
- super({
32
- :latitude => 50.0,
33
- :longitude => -100.0,
34
- :accuracy => nil,
35
- :altitude => nil,
36
- :altitude_accuracy => nil
37
- }.merge(params))
38
- end
39
-
40
- def to_yelp_params
41
- super.merge(:ll => build_geo_loc_string)
42
- end
43
-
44
- # Returns the Yelp-compatible concatenated string with the various
45
- # possible bits of an address-oriented location.
46
- #
47
- def build_geo_loc_string
48
- [ @latitude, @longitude, @accuracy, @altitude, @altitude_accuracy ].compact.join(",")
49
- end
50
- end
5
+ module Search
6
+ module Request
7
+ # Describes a request to search for the name of a neighborhood at a
8
+ # specific geo-point location.
9
+ #
10
+ class GeoPoint < Yelp::V2::Search::Request::Base
11
+ # REQUIRED - double, latitude of geo-point to search
12
+ attr_reader :latitude
13
+
14
+ # REQUIRED - double, longitude of geo-point to search
15
+ attr_reader :longitude
16
+
17
+ # OPTIONAL - double, accuracy of latitude and longitude of geo-point to search
18
+ attr_reader :accuracy
19
+
20
+ # OPTIONAL - double, altitude of geo-point to search
21
+ attr_reader :altitude
22
+
23
+ # OPTIONAL - double, accuracy of altitude geo-point to search
24
+ attr_reader :altitude_accuracy
25
+
26
+ def initialize(params)
27
+ # we explicitly initialize the location fields since we reference
28
+ # them later when building a full location string and we want
29
+ # to know they were initialized properly (and avoid warnings)
30
+ # 50 and -100 default values are provided as they lie within yelp API's geo-location range
31
+ super({
32
+ :latitude => 50.0,
33
+ :longitude => -100.0,
34
+ :accuracy => nil,
35
+ :altitude => nil,
36
+ :altitude_accuracy => nil
37
+ }.merge(params))
38
+ end
39
+
40
+ def to_yelp_params
41
+ super.merge(:ll => build_geo_loc_string)
42
+ end
43
+
44
+ # Returns the Yelp-compatible concatenated string with the various
45
+ # possible bits of an address-oriented location.
46
+ #
47
+ def build_geo_loc_string
48
+ [ @latitude, @longitude, @accuracy, @altitude, @altitude_accuracy ].compact.join(",")
49
+ end
50
+ end
51
51
  end
52
52
  end
53
53
  end
@@ -63,7 +63,7 @@ class Yelp
63
63
  def build_location_string
64
64
  # per the Yelp documentation, the location string is to be built
65
65
  # as some combination of "address, neighborhood, city, state, or zip, country".
66
- [ @address, @neighborhood, @city, @state, @zipcode, @country ].compact.join(" ")
66
+ [ @address, @neighborhood, @city, @state, @zipcode, @country ].compact.join(',')
67
67
  end
68
68
 
69
69
  def build_geo_location_string
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yelpster
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naveed Siddiqui
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-28 00:00:00.000000000 Z
11
+ date: 2013-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -46,7 +46,7 @@ extra_rdoc_files: []
46
46
  files:
47
47
  - CHANGELOG.rdoc
48
48
  - LICENSE.txt
49
- - README.rdoc
49
+ - README.md
50
50
  - lib/yelpster/client.rb
51
51
  - lib/yelpster/record.rb
52
52
  - lib/yelpster/response_format.rb