locu_wrapper 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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)
@@ -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
@@ -1,5 +1,7 @@
1
1
  module Locu
2
- class Venue
3
- # empty for now
2
+ class Venue < LocuObject
3
+ def initialize(host, path, api_key)
4
+ super(host, path, api_key)
5
+ end
4
6
  end
5
7
  end
data/locu_wrapper.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "locu_wrapper"
3
- s.version = "0.0.2"
3
+ s.version = "0.0.3"
4
4
  s.authors = ["Nathaniel Escribano"]
5
5
  s.date = %q{2012-08-09}
6
6
  s.description = 'LocuWraper - a really simple locu wrapper'
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.2
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: []
@@ -1,7 +0,0 @@
1
- module Locu
2
- class Venue < LocuObject
3
- def initialize(host, path, api_key)
4
- super(host, path, api_key)
5
- end
6
- end
7
- end
Binary file