locu_wrapper 0.0.2 → 0.0.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.
- data/lib/locu_wrapper/locu_object.rb +26 -0
- data/lib/locu_wrapper/menu.rb +3 -15
- data/lib/locu_wrapper/venue.rb +4 -2
- data/locu_wrapper.gemspec +1 -1
- metadata +1 -3
- data/lib/locu_wrapper/venu.rb +0 -7
- data/locu_wrapper-0.0.1.gem +0 -0
@@ -6,6 +6,32 @@ module Locu
|
|
6
6
|
@uri = URI(host+path)
|
7
7
|
end
|
8
8
|
|
9
|
+
def search_by(query_params)
|
10
|
+
@uri.query = formulate_query(query_params)
|
11
|
+
response = Net::HTTP.get_response @uri
|
12
|
+
parse_response response
|
13
|
+
end
|
14
|
+
|
15
|
+
def method_missing(method, *args, &block)
|
16
|
+
# this allaws you do do something like
|
17
|
+
# search_by_name_and_location(name, location)
|
18
|
+
if method.to_s =~ /^search_by_(.+)$/
|
19
|
+
attrs = $1.split('_and_')
|
20
|
+
params = Hash[attrs.zip args]
|
21
|
+
search_by(params)
|
22
|
+
else
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def respond_to?(meth)
|
28
|
+
if meth.to_s =~ /^search_by_.*$/
|
29
|
+
true
|
30
|
+
else
|
31
|
+
super
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
9
35
|
private
|
10
36
|
|
11
37
|
def formulate_query(params_hash)
|
data/lib/locu_wrapper/menu.rb
CHANGED
@@ -1,22 +1,10 @@
|
|
1
|
+
# this is currently the same as
|
2
|
+
# a Venue - but i'm expecting them
|
3
|
+
# to diverge soon
|
1
4
|
module Locu
|
2
5
|
class Menu < LocuObject
|
3
|
-
|
4
|
-
# a lot of the defaults are simply
|
5
|
-
# hardcoded for the techcrunch
|
6
|
-
# hackathon
|
7
|
-
DEFAULTS = {
|
8
|
-
:street_address => 'mission'
|
9
|
-
}
|
10
|
-
|
11
6
|
def initialize(host, path, api_key)
|
12
7
|
super(host, path, api_key)
|
13
8
|
end
|
14
|
-
|
15
|
-
def get_by_name(name)
|
16
|
-
@uri.query = formulate_query({:name => name})
|
17
|
-
response = Net::HTTP.get_response @uri
|
18
|
-
parse_response response
|
19
|
-
end
|
20
|
-
|
21
9
|
end
|
22
10
|
end
|
data/lib/locu_wrapper/venue.rb
CHANGED
data/locu_wrapper.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locu_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -22,9 +22,7 @@ files:
|
|
22
22
|
- lib/locu_wrapper/client.rb
|
23
23
|
- lib/locu_wrapper/locu_object.rb
|
24
24
|
- lib/locu_wrapper/menu.rb
|
25
|
-
- lib/locu_wrapper/venu.rb
|
26
25
|
- lib/locu_wrapper/venue.rb
|
27
|
-
- locu_wrapper-0.0.1.gem
|
28
26
|
- locu_wrapper.gemspec
|
29
27
|
homepage: ''
|
30
28
|
licenses: []
|
data/lib/locu_wrapper/venu.rb
DELETED
data/locu_wrapper-0.0.1.gem
DELETED
Binary file
|