bookingsync-api 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/bookingsync-api.gemspec +1 -0
- data/lib/bookingsync/api/client.rb +41 -24
- data/lib/bookingsync/api/client/payments.rb +1 -1
- data/lib/bookingsync/api/client/rentals.rb +2 -2
- data/lib/bookingsync/api/version.rb +1 -1
- data/spec/bookingsync/api/client/accounts_spec.rb +8 -2
- data/spec/bookingsync/api/client/amenities_spec.rb +8 -2
- data/spec/bookingsync/api/client/availabilities_spec.rb +8 -2
- data/spec/bookingsync/api/client/bathrooms_spec.rb +25 -12
- data/spec/bookingsync/api/client/bedrooms_spec.rb +24 -11
- data/spec/bookingsync/api/client/booking_comments_spec.rb +23 -10
- data/spec/bookingsync/api/client/bookings_fees_spec.rb +8 -2
- data/spec/bookingsync/api/client/bookings_payments_spec.rb +8 -2
- data/spec/bookingsync/api/client/bookings_spec.rb +36 -20
- data/spec/bookingsync/api/client/bookings_taxes_spec.rb +8 -2
- data/spec/bookingsync/api/client/change_overs_spec.rb +8 -2
- data/spec/bookingsync/api/client/clients_spec.rb +23 -13
- data/spec/bookingsync/api/client/destinations_spec.rb +8 -2
- data/spec/bookingsync/api/client/fees_spec.rb +8 -2
- data/spec/bookingsync/api/client/inquiries_spec.rb +13 -7
- data/spec/bookingsync/api/client/living_rooms_spec.rb +22 -9
- data/spec/bookingsync/api/client/nightly_rate_maps_spec.rb +15 -6
- data/spec/bookingsync/api/client/payment_gateways_spec.rb +8 -2
- data/spec/bookingsync/api/client/payments_spec.rb +34 -16
- data/spec/bookingsync/api/client/periods_spec.rb +29 -14
- data/spec/bookingsync/api/client/photos_spec.rb +23 -9
- data/spec/bookingsync/api/client/preferences_general_settings_spec.rb +11 -4
- data/spec/bookingsync/api/client/rates_rules_spec.rb +25 -12
- data/spec/bookingsync/api/client/rates_spec.rb +8 -2
- data/spec/bookingsync/api/client/rates_tables_spec.rb +23 -10
- data/spec/bookingsync/api/client/rental_agreements_spec.rb +18 -8
- data/spec/bookingsync/api/client/rental_cancelation_policies_spec.rb +8 -1
- data/spec/bookingsync/api/client/rental_cancelation_policy_items_spec.rb +8 -1
- data/spec/bookingsync/api/client/rentals_amenities_spec.rb +22 -9
- data/spec/bookingsync/api/client/rentals_fees_spec.rb +14 -5
- data/spec/bookingsync/api/client/rentals_spec.rb +53 -19
- data/spec/bookingsync/api/client/reviews_spec.rb +12 -6
- data/spec/bookingsync/api/client/seasons_spec.rb +30 -14
- data/spec/bookingsync/api/client/sources_spec.rb +17 -8
- data/spec/bookingsync/api/client/special_offers_spec.rb +30 -15
- data/spec/bookingsync/api/client/strict_bookings_spec.rb +10 -14
- data/spec/bookingsync/api/client/taxes_spec.rb +8 -2
- data/spec/bookingsync/api/client_spec.rb +23 -7
- data/spec/bookingsync/api/relation_spec.rb +1 -1
- data/spec/bookingsync/api/resource_spec.rb +8 -8
- data/spec/bookingsync/api/response_spec.rb +8 -8
- data/spec/fixtures/cassettes/BookingSync_API_Client_Accounts/_account/returns_a_single_account.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_Accounts/_accounts/returns_accounts.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_Amenities/_amenities/returns_amenities.yml +220 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_Amenities/_amenity/returns_amenity.yml +50 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_Availabilities/_availabilities/returns_availabilities.yml +37 -21
- data/spec/fixtures/cassettes/BookingSync_API_Client_Availabilities/_availability/returns_a_single_availability.yml +33 -25
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bathrooms/_bathroom/returns_a_single_bathroom.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bathrooms/_bathrooms/returns_bathrooms.yml +33 -22
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bathrooms/_cancel_bathroom/cancels_given_bathroom.yml +21 -15
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bathrooms/_create_bathroom/creates_a_new_bathroom.yml +30 -19
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bathrooms/_edit_bathroom/updates_given_bathroom_by_ID.yml +26 -19
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bedrooms/_bedroom/returns_a_single_bedroom.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bedrooms/_bedrooms/returns_bedrooms.yml +32 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bedrooms/_cancel_bedroom/cancels_given_bedroom.yml +21 -15
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bedrooms/_create_bedroom/creates_a_new_bedroom.yml +29 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bedrooms/_edit_bedroom/updates_given_bedroom_by_ID.yml +25 -19
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_booking_comment/returns_single_booking_comment.yml +42 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_booking_comments/returns_booking_comments.yml +45 -33
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_create_booking_comment/creates_booking_comment.yml +43 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_create_booking_comment/returns_newly_created_booking_comment.yml +43 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_delete_booking_comment/deletes_given_booking_comment.yml +29 -17
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_edit_booking_comment/returns_updated_booking_comment.yml +36 -22
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_edit_booking_comment/updates_booking_comment.yml +36 -22
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_booking/returns_a_single_booking.yml +44 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_booking/returns_a_single_canceled_booking.yml +30 -23
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_a_block/yields_block_with_batch_of_bookings.yml +100 -115
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_auto_paginate_true/returns_all_bookings_joined_from_many_requests.yml +100 -115
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_per_page_setting/returns_limited_number_of_bookings.yml +52 -28
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/returns_bookings.yml +57 -25
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_cancel_booking/cancels_given_booking.yml +36 -20
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_create_booking/creates_a_booking.yml +49 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_edit_booking/updates_given_booking_by_ID.yml +44 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsFees/_bookings_fee/returns_a_single_bookings_fee.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsFees/_bookings_fees/returns_bookings_fees.yml +27 -19
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsPayments/_bookings_payment/returns_a_single_bookings_payment.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsPayments/_bookings_payments/returns_bookings_payments.yml +51 -28
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsTaxes/_bookings_tax/returns_a_single_bookings_tax.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsTaxes/_bookings_taxes/returns_bookings_taxes.yml +28 -20
- data/spec/fixtures/cassettes/BookingSync_API_Client_ChangeOvers/_change_over/returns_a_single_change_over.yml +44 -38
- data/spec/fixtures/cassettes/BookingSync_API_Client_ChangeOvers/_change_overs/returns_change_overs.yml +43 -37
- data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_client/returns_a_single_client.yml +27 -19
- data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_clients/returns_clients.yml +32 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_create_client/creates_a_new_client.yml +30 -19
- data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_edit_client/updates_given_client_by_ID.yml +25 -19
- data/spec/fixtures/cassettes/BookingSync_API_Client_Destinations/_destination/returns_a_single_destination.yml +29 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_Destinations/_destinations/returns_destinations.yml +59 -25
- data/spec/fixtures/cassettes/BookingSync_API_Client_Fees/_create_fee/creates_a_new_fee.yml +25 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_Fees/_fee/returns_a_single_fee.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_Fees/_fees/returns_fees.yml +31 -19
- data/spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_create_inquiry/creates_a_new_inquiry.yml +50 -27
- data/spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_inquiries/returns_inquiries.yml +50 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_inquiry/returns_a_single_inquiry.yml +29 -21
- data/spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_cancel_living_room/cancels_given_living_room.yml +35 -31
- data/spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_create_living_room/creates_a_new_living_room.yml +41 -37
- data/spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_edit_living_room/updates_given_living_room_by_ID.yml +38 -34
- data/spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_living_room/returns_a_single_living_room.yml +44 -40
- data/spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_living_rooms/returns_living_rooms.yml +43 -39
- data/spec/fixtures/cassettes/BookingSync_API_Client_NightlyRateMaps/_edit_nightly_rate_map/updates_given_nightly_rate_map_by_ID.yml +39 -33
- data/spec/fixtures/cassettes/BookingSync_API_Client_NightlyRateMaps/_nightly_rate_map/returns_a_single_nightly_rate_map.yml +44 -38
- data/spec/fixtures/cassettes/BookingSync_API_Client_NightlyRateMaps/_nightly_rate_maps/returns_nightly_rate_maps.yml +44 -38
- data/spec/fixtures/cassettes/BookingSync_API_Client_PaymentGateways/_payment_gateway/returns_a_single_payment_gateway.yml +38 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_PaymentGateways/_payment_gateways/returns_payment_gateways.yml +37 -23
- data/spec/fixtures/cassettes/BookingSync_API_Client_Payments/_cancel_payment/cancels_given_payment.yml +36 -20
- data/spec/fixtures/cassettes/BookingSync_API_Client_Payments/_create_payment/creates_a_new_payment.yml +50 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_Payments/_edit_payment/updates_given_payment_by_ID.yml +44 -25
- data/spec/fixtures/cassettes/BookingSync_API_Client_Payments/_payment/returns_a_single_payment.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_Payments/_payments/returns_payments.yml +55 -27
- data/spec/fixtures/cassettes/BookingSync_API_Client_Periods/_create_period/creates_a_new_period.yml +49 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_Periods/_delete_period/deletes_given_period.yml +35 -19
- data/spec/fixtures/cassettes/BookingSync_API_Client_Periods/_edit_period/updates_given_period_by_ID.yml +43 -25
- data/spec/fixtures/cassettes/BookingSync_API_Client_Periods/_period/returns_a_single_period.yml +28 -20
- data/spec/fixtures/cassettes/BookingSync_API_Client_Periods/_periods/returns_periods.yml +49 -25
- data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_create_photo/creates_a_photo.yml +47 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_create_photo/creates_a_photo_with_encoded_photo_file.yml +47 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_create_photo/creates_a_photo_with_photo_path.yml +47 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_create_photo/creates_a_photo_with_remote_URL.yml +47 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_delete_photo/delete_given_photo.yml +37 -21
- data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_edit_photo/updates_photo_s_description.yml +42 -23
- data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_edit_photo/updates_photo_s_image_file.yml +42 -23
- data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_photo/returns_a_single_photo.yml +28 -20
- data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_photos/returns_photos.yml +38 -22
- data/spec/fixtures/cassettes/BookingSync_API_Client_PreferencesGeneralSettings/_edit_preferences_general_setting/updates_given_preferences_general_setting_by_ID.yml +39 -34
- data/spec/fixtures/cassettes/BookingSync_API_Client_PreferencesGeneralSettings/_preferences_general_settings/returns_preferences_general_settings.yml +50 -42
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rates/_rate/returns_a_single_rate.yml +28 -20
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rates/_rates/returns_rates.yml +48 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_create_rates_rule/creates_a_new_rates_rule.yml +29 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_delete_rates_rule/deletes_given_rates_rule.yml +21 -15
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_edit_rates_rule/updates_given_rates_rule_by_ID.yml +24 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_rates_rule/returns_a_single_rates_rule.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_rates_rules/returns_rates_rules.yml +27 -19
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesTables/_create_rates_table/creates_a_new_rates_table.yml +49 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesTables/_delete_rates_table/deletes_given_rates_table.yml +36 -20
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesTables/_edit_rates_table/updates_given_rates_table_by_ID.yml +43 -25
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesTables/_rates_table/returns_a_single_rates_table.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesTables/_rates_tables/returns_rates_tables.yml +54 -36
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_create_rental_agreement/creates_a_new_rental_agreement.yml +50 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_create_rental_agreement_for_booking/creates_a_new_rental_agreement.yml +50 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_create_rental_agreement_for_rental/creates_a_new_rental_agreement.yml +50 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_rental_agreement/returns_a_single_rental_agreement.yml +30 -21
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_rental_agreements/returns_rental_agreements.yml +52 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicies/_rental_cancelation_policies/returns_rental_cancelation_policies.yml +48 -27
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicies/_rental_cancelation_policy/returns_a_single_rental_cancelation_policy.yml +42 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicyItems/_rental_cancelation_policy_item/returns_a_single_rental_cancelation_policy_item.yml +41 -25
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicyItems/_rental_cancelation_policy_items/returns_rental_cancelation_policy_items.yml +43 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_create_rental/creates_a_new_rental.yml +49 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_delete_rental/deletes_given_rental.yml +36 -20
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_edit_rental/updates_given_rental_by_ID.yml +44 -28
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rental/returns_a_single_rental.yml +234 -31
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rental/with_additional_query_params/returns_a_single_rental_with_defined_params.yml +322 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals/links/returns_associated_photos.yml +453 -77
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals/returns_rentals.yml +405 -54
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals/returns_rentals_by_ids.yml +336 -32
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_meta/returns_meta_information_about_all_rentals.yml +53 -25
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_meta/returns_meta_information_about_requested_rentals.yml +55 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/performs_autopagination_using_POST.yml +121 -81
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/rentals_ids_given/makes_a_search_within_given_rentals.yml +42 -28
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/returns_rentals.yml +42 -28
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_create_rentals_amenity/creates_a_new_rentals_amenity.yml +29 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_delete_rentals_amenity/deletes_given_rentals_amenity.yml +21 -15
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_edit_rentals_amenity/updates_given_rentals_amenity_by_ID.yml +24 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenities/links/returns_associated_amenity.yml +104 -52
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenities/links/returns_associated_rental.yml +283 -53
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenities/returns_rentals_amenities.yml +51 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenity/returns_rentals_amenity.yml +50 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsFees/_create_rentals_fee/creates_a_new_rentals_fee.yml +30 -19
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsFees/_rentals_fee/returns_a_single_rentals_fee.yml +30 -22
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsFees/_rentals_fees/returns_rentals_fees.yml +27 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_Reviews/_create_review/creates_a_new_review.yml +49 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_Reviews/_review/returns_a_single_review.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_Reviews/_reviews/returns_reviews.yml +41 -33
- data/spec/fixtures/cassettes/BookingSync_API_Client_Seasons/_create_season/creates_a_new_season.yml +50 -27
- data/spec/fixtures/cassettes/BookingSync_API_Client_Seasons/_delete_season/deletes_given_season.yml +36 -20
- data/spec/fixtures/cassettes/BookingSync_API_Client_Seasons/_edit_season/updates_given_season_by_ID.yml +44 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_Seasons/_season/returns_a_single_season.yml +29 -21
- data/spec/fixtures/cassettes/BookingSync_API_Client_Seasons/_seasons/returns_seasons.yml +55 -36
- data/spec/fixtures/cassettes/BookingSync_API_Client_Sources/_create_source/creates_a_new_source.yml +40 -25
- data/spec/fixtures/cassettes/BookingSync_API_Client_Sources/_edit_source/updates_given_source_by_ID.yml +36 -25
- data/spec/fixtures/cassettes/BookingSync_API_Client_Sources/_source/returns_a_single_source.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_Sources/_sources/returns_sources.yml +42 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_create_special_offer/creates_a_new_special_offer.yml +50 -26
- data/spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_delete_special_offer/deletes_given_special_offer.yml +36 -20
- data/spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_edit_special_offer/updates_given_special_offer_by_ID.yml +44 -25
- data/spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_special_offer/returns_a_single_special_offer.yml +29 -22
- data/spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_special_offers/returns_special_offers.yml +48 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_StrictBookings/_create_strict_booking/creates_a_booking.yml +43 -24
- data/spec/fixtures/cassettes/BookingSync_API_Client_Taxes/_tax/returns_a_single_tax.yml +26 -18
- data/spec/fixtures/cassettes/BookingSync_API_Client_Taxes/_taxes/returns_taxes.yml +28 -19
- data/spec/spec_helper.rb +6 -0
- data/spec/support/vcr_helper.rb +29 -0
- metadata +21 -10
- data/lib/bookingsync/api/client/preferences_payments.rb +0 -22
- data/spec/bookingsync/api/client/preferences_payments_spec.rb +0 -12
- data/spec/fixtures/cassettes/BookingSync_API_Client_PreferencesPayments/_preferences_payments/returns_preferences_payments.yml +0 -80
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals/links/returns_links_to_associated_resources.yml +0 -91
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21ea86e95a6baf65805f5245e7122a19bee233b1
|
4
|
+
data.tar.gz: b28efa9f653d940025fd2c3634d28194db9d491e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc6dd487a46aac96d5f79defb481e67e724ea4cc1888509b3838582bb06118a7bd03be5067951daf5aa6384fadea529a5c2edf94ed9fc91bcb0e095cd49a4de5
|
7
|
+
data.tar.gz: 290ef32d85ef0fe7b62d7bda949012e2dd2f4e59f83f46907c5363b5efd78375a71cf66b5b5335752ea76501c44dba4712d35ffa944adfbafca20403af6cef18
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.1.4
|
6
|
+
|
7
|
+
- Drop support for `preferences_payments`.
|
8
|
+
- Switch from `Net::HTTP` to `Net::HTTP::Persistent`.
|
9
|
+
- [bugfix] Fix bug when paginate with block didn't invoke it, if only one page of results was returned.
|
10
|
+
|
5
11
|
## 0.1.3
|
6
12
|
|
7
13
|
- Expose pagination_first_request to easily retrieve right timestamps for updated since syncs.
|
data/bookingsync-api.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_dependency "faraday", "~> 0.9"
|
21
|
+
spec.add_dependency "net-http-persistent", "~> 2"
|
21
22
|
spec.add_dependency "hashie"
|
22
23
|
spec.add_dependency "addressable"
|
23
24
|
spec.add_development_dependency "bundler", "~> 1.5"
|
@@ -21,7 +21,6 @@ require "bookingsync/api/client/periods"
|
|
21
21
|
require "bookingsync/api/client/payments"
|
22
22
|
require "bookingsync/api/client/payment_gateways"
|
23
23
|
require "bookingsync/api/client/preferences_general_settings"
|
24
|
-
require "bookingsync/api/client/preferences_payments"
|
25
24
|
require "bookingsync/api/client/photos"
|
26
25
|
require "bookingsync/api/client/rates"
|
27
26
|
require "bookingsync/api/client/rates_rules"
|
@@ -70,7 +69,6 @@ module BookingSync::API
|
|
70
69
|
include BookingSync::API::Client::Payments
|
71
70
|
include BookingSync::API::Client::PaymentGateways
|
72
71
|
include BookingSync::API::Client::PreferencesGeneralSettings
|
73
|
-
include BookingSync::API::Client::PreferencesPayments
|
74
72
|
include BookingSync::API::Client::Photos
|
75
73
|
include BookingSync::API::Client::Rates
|
76
74
|
include BookingSync::API::Client::RatesRules
|
@@ -203,28 +201,15 @@ module BookingSync::API
|
|
203
201
|
# @return [Array<BookingSync::API::Resource>] Batch of resources
|
204
202
|
def paginate(path, options = {}, &block)
|
205
203
|
instrument("paginate.bookingsync_api", path: path) do
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
204
|
+
request_settings = {
|
205
|
+
auto_paginate: options.delete(:auto_paginate),
|
206
|
+
request_method: options.delete(:request_method) || :get
|
207
|
+
}
|
208
|
+
|
209
|
+
if block_given?
|
210
|
+
data = fetch_with_block(path, options, request_settings, &block)
|
210
211
|
else
|
211
|
-
|
212
|
-
end
|
213
|
-
@pagination_first_response = response
|
214
|
-
data = response.resources.dup
|
215
|
-
|
216
|
-
if (block_given? || auto_paginate) && response.relations[:next]
|
217
|
-
first_request = true
|
218
|
-
loop do
|
219
|
-
if block_given?
|
220
|
-
yield(response.resources)
|
221
|
-
elsif auto_paginate
|
222
|
-
data.concat(response.resources) unless first_request
|
223
|
-
first_request = false
|
224
|
-
end
|
225
|
-
break unless response.relations[:next]
|
226
|
-
response = response.relations[:next].call({}, { method: request_method })
|
227
|
-
end
|
212
|
+
data = fetch_with_paginate(path, options, request_settings)
|
228
213
|
end
|
229
214
|
|
230
215
|
data
|
@@ -280,7 +265,7 @@ module BookingSync::API
|
|
280
265
|
def middleware
|
281
266
|
Faraday::RackBuilder.new do |builder|
|
282
267
|
builder.use :logger, logger
|
283
|
-
builder.adapter
|
268
|
+
builder.adapter :net_http_persistent
|
284
269
|
end
|
285
270
|
end
|
286
271
|
|
@@ -362,5 +347,37 @@ module BookingSync::API
|
|
362
347
|
yield payload if block_given?
|
363
348
|
end
|
364
349
|
end
|
350
|
+
|
351
|
+
def fetch_with_paginate(path, options, request_settings, data = [], response = nil)
|
352
|
+
response = initial_call(path, options, request_settings) unless response
|
353
|
+
data.concat(response.resources)
|
354
|
+
if response.relations[:next] && request_settings[:auto_paginate]
|
355
|
+
fetch_with_paginate(path, options, request_settings, data, next_page(response, request_settings))
|
356
|
+
else
|
357
|
+
data
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
def fetch_with_block(path, options, request_settings, response = nil, &block)
|
362
|
+
response = initial_call(path, options, request_settings) unless response
|
363
|
+
block.call(response.resources)
|
364
|
+
if response.relations[:next]
|
365
|
+
fetch_with_block(path, options, request_settings, next_page(response, request_settings), &block)
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
def initial_call(path, options, request_settings)
|
370
|
+
request_method = request_settings[:request_method]
|
371
|
+
if request_method == :get
|
372
|
+
response = call(request_method, path, query: options)
|
373
|
+
else
|
374
|
+
response = call(request_method, path, options)
|
375
|
+
end
|
376
|
+
@pagination_first_response = response
|
377
|
+
end
|
378
|
+
|
379
|
+
def next_page(response, request_settings)
|
380
|
+
response.relations[:next].call({}, { method: request_settings[:request_method] })
|
381
|
+
end
|
365
382
|
end
|
366
383
|
end
|
@@ -35,7 +35,7 @@ module BookingSync::API
|
|
35
35
|
# @param options [Hash] payment attributes
|
36
36
|
# @return [BookingSync::API::Resource] Newly created payment
|
37
37
|
def create_payment(booking_id, options = {})
|
38
|
-
post(
|
38
|
+
post("bookings/#{booking_id}/payments", payments: [options]).pop
|
39
39
|
end
|
40
40
|
|
41
41
|
# Edit a payment
|
@@ -40,8 +40,8 @@ module BookingSync::API
|
|
40
40
|
# @param rental [BookingSync::API::Resource|Integer] Rental or ID
|
41
41
|
# of the rental.
|
42
42
|
# @return [BookingSync::API::Resource]
|
43
|
-
def rental(rental)
|
44
|
-
get("rentals/#{rental}").pop
|
43
|
+
def rental(rental, options = {})
|
44
|
+
get("rentals/#{rental}", options).pop
|
45
45
|
end
|
46
46
|
|
47
47
|
# Create a new rental
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Accounts do
|
4
4
|
let(:client) { BookingSync::API::Client.new(test_access_token) }
|
5
5
|
|
6
|
+
before { |ex| @casette_base_path = casette_path(casette_dir, ex.metadata) }
|
7
|
+
|
6
8
|
describe ".accounts", :vcr do
|
7
9
|
it "returns accounts" do
|
8
10
|
expect(client.accounts).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::Accounts do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".account", :vcr do
|
16
|
+
let(:prefetched_account_id) {
|
17
|
+
find_resource("#{@casette_base_path}_accounts/returns_accounts.yml", "accounts")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single account" do
|
15
|
-
account = client.account(
|
16
|
-
expect(account.id).to eq
|
21
|
+
account = client.account(prefetched_account_id)
|
22
|
+
expect(account.id).to eq prefetched_account_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Amenities do
|
4
4
|
let(:client) { BookingSync::API::Client.new(test_access_token) }
|
5
5
|
|
6
|
+
before { |ex| @casette_base_path = casette_path(casette_dir, ex.metadata) }
|
7
|
+
|
6
8
|
describe ".amenities", :vcr do
|
7
9
|
it "returns amenities" do
|
8
10
|
expect(client.amenities).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::Amenities do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".amenity", :vcr do
|
16
|
+
let(:prefetched_amenity) {
|
17
|
+
find_resource("#{@casette_base_path}_amenities/returns_amenities.yml", "amenities")
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns amenity" do
|
15
|
-
amenity = client.amenity(
|
16
|
-
expect(amenity.title).to
|
21
|
+
amenity = client.amenity(prefetched_amenity[:id])
|
22
|
+
expect(amenity.title).to eq(prefetched_amenity[:title])
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Availabilities do
|
4
4
|
let(:client) { BookingSync::API::Client.new(test_access_token) }
|
5
5
|
|
6
|
+
before { |ex| @casette_base_path = casette_path(casette_dir, ex.metadata) }
|
7
|
+
|
6
8
|
describe ".availabilities", :vcr do
|
7
9
|
it "returns availabilities" do
|
8
10
|
expect(client.availabilities).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::Availabilities do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".availability", :vcr do
|
16
|
+
let(:prefetched_availability_id) {
|
17
|
+
find_resource("#{@casette_base_path}_availabilities/returns_availabilities.yml", "availabilities")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single availability" do
|
15
|
-
availability = client.availability(
|
16
|
-
expect(availability.id).to eq
|
21
|
+
availability = client.availability(prefetched_availability_id)
|
22
|
+
expect(availability.id).to eq prefetched_availability_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Bathrooms do
|
4
4
|
let(:client) { BookingSync::API::Client.new(test_access_token) }
|
5
5
|
|
6
|
+
before { |ex| @casette_base_path = casette_path(casette_dir, ex.metadata) }
|
7
|
+
|
6
8
|
describe ".bathrooms", :vcr do
|
7
9
|
it "returns bathrooms" do
|
8
10
|
expect(client.bathrooms).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::Bathrooms do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".bathroom", :vcr do
|
16
|
+
let(:prefetched_bathroom_id) {
|
17
|
+
find_resource("#{@casette_base_path}_bathrooms/returns_bathrooms.yml", "bathrooms")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single bathroom" do
|
15
|
-
bathroom = client.bathroom(
|
16
|
-
expect(bathroom.id).to eq
|
21
|
+
bathroom = client.bathroom(prefetched_bathroom_id)
|
22
|
+
expect(bathroom.id).to eq prefetched_bathroom_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
@@ -21,40 +27,43 @@ describe BookingSync::API::Client::Bathrooms do
|
|
21
27
|
let(:attributes) do
|
22
28
|
{
|
23
29
|
name_en: "New bathroom",
|
24
|
-
|
30
|
+
wc_count: 2
|
25
31
|
}
|
26
32
|
end
|
27
33
|
let(:rental) { BookingSync::API::Resource.new(client, id: 5116) }
|
28
34
|
|
29
35
|
it "creates a new bathroom" do
|
30
36
|
client.create_bathroom(rental, attributes)
|
31
|
-
assert_requested :post, bs_url("rentals/
|
37
|
+
assert_requested :post, bs_url("rentals/#{rental}/bathrooms"),
|
32
38
|
body: { bathrooms: [attributes] }.to_json
|
33
39
|
end
|
34
40
|
|
35
41
|
it "returns newly created bathroom" do
|
36
42
|
VCR.use_cassette("BookingSync_API_Client_Bathrooms/_create_bathroom/creates_a_new_bathroom") do
|
37
43
|
bathroom = client.create_bathroom(rental, attributes)
|
38
|
-
expect(bathroom.name).to
|
39
|
-
expect(bathroom.
|
44
|
+
expect(bathroom.name).to eq(en: "New bathroom")
|
45
|
+
expect(bathroom.wc_count).to eq(attributes[:wc_count])
|
40
46
|
end
|
41
47
|
end
|
42
48
|
end
|
43
49
|
|
44
50
|
describe ".edit_bathroom", :vcr do
|
45
51
|
let(:attributes) {
|
46
|
-
{ name_en: "Updated bathroom" }
|
52
|
+
{ name_en: "Updated bathroom", name_fr: "Salle de bain 1" }
|
53
|
+
}
|
54
|
+
let(:created_bathroom_id) {
|
55
|
+
find_resource("#{@casette_base_path}_create_bathroom/creates_a_new_bathroom.yml", "bathrooms")[:id]
|
47
56
|
}
|
48
57
|
|
49
58
|
it "updates given bathroom by ID" do
|
50
|
-
client.edit_bathroom(
|
51
|
-
assert_requested :put, bs_url("bathrooms
|
59
|
+
client.edit_bathroom(created_bathroom_id, attributes)
|
60
|
+
assert_requested :put, bs_url("bathrooms/#{created_bathroom_id}"),
|
52
61
|
body: { bathrooms: [attributes] }.to_json
|
53
62
|
end
|
54
63
|
|
55
64
|
it "returns updated bathroom" do
|
56
65
|
VCR.use_cassette("BookingSync_API_Client_Bathrooms/_edit_bathroom/updates_given_bathroom_by_ID") do
|
57
|
-
bathroom = client.edit_bathroom(
|
66
|
+
bathroom = client.edit_bathroom(created_bathroom_id, attributes)
|
58
67
|
expect(bathroom).to be_kind_of(BookingSync::API::Resource)
|
59
68
|
expect(bathroom.name).to eq(en: "Updated bathroom", fr: "Salle de bain 1")
|
60
69
|
end
|
@@ -62,9 +71,13 @@ describe BookingSync::API::Client::Bathrooms do
|
|
62
71
|
end
|
63
72
|
|
64
73
|
describe ".cancel_bathroom", :vcr do
|
74
|
+
let(:created_bathroom_id) {
|
75
|
+
find_resource("#{@casette_base_path}_create_bathroom/creates_a_new_bathroom.yml", "bathrooms")[:id]
|
76
|
+
}
|
77
|
+
|
65
78
|
it "cancels given bathroom" do
|
66
|
-
client.cancel_bathroom(
|
67
|
-
assert_requested :delete, bs_url("bathrooms
|
79
|
+
client.cancel_bathroom(created_bathroom_id)
|
80
|
+
assert_requested :delete, bs_url("bathrooms/#{created_bathroom_id}")
|
68
81
|
end
|
69
82
|
end
|
70
83
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Bedrooms do
|
4
4
|
let(:client) { BookingSync::API::Client.new(test_access_token) }
|
5
5
|
|
6
|
+
before { |ex| @casette_base_path = casette_path(casette_dir, ex.metadata) }
|
7
|
+
|
6
8
|
describe ".bedrooms", :vcr do
|
7
9
|
it "returns bedrooms" do
|
8
10
|
expect(client.bedrooms).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::Bedrooms do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".bedroom", :vcr do
|
16
|
+
let(:prefetched_bedroom_id) {
|
17
|
+
find_resource("#{@casette_base_path}_bedrooms/returns_bedrooms.yml", "bedrooms")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single bedroom" do
|
15
|
-
bedroom = client.bedroom(
|
16
|
-
expect(bedroom.id).to eq
|
21
|
+
bedroom = client.bedroom(prefetched_bedroom_id)
|
22
|
+
expect(bedroom.id).to eq prefetched_bedroom_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
@@ -28,33 +34,36 @@ describe BookingSync::API::Client::Bedrooms do
|
|
28
34
|
|
29
35
|
it "creates a new bedroom" do
|
30
36
|
client.create_bedroom(rental, attributes)
|
31
|
-
assert_requested :post, bs_url("rentals/
|
37
|
+
assert_requested :post, bs_url("rentals/#{rental}/bedrooms"),
|
32
38
|
body: { bedrooms: [attributes] }.to_json
|
33
39
|
end
|
34
40
|
|
35
41
|
it "returns newly created bedroom" do
|
36
42
|
VCR.use_cassette("BookingSync_API_Client_Bedrooms/_create_bedroom/creates_a_new_bedroom") do
|
37
43
|
bedroom = client.create_bedroom(rental, attributes)
|
38
|
-
expect(bedroom.name).to
|
39
|
-
expect(bedroom.sofa_beds_count).to
|
44
|
+
expect(bedroom.name).to eq(en: "New bedroom")
|
45
|
+
expect(bedroom.sofa_beds_count).to eq(attributes[:sofa_beds_count])
|
40
46
|
end
|
41
47
|
end
|
42
48
|
end
|
43
49
|
|
44
50
|
describe ".edit_bedroom", :vcr do
|
45
51
|
let(:attributes) {
|
46
|
-
{ name_en: "Updated bedroom" }
|
52
|
+
{ name_en: "Updated bedroom", name_fr: "Chambre 1" }
|
53
|
+
}
|
54
|
+
let(:created_bedroom_id) {
|
55
|
+
find_resource("#{@casette_base_path}_create_bedroom/creates_a_new_bedroom.yml", "bedrooms")[:id]
|
47
56
|
}
|
48
57
|
|
49
58
|
it "updates given bedroom by ID" do
|
50
|
-
client.edit_bedroom(
|
51
|
-
assert_requested :put, bs_url("bedrooms
|
59
|
+
client.edit_bedroom(created_bedroom_id, attributes)
|
60
|
+
assert_requested :put, bs_url("bedrooms/#{created_bedroom_id}"),
|
52
61
|
body: { bedrooms: [attributes] }.to_json
|
53
62
|
end
|
54
63
|
|
55
64
|
it "returns updated bedroom" do
|
56
65
|
VCR.use_cassette("BookingSync_API_Client_Bedrooms/_edit_bedroom/updates_given_bedroom_by_ID") do
|
57
|
-
bedroom = client.edit_bedroom(
|
66
|
+
bedroom = client.edit_bedroom(created_bedroom_id, attributes)
|
58
67
|
expect(bedroom).to be_kind_of(BookingSync::API::Resource)
|
59
68
|
expect(bedroom.name).to eq(en: "Updated bedroom", fr: "Chambre 1")
|
60
69
|
end
|
@@ -62,9 +71,13 @@ describe BookingSync::API::Client::Bedrooms do
|
|
62
71
|
end
|
63
72
|
|
64
73
|
describe ".cancel_bedroom", :vcr do
|
74
|
+
let(:created_bedroom_id) {
|
75
|
+
find_resource("#{@casette_base_path}_create_bedroom/creates_a_new_bedroom.yml", "bedrooms")[:id]
|
76
|
+
}
|
77
|
+
|
65
78
|
it "cancels given bedroom" do
|
66
|
-
client.cancel_bedroom(
|
67
|
-
assert_requested :delete, bs_url("bedrooms
|
79
|
+
client.cancel_bedroom(created_bedroom_id)
|
80
|
+
assert_requested :delete, bs_url("bedrooms/#{created_bedroom_id}")
|
68
81
|
end
|
69
82
|
end
|
70
83
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::BookingComments do
|
4
4
|
let(:client) { BookingSync::API::Client.new(test_access_token) }
|
5
5
|
|
6
|
+
before { |ex| @casette_base_path = casette_path(casette_dir, ex.metadata) }
|
7
|
+
|
6
8
|
describe ".booking_comments", :vcr do
|
7
9
|
it "returns booking_comments" do
|
8
10
|
expect(client.booking_comments).not_to be_empty
|
@@ -11,20 +13,24 @@ describe BookingSync::API::Client::BookingComments do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".booking_comment", :vcr do
|
16
|
+
let(:prefetched_booking_comment_id) {
|
17
|
+
find_resource("#{@casette_base_path}_booking_comments/returns_booking_comments.yml", "booking_comments")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns single booking_comment" do
|
15
|
-
booking_comment = client.booking_comment(
|
16
|
-
expect(booking_comment.id).to eq(
|
21
|
+
booking_comment = client.booking_comment(prefetched_booking_comment_id)
|
22
|
+
expect(booking_comment.id).to eq(prefetched_booking_comment_id)
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
26
|
describe ".create_booking_comment", :vcr do
|
21
|
-
let(:attributes) { { content: "Example
|
22
|
-
let(:booking) { BookingSync::API::Resource.new(client, id:
|
27
|
+
let(:attributes) { { content: "Example content" } }
|
28
|
+
let(:booking) { BookingSync::API::Resource.new(client, id: 817604) }
|
23
29
|
|
24
30
|
it "creates booking_comment" do
|
25
31
|
client.create_booking_comment(booking.id, attributes)
|
26
32
|
assert_requested :post, bs_url("booking_comments"),
|
27
|
-
body: { booking_id:
|
33
|
+
body: { booking_id: booking.id, booking_comments: [attributes] }.to_json
|
28
34
|
end
|
29
35
|
|
30
36
|
it "returns newly created booking_comment" do
|
@@ -35,23 +41,30 @@ describe BookingSync::API::Client::BookingComments do
|
|
35
41
|
|
36
42
|
describe ".edit_booking_comment", :vcr do
|
37
43
|
let(:attributes) { { content: "Updated content" } }
|
44
|
+
let(:created_booking_comment_id) {
|
45
|
+
find_resource("#{@casette_base_path}_create_booking_comment/creates_booking_comment.yml", "booking_comments")[:id]
|
46
|
+
}
|
38
47
|
|
39
48
|
it "updates booking_comment" do
|
40
|
-
client.edit_booking_comment(
|
41
|
-
assert_requested :put, bs_url("booking_comments
|
49
|
+
client.edit_booking_comment(created_booking_comment_id, attributes)
|
50
|
+
assert_requested :put, bs_url("booking_comments/#{created_booking_comment_id}"),
|
42
51
|
body: { booking_comments: [attributes] }.to_json
|
43
52
|
end
|
44
53
|
|
45
54
|
it "returns updated booking_comment" do
|
46
|
-
booking_comment = client.edit_booking_comment(
|
55
|
+
booking_comment = client.edit_booking_comment(created_booking_comment_id, attributes)
|
47
56
|
expect(booking_comment.content).to eq(attributes[:content])
|
48
57
|
end
|
49
58
|
end
|
50
59
|
|
51
60
|
describe ".delete_booking_comment", :vcr do
|
61
|
+
let(:created_booking_comment_id) {
|
62
|
+
find_resource("#{@casette_base_path}_create_booking_comment/creates_booking_comment.yml", "booking_comments")[:id]
|
63
|
+
}
|
64
|
+
|
52
65
|
it "deletes given booking_comment" do
|
53
|
-
client.delete_booking_comment(
|
54
|
-
assert_requested :delete, bs_url("booking_comments
|
66
|
+
client.delete_booking_comment(created_booking_comment_id)
|
67
|
+
assert_requested :delete, bs_url("booking_comments/#{created_booking_comment_id}")
|
55
68
|
end
|
56
69
|
end
|
57
70
|
end
|