Class: Hungrytable::Restaurant
- Inherits:
-
Object
- Object
- Hungrytable::Restaurant
- Includes:
- RequestExtensions
- Defined in:
- lib/hungrytable/restaurant.rb
Overview
Represents a restaurant and its details from the OpenTable API
Constant Summary collapse
- ATTRIBUTES =
Attributes that map directly to API response fields
%i[ address city error_ID error_message image_link latitude longitude metro_name neighborhood_name parking parking_details phone postal_code price_range primary_food_type restaurant_description restaurant_ID restaurant_name state url ].freeze
Instance Attribute Summary collapse
-
#restaurant_id ⇒ Object
readonly
Returns the value of attribute restaurant_id.
Instance Method Summary collapse
-
#id ⇒ Object
Alias for consistency.
-
#initialize(restaurant_id, opts = {}) ⇒ Restaurant
constructor
A new instance of Restaurant.
-
#valid? ⇒ Boolean
Check if the restaurant query was valid.
Constructor Details
#initialize(restaurant_id, opts = {}) ⇒ Restaurant
Returns a new instance of Restaurant.
34 35 36 37 |
# File 'lib/hungrytable/restaurant.rb', line 34 def initialize(restaurant_id, opts = {}) @requester = opts[:requester] || GetRequest @restaurant_id = restaurant_id end |
Instance Attribute Details
#restaurant_id ⇒ Object (readonly)
Returns the value of attribute restaurant_id.
32 33 34 |
# File 'lib/hungrytable/restaurant.rb', line 32 def restaurant_id @restaurant_id end |
Instance Method Details
#id ⇒ Object
Alias for consistency
40 41 42 |
# File 'lib/hungrytable/restaurant.rb', line 40 def id @restaurant_id end |
#valid? ⇒ Boolean
Check if the restaurant query was valid
46 47 48 |
# File 'lib/hungrytable/restaurant.rb', line 46 def valid? error_ID.to_s == '0' end |