Module: BookingSync::API::Client::ReservationsOffers
- Included in:
- BookingSync::API::Client
- Defined in:
- lib/bookingsync/api/client/reservations_offers.rb
Overview
Client methods for the Reservations::Offer V3 endpoint (path: reservations/offers). This is a sibling to ReservationsRequests and is a different concept from SpecialOffers, which is a rental-level discount API (path: rentals/BookingSync::API::Client::Rentals#rental/special_offers). The two coexist.
Contract notes (verified against live Core), differing from reservations_requests:
- Request root key is `reservations_offers` (plural, array-wrapped),
while the response root key is `offers` (asymmetric, same pattern
as reservations_requests -> requests).
- Offer attributes are flat, there is no `booking_payload` wrapper.
- There is no `booking_id` on create, a booking is attached later via
a separate Core-side AttachBooking command.
- Money is `total_amount_cents` (integer cents), not a `final_price`
string decimal like reservations_requests.
Instance Method Summary collapse
-
#create_reservation_offer(options = {}) ⇒ BookingSync::API::Resource
Create a new reservations offer.
-
#delete_reservation_offer(id) ⇒ NilClass
Delete a reservations offer.
-
#patch_reservation_offer(id, options = {}) ⇒ BookingSync::API::Resource
Edit a reservations offer.
-
#reservations_offer(id, options = {}) ⇒ BookingSync::API::Resource
Get a single reservations offer.
-
#reservations_offers(options = {}, &block) ⇒ Array<BookingSync::API::Resource>
List reservations offers.
Instance Method Details
#create_reservation_offer(options = {}) ⇒ BookingSync::API::Resource
Create a new reservations offer
48 49 50 |
# File 'lib/bookingsync/api/client/reservations_offers.rb', line 48 def create_reservation_offer( = {}) post("reservations/offers", reservations_offers: []).pop end |
#delete_reservation_offer(id) ⇒ NilClass
Delete a reservations offer
Soft-cancels the given reservations offer (sets canceled_at). This is
distinct from a status transition to withdrawn, which is done via
#patch_reservation_offer.
73 74 75 |
# File 'lib/bookingsync/api/client/reservations_offers.rb', line 73 def delete_reservation_offer(id) delete "reservations/offers/#{id}" end |
#patch_reservation_offer(id, options = {}) ⇒ BookingSync::API::Resource
Edit a reservations offer
A withdrawal is performed as a regular update transitioning the offer
to the withdrawn status, there is no dedicated withdraw endpoint on V3.
61 62 63 |
# File 'lib/bookingsync/api/client/reservations_offers.rb', line 61 def patch_reservation_offer(id, = {}) patch("reservations/offers/#{id}", reservations_offers: []).pop end |
#reservations_offer(id, options = {}) ⇒ BookingSync::API::Resource
Get a single reservations offer
37 38 39 |
# File 'lib/bookingsync/api/client/reservations_offers.rb', line 37 def reservations_offer(id, = {}) get("reservations/offers/#{id}", ).pop end |
#reservations_offers(options = {}, &block) ⇒ Array<BookingSync::API::Resource>
List reservations offers
Returns reservations offers for the current account.
26 27 28 |
# File 'lib/bookingsync/api/client/reservations_offers.rb', line 26 def reservations_offers( = {}, &block) paginate "reservations/offers", , &block end |