Class: Conexa::RoomBooking
- Inherits:
-
Model
- Object
- ConexaObject
- Model
- Conexa::RoomBooking
- Defined in:
- lib/conexa/resources/room_booking.rb
Overview
RoomBooking resource (Reserva de Sala)
Constant Summary
Constants inherited from ConexaObject
Instance Attribute Summary collapse
-
#booking_id ⇒ Integer
readonly
Booking ID (also accessible as #id).
-
#customer_id ⇒ Integer
readonly
Customer ID.
-
#room_id ⇒ Integer
readonly
Room ID.
-
#status ⇒ String
readonly
Booking status.
Attributes inherited from ConexaObject
Class Method Summary collapse
-
.cancel(id) ⇒ RoomBooking
Cancel a booking by ID.
-
.checkin(params = {}) ⇒ ConexaObject
Perform a checkin.
-
.checkout(id) ⇒ RoomBooking
Checkout a booking by ID.
- .show_url(*params) ⇒ Object
-
.standalone_checkout(params = {}) ⇒ ConexaObject
Perform a checkout (standalone).
- .url(*params) ⇒ Object
Instance Method Summary collapse
-
#cancel ⇒ self
Cancel this booking.
-
#checkout ⇒ self
Checkout this booking.
Methods inherited from Model
all, #class_name, class_name, #create, create, #destroy, destroy, extract_page_size_or_params, #fetch, find_by, find_by_id, #id, #primary_key, primary_key_attribute, #primary_key_name, #save, #set_primary_key, underscored_class_name
Methods included from Deprecatable
Methods inherited from ConexaObject
#==, #[]=, convert, #empty?, #initialize, #respond_to_missing?, #to_hash, #unsaved_attributes
Constructor Details
This class inherits a constructor from Conexa::ConexaObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Conexa::ConexaObject
Instance Attribute Details
#booking_id ⇒ Integer (readonly)
Returns Booking ID (also accessible as #id).
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/conexa/resources/room_booking.rb', line 32 class RoomBooking < Model primary_key_attribute :booking_id # Cancel this booking # @return [self] def cancel Conexa::Request.patch(self.class.show_url(primary_key, "cancel")).call(class_name) self end # Checkout this booking # @return [self] def checkout Conexa::Request.post(self.class.show_url(primary_key, "checkout")).call(class_name) self end class << self def url(*params) ["/room/bookings", *params].join '/' end def show_url(*params) ["/room/booking", *params].join '/' end # Cancel a booking by ID # @param id [Integer, String] booking ID # @return [RoomBooking] def cancel(id) find(id).cancel end # Checkout a booking by ID # @param id [Integer, String] booking ID # @return [RoomBooking] def checkout(id) find(id).checkout end # Perform a checkin # @param params [Hash] checkin parameters # @return [ConexaObject] def checkin(params = {}) Conexa::Request.post("/checkin", params: params).call("room_booking") end # Perform a checkout (standalone) # @param params [Hash] checkout parameters # @return [ConexaObject] def standalone_checkout(params = {}) Conexa::Request.post("/checkout", params: params).call("room_booking") end end end |
#customer_id ⇒ Integer (readonly)
Returns Customer ID.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/conexa/resources/room_booking.rb', line 32 class RoomBooking < Model primary_key_attribute :booking_id # Cancel this booking # @return [self] def cancel Conexa::Request.patch(self.class.show_url(primary_key, "cancel")).call(class_name) self end # Checkout this booking # @return [self] def checkout Conexa::Request.post(self.class.show_url(primary_key, "checkout")).call(class_name) self end class << self def url(*params) ["/room/bookings", *params].join '/' end def show_url(*params) ["/room/booking", *params].join '/' end # Cancel a booking by ID # @param id [Integer, String] booking ID # @return [RoomBooking] def cancel(id) find(id).cancel end # Checkout a booking by ID # @param id [Integer, String] booking ID # @return [RoomBooking] def checkout(id) find(id).checkout end # Perform a checkin # @param params [Hash] checkin parameters # @return [ConexaObject] def checkin(params = {}) Conexa::Request.post("/checkin", params: params).call("room_booking") end # Perform a checkout (standalone) # @param params [Hash] checkout parameters # @return [ConexaObject] def standalone_checkout(params = {}) Conexa::Request.post("/checkout", params: params).call("room_booking") end end end |
#room_id ⇒ Integer (readonly)
Returns Room ID.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/conexa/resources/room_booking.rb', line 32 class RoomBooking < Model primary_key_attribute :booking_id # Cancel this booking # @return [self] def cancel Conexa::Request.patch(self.class.show_url(primary_key, "cancel")).call(class_name) self end # Checkout this booking # @return [self] def checkout Conexa::Request.post(self.class.show_url(primary_key, "checkout")).call(class_name) self end class << self def url(*params) ["/room/bookings", *params].join '/' end def show_url(*params) ["/room/booking", *params].join '/' end # Cancel a booking by ID # @param id [Integer, String] booking ID # @return [RoomBooking] def cancel(id) find(id).cancel end # Checkout a booking by ID # @param id [Integer, String] booking ID # @return [RoomBooking] def checkout(id) find(id).checkout end # Perform a checkin # @param params [Hash] checkin parameters # @return [ConexaObject] def checkin(params = {}) Conexa::Request.post("/checkin", params: params).call("room_booking") end # Perform a checkout (standalone) # @param params [Hash] checkout parameters # @return [ConexaObject] def standalone_checkout(params = {}) Conexa::Request.post("/checkout", params: params).call("room_booking") end end end |
#status ⇒ String (readonly)
Returns Booking status.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/conexa/resources/room_booking.rb', line 32 class RoomBooking < Model primary_key_attribute :booking_id # Cancel this booking # @return [self] def cancel Conexa::Request.patch(self.class.show_url(primary_key, "cancel")).call(class_name) self end # Checkout this booking # @return [self] def checkout Conexa::Request.post(self.class.show_url(primary_key, "checkout")).call(class_name) self end class << self def url(*params) ["/room/bookings", *params].join '/' end def show_url(*params) ["/room/booking", *params].join '/' end # Cancel a booking by ID # @param id [Integer, String] booking ID # @return [RoomBooking] def cancel(id) find(id).cancel end # Checkout a booking by ID # @param id [Integer, String] booking ID # @return [RoomBooking] def checkout(id) find(id).checkout end # Perform a checkin # @param params [Hash] checkin parameters # @return [ConexaObject] def checkin(params = {}) Conexa::Request.post("/checkin", params: params).call("room_booking") end # Perform a checkout (standalone) # @param params [Hash] checkout parameters # @return [ConexaObject] def standalone_checkout(params = {}) Conexa::Request.post("/checkout", params: params).call("room_booking") end end end |
Class Method Details
.cancel(id) ⇒ RoomBooking
Cancel a booking by ID
61 62 63 |
# File 'lib/conexa/resources/room_booking.rb', line 61 def cancel(id) find(id).cancel end |
.checkin(params = {}) ⇒ ConexaObject
Perform a checkin
75 76 77 |
# File 'lib/conexa/resources/room_booking.rb', line 75 def checkin(params = {}) Conexa::Request.post("/checkin", params: params).call("room_booking") end |
.checkout(id) ⇒ RoomBooking
Checkout a booking by ID
68 69 70 |
# File 'lib/conexa/resources/room_booking.rb', line 68 def checkout(id) find(id).checkout end |
.show_url(*params) ⇒ Object
54 55 56 |
# File 'lib/conexa/resources/room_booking.rb', line 54 def show_url(*params) ["/room/booking", *params].join '/' end |
.standalone_checkout(params = {}) ⇒ ConexaObject
Perform a checkout (standalone)
82 83 84 |
# File 'lib/conexa/resources/room_booking.rb', line 82 def standalone_checkout(params = {}) Conexa::Request.post("/checkout", params: params).call("room_booking") end |
.url(*params) ⇒ Object
50 51 52 |
# File 'lib/conexa/resources/room_booking.rb', line 50 def url(*params) ["/room/bookings", *params].join '/' end |