Module: HotelsPro::Stubs

Defined in:
lib/hotels_pro/stubs.rb,
lib/hotels_pro/stubs/stub.rb

Defined Under Namespace

Classes: Stub

Class Method Summary collapse

Class Method Details

.allocate_hotel_code(matcher = nil) ⇒ Object



18
19
20
21
22
# File 'lib/hotels_pro/stubs.rb', line 18

def allocate_hotel_code(matcher=nil)
  stub = Stub.new('allocateHotelCode', matcher)
  stubs << stub
  stub
end

.amend_hotel_booking(matcher = nil) ⇒ Object



48
49
50
51
52
# File 'lib/hotels_pro/stubs.rb', line 48

def amend_hotel_booking(matcher=nil)
  stub = Stub.new('amendHotelBooking', matcher)
  stubs << stub
  stub
end

.cancel_hotel_booking(matcher = nil) ⇒ Object



36
37
38
39
40
# File 'lib/hotels_pro/stubs.rb', line 36

def cancel_hotel_booking(matcher=nil)
  stub = Stub.new('cancelHotelBooking', matcher)
  stubs << stub
  stub
end

.clearObject



8
9
10
# File 'lib/hotels_pro/stubs.rb', line 8

def clear
  @stubs = []
end

.get_available_hotel(matcher = nil) ⇒ Object



12
13
14
15
16
# File 'lib/hotels_pro/stubs.rb', line 12

def get_available_hotel(matcher=nil)
  stub = Stub.new('getAvailableHotel', matcher)
  stubs << stub
  stub
end

.get_balance(matcher = nil) ⇒ Object



54
55
56
57
58
# File 'lib/hotels_pro/stubs.rb', line 54

def get_balance(matcher=nil)
  stub = Stub.new('getBalance', matcher)
  stubs << stub
  stub
end

.get_hotel_booking_status(matcher = nil) ⇒ Object



30
31
32
33
34
# File 'lib/hotels_pro/stubs.rb', line 30

def get_hotel_booking_status(matcher=nil)
  stub = Stub.new('getHotelBookingStatus', matcher)
  stubs << stub
  stub
end

.get_hotel_cancellation_policy(matcher = nil) ⇒ Object



42
43
44
45
46
# File 'lib/hotels_pro/stubs.rb', line 42

def get_hotel_cancellation_policy(matcher=nil)
  stub = Stub.new('getHotelCancellationPolicy', matcher)
  stubs << stub
  stub
end

.make_hotel_booking(matcher = nil) ⇒ Object



24
25
26
27
28
# File 'lib/hotels_pro/stubs.rb', line 24

def make_hotel_booking(matcher=nil)
  stub = Stub.new('makeHotelBooking', matcher)
  stubs << stub
  stub
end

.match(request) ⇒ Object



60
61
62
63
# File 'lib/hotels_pro/stubs.rb', line 60

def match(request)
  stub = stubs.find { |s| s.matches?(request) }
  stub.response if stub
end

.stubsObject



4
5
6
# File 'lib/hotels_pro/stubs.rb', line 4

def stubs
  @stubs ||= []
end