Class: Hungrytable::RestaurantSearch
- Inherits:
-
Object
- Object
- Hungrytable::RestaurantSearch
show all
- Includes:
- RequestExtensions
- Defined in:
- lib/hungrytable/restaurant_search.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(restaurant, opts = {}) ⇒ RestaurantSearch
Returns a new instance of RestaurantSearch.
7
8
9
10
11
12
|
# File 'lib/hungrytable/restaurant_search.rb', line 7
def initialize restaurant, opts={}
@opts = opts
ensure_required_opts
@requester = opts[:requester] || GetRequest
@restaurant = restaurant
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &blk) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/hungrytable/restaurant_search.rb', line 18
def method_missing meth, *args, &blk
if %w(
cuisine_type
early_security_ID
early_time
error_ID
error_message
exact_security_ID
exact_time
later_security_ID
later_time
latitude
longitude
neighborhood_name
restaurant_name
results_key
no_times_message
).map(&:to_sym).include?(meth)
return details["ns:#{meth.to_s.camelize.gsub("Id","ID")}"]
end
super
end
|
Instance Attribute Details
#opts ⇒ Object
Returns the value of attribute opts.
5
6
7
|
# File 'lib/hungrytable/restaurant_search.rb', line 5
def opts
@opts
end
|
#restaurant ⇒ Object
Returns the value of attribute restaurant.
5
6
7
|
# File 'lib/hungrytable/restaurant_search.rb', line 5
def restaurant
@restaurant
end
|
Instance Method Details
#ideal_security_id ⇒ Object
41
42
43
44
45
46
|
# File 'lib/hungrytable/restaurant_search.rb', line 41
def ideal_security_id
return exact_security_ID unless exact_security_ID.nil?
return early_security_ID unless early_security_ID.nil?
return later_security_ID unless later_security_ID.nil?
nil
end
|
#ideal_time ⇒ Object
48
49
50
51
52
53
|
# File 'lib/hungrytable/restaurant_search.rb', line 48
def ideal_time
return exact_time unless exact_time.nil?
return early_time unless early_time.nil?
return later_time unless later_time.nil?
nil
end
|
#party_size ⇒ Object
55
56
57
|
# File 'lib/hungrytable/restaurant_search.rb', line 55
def party_size
opts[:party_size]
end
|
#valid? ⇒ Boolean
14
15
16
|
# File 'lib/hungrytable/restaurant_search.rb', line 14
def valid?
error_ID == "0"
end
|