Class: Hungrytable::RestaurantSlotlock

Inherits:
Object
  • Object
show all
Includes:
RequestExtensions
Defined in:
lib/hungrytable/restaurant_slotlock.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(restaurant_search, requester = PostRequest) ⇒ RestaurantSlotlock

Returns a new instance of RestaurantSlotlock.



7
8
9
10
# File 'lib/hungrytable/restaurant_slotlock.rb', line 7

def initialize restaurant_search, requester=PostRequest
  @restaurant_search = restaurant_search
  @requester         = requester
end

Instance Attribute Details

#restaurant_searchObject (readonly)

Returns the value of attribute restaurant_search.



5
6
7
# File 'lib/hungrytable/restaurant_slotlock.rb', line 5

def restaurant_search
  @restaurant_search
end

Instance Method Details

#errorsObject



16
17
18
# File 'lib/hungrytable/restaurant_slotlock.rb', line 16

def errors
  details["ns:ErrorMessage"]
end

#paramsObject



25
26
27
28
29
30
31
32
33
# File 'lib/hungrytable/restaurant_slotlock.rb', line 25

def params
  {
    'RID'            => restaurant.id,
    'datetime'       => restaurant_search.ideal_time,
    'partysize'      => restaurant_search.party_size,
    'timesecurityID' => restaurant_search.ideal_security_id,
    'resultskey'     => restaurant_search.results_key
  }
end

#slotlock_idObject



20
21
22
23
# File 'lib/hungrytable/restaurant_slotlock.rb', line 20

def slotlock_id
  return nil unless successful?
  details["ns:SlotLockID"]
end

#successful?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/hungrytable/restaurant_slotlock.rb', line 12

def successful?
  details["ns:ErrorID"] == "0"
end