rlocu 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/README.md +27 -26
- data/Rakefile +8 -7
- data/lib/rlocu.rb +21 -6
- data/lib/rlocu/geo_json.rb +22 -0
- data/lib/rlocu/menu.rb +113 -99
- data/lib/rlocu/query_builder.rb +55 -0
- data/lib/rlocu/utilities/lat_long_radius.rb +27 -0
- data/lib/rlocu/venue.rb +107 -24
- data/lib/rlocu/venue_query.rb +35 -0
- data/lib/rlocu/venue_search.rb +39 -21
- data/lib/rlocu/version.rb +1 -1
- data/rlocu.gemspec +13 -12
- data/spec/config_rlocu_spec_helper.rb +5 -0
- data/spec/geo_json_spec.rb +12 -0
- data/spec/menu/item_spec.rb +13 -0
- data/spec/menu/menu_item_spec.rb +13 -0
- data/spec/menu/option_group_spec.rb +10 -0
- data/spec/menu/option_spec.rb +9 -0
- data/spec/menu/section_spec.rb +9 -0
- data/spec/menu/section_text_spec.rb +9 -0
- data/spec/menu/subsection_spec.rb +9 -0
- data/spec/menu_spec.rb +9 -0
- data/spec/query/key_value_condition_spec.rb +37 -0
- data/spec/spec_helper.rb +99 -0
- data/spec/support/rspec_helpers.rb +53 -0
- data/spec/utilities/lat_long_radius_spec.rb +7 -0
- data/spec/venue_query_spec.rb +29 -0
- data/spec/venue_search_spec.rb +31 -0
- metadata +59 -25
- data/lib/rlocu/config.rb +0 -23
- data/lib/rlocu/venue_details.rb +0 -35
- data/lib/utilities.rb +0 -40
- data/test/test_truth.rb +0 -7
- data/test/test_utilities.rb +0 -21
- data/test/test_venue.rb +0 -15
- data/test/test_venue_details.rb +0 -11
- data/test/test_venue_search.rb +0 -26
data/test/test_truth.rb
DELETED
data/test/test_utilities.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require_relative '../lib/rlocu'
|
3
|
-
|
4
|
-
class UtilitiesTest < Test::Unit::TestCase
|
5
|
-
include Rlocu
|
6
|
-
def test_location_raises
|
7
|
-
assert_raise ArgumentError do Location.new('some','silliness') end
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_location_to_s
|
11
|
-
l = Location.new(123.4,678)
|
12
|
-
assert_equal '123.4,678', l.to_s
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_encode
|
16
|
-
#params = {name: 'bamboo thai', postal_code: '90278'}
|
17
|
-
skip "insert your api into .config"
|
18
|
-
#assert_equal 'api_key=YOUR_API_HERE&name=bamboo%20thai&postal_code=90278', Rlocu.encode(params)
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
data/test/test_venue.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require_relative '../lib/rlocu'
|
3
|
-
require 'JSON'
|
4
|
-
|
5
|
-
class VenueTest < Test::Unit::TestCase
|
6
|
-
include Rlocu
|
7
|
-
def test_menu_setter
|
8
|
-
params = {name: 'bamboo thai', postal_code: '90278'}
|
9
|
-
venues = Rlocu::VenueSearch.query(params)
|
10
|
-
|
11
|
-
deets = Rlocu::VenueDetails.query(venues)
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
data/test/test_venue_details.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require_relative '../lib/rlocu'
|
3
|
-
|
4
|
-
class VenueDetailsTest < Test::Unit::TestCase
|
5
|
-
include Rlocu
|
6
|
-
def test_reduce_ids
|
7
|
-
venues = Set.new
|
8
|
-
5.times {|n| venues << Venue.new(id: n)}
|
9
|
-
assert_equal '0;1;2;3;4', Rlocu::VenueDetails.send(:reduce_ids, venues)
|
10
|
-
end
|
11
|
-
end
|
data/test/test_venue_search.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require_relative '../lib/rlocu'
|
3
|
-
|
4
|
-
class VenueSearchTest < Test::Unit::TestCase
|
5
|
-
include Rlocu
|
6
|
-
def test_bad_arg_throws_error
|
7
|
-
assert_raise ArgumentError do VenueSearch.query(bad_param: 'blah') end
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_venue_search
|
11
|
-
params = {name: 'bamboo thai', postal_code: '90278'}
|
12
|
-
venues = VenueSearch.query(params)
|
13
|
-
assert_equal 'Bamboo Thai Bistro', venues[0].name
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_venue_search_block
|
17
|
-
params = {postal_code: '90278'}
|
18
|
-
# the search will only return 25 so we can be pretty confident this wont change
|
19
|
-
str = ''
|
20
|
-
VenueSearch.query(params) do |p|
|
21
|
-
str << p.region
|
22
|
-
end
|
23
|
-
assert_equal 'CA'*25, str
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|