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
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::BookingsFees 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 ".bookings_fees", :vcr do
|
7
9
|
it "returns bookings fees" do
|
8
10
|
expect(client.bookings_fees).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::BookingsFees do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".bookings_fee", :vcr do
|
16
|
+
let(:prefetched_bookings_fee_id) {
|
17
|
+
find_resource("#{@casette_base_path}_bookings_fees/returns_bookings_fees.yml", "bookings_fees")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single bookings_fee" do
|
15
|
-
bookings_fee = client.bookings_fee(
|
16
|
-
expect(bookings_fee.id).to eq
|
21
|
+
bookings_fee = client.bookings_fee(prefetched_bookings_fee_id)
|
22
|
+
expect(bookings_fee.id).to eq prefetched_bookings_fee_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::BookingsPayments 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 ".bookings_payments", :vcr do
|
7
9
|
it "returns bookings_payments" do
|
8
10
|
expect(client.bookings_payments).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::BookingsPayments do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".bookings_payment", :vcr do
|
16
|
+
let(:prefetched_bookings_payment_id) {
|
17
|
+
find_resource("#{@casette_base_path}_bookings_payments/returns_bookings_payments.yml", "bookings_payments")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single bookings_payment" do
|
15
|
-
bookings_payment = client.bookings_payment(
|
16
|
-
expect(bookings_payment.id).to eq
|
21
|
+
bookings_payment = client.bookings_payment(prefetched_bookings_payment_id)
|
22
|
+
expect(bookings_payment.id).to eq prefetched_bookings_payment_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
@@ -3,26 +3,28 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Bookings 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 ".bookings", :vcr do
|
7
9
|
it "returns bookings" do
|
8
|
-
expect(client.bookings).not_to be_empty
|
9
|
-
assert_requested :get, bs_url("bookings")
|
10
|
+
expect(client.bookings(include_canceled: true)).not_to be_empty
|
11
|
+
assert_requested :get, bs_url("bookings?include_canceled=true")
|
10
12
|
end
|
11
13
|
|
12
14
|
describe "pagination" do
|
13
15
|
context "with per_page setting" do
|
14
16
|
it "returns limited number of bookings" do
|
15
17
|
bookings = client.bookings(per_page: 2)
|
16
|
-
expect(bookings.size).to
|
18
|
+
expect(bookings.size).to eq(2)
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
22
|
context "with a block" do
|
21
23
|
it "yields block with batch of bookings" do
|
22
|
-
sizes = [2, 2
|
24
|
+
sizes = [2, 2]
|
23
25
|
index = 0
|
24
26
|
client.bookings(per_page: 2) do |bookings|
|
25
|
-
expect(bookings.size).to
|
27
|
+
expect(bookings.size).to eq(sizes[index])
|
26
28
|
index += 1
|
27
29
|
end
|
28
30
|
end
|
@@ -31,56 +33,66 @@ describe BookingSync::API::Client::Bookings do
|
|
31
33
|
context "with auto_paginate: true" do
|
32
34
|
it "returns all bookings joined from many requests" do
|
33
35
|
bookings = client.bookings(per_page: 2, auto_paginate: true)
|
34
|
-
expect(bookings.size).to
|
36
|
+
expect(bookings.size).to eq(4)
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
40
42
|
describe ".booking", :vcr do
|
43
|
+
let(:bookings) {
|
44
|
+
find_resources("#{@casette_base_path}_bookings/returns_bookings.yml", "bookings")
|
45
|
+
}
|
46
|
+
|
41
47
|
it "returns a single booking" do
|
42
|
-
|
48
|
+
prefetched_booking_id = bookings.detect { |b| b["status"] == "Booked" }["id"]
|
49
|
+
booking = client.booking(prefetched_booking_id)
|
43
50
|
expect(booking.status).to eq "Booked"
|
44
51
|
end
|
45
52
|
|
46
53
|
it "returns a single canceled booking" do
|
47
|
-
|
54
|
+
prefetched_canceled_booking_id = bookings.detect { |b| b["status"] == "Canceled" }["id"]
|
55
|
+
booking = client.booking(prefetched_canceled_booking_id, include_canceled: true)
|
48
56
|
expect(booking.status).to eq "Canceled"
|
49
57
|
end
|
50
58
|
end
|
51
59
|
|
52
60
|
describe ".create_booking", :vcr do
|
53
61
|
let(:attributes) {
|
54
|
-
{ start_at: "
|
62
|
+
{ start_at: "2017-01-03", end_at: "2017-01-04",
|
55
63
|
booked: true }
|
56
64
|
}
|
57
|
-
let(:rental) { BookingSync::API::Resource.new(client, id:
|
65
|
+
let(:rental) { BookingSync::API::Resource.new(client, id: 5116) }
|
58
66
|
|
59
67
|
it "creates a booking" do
|
60
68
|
client.create_booking(rental, attributes)
|
61
|
-
assert_requested :post, bs_url("rentals/
|
69
|
+
assert_requested :post, bs_url("rentals/#{rental}/bookings"),
|
62
70
|
body: { bookings: [attributes] }.to_json
|
63
71
|
end
|
64
72
|
|
65
73
|
it "returns newly created booking" do
|
66
74
|
VCR.use_cassette("BookingSync_API_Client_Bookings/_create_booking/creates_a_booking") do
|
67
75
|
booking = client.create_booking(rental, attributes)
|
68
|
-
expect(booking.
|
69
|
-
expect(booking.
|
76
|
+
expect(booking.links.account).to eq(3837)
|
77
|
+
expect(booking.links.rental).to eq(rental.id)
|
70
78
|
end
|
71
79
|
end
|
72
80
|
end
|
73
81
|
|
74
82
|
describe ".edit_booking", :vcr do
|
83
|
+
let(:created_booking_id) {
|
84
|
+
find_resource("#{@casette_base_path}_create_booking/creates_a_booking.yml", "bookings")[:id]
|
85
|
+
}
|
86
|
+
|
75
87
|
it "updates given booking by ID" do
|
76
|
-
client.edit_booking(
|
77
|
-
assert_requested :put, bs_url("bookings
|
88
|
+
client.edit_booking(created_booking_id, end_at: "2019-03-25 21:45:00 UTC")
|
89
|
+
assert_requested :put, bs_url("bookings/#{created_booking_id}"),
|
78
90
|
body: { bookings: [{ end_at: "2019-03-25 21:45:00 UTC" }] }.to_json
|
79
91
|
end
|
80
92
|
|
81
93
|
it "returns updated booking" do
|
82
94
|
VCR.use_cassette("BookingSync_API_Client_Bookings/_edit_booking/updates_given_booking_by_ID") do
|
83
|
-
booking = client.edit_booking(
|
95
|
+
booking = client.edit_booking(created_booking_id, end_at: "2019-03-25 21:45:00 UTC")
|
84
96
|
expect(booking).to be_kind_of(BookingSync::API::Resource)
|
85
97
|
expect(booking.end_at).to eq(Time.parse("2019-03-25 21:45:00 UTC"))
|
86
98
|
end
|
@@ -88,18 +100,22 @@ describe BookingSync::API::Client::Bookings do
|
|
88
100
|
|
89
101
|
it "updates given booking by Resource object" do
|
90
102
|
VCR.use_cassette("BookingSync_API_Client_Bookings/_edit_booking/updates_given_booking_by_ID") do
|
91
|
-
resource = BookingSync::API::Resource.new(nil, id:
|
103
|
+
resource = BookingSync::API::Resource.new(nil, id: created_booking_id)
|
92
104
|
client.edit_booking(resource, end_at: "2019-03-25 21:45:00 UTC")
|
93
|
-
assert_requested :put, bs_url("bookings
|
105
|
+
assert_requested :put, bs_url("bookings/#{resource}"),
|
94
106
|
body: { bookings: [{ end_at: "2019-03-25 21:45:00 UTC" }] }.to_json
|
95
107
|
end
|
96
108
|
end
|
97
109
|
end
|
98
110
|
|
99
111
|
describe ".cancel_booking", :vcr do
|
112
|
+
let(:created_booking_id) {
|
113
|
+
find_resource("#{@casette_base_path}_create_booking/creates_a_booking.yml", "bookings")[:id]
|
114
|
+
}
|
115
|
+
|
100
116
|
it "cancels given booking" do
|
101
|
-
client.cancel_booking(
|
102
|
-
assert_requested :delete, bs_url("bookings
|
117
|
+
client.cancel_booking(created_booking_id)
|
118
|
+
assert_requested :delete, bs_url("bookings/#{created_booking_id}")
|
103
119
|
end
|
104
120
|
end
|
105
121
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::BookingsTaxes 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 ".bookings_taxes", :vcr do
|
7
9
|
it "returns bookings taxes" do
|
8
10
|
expect(client.bookings_taxes).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::BookingsTaxes do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".bookings_tax", :vcr do
|
16
|
+
let(:prefetched_bookings_tax_id) {
|
17
|
+
find_resource("#{@casette_base_path}_bookings_taxes/returns_bookings_taxes.yml", "bookings_taxes")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single bookings_tax" do
|
15
|
-
bookings_tax = client.bookings_tax(
|
16
|
-
expect(bookings_tax.id).to eq
|
21
|
+
bookings_tax = client.bookings_tax(prefetched_bookings_tax_id)
|
22
|
+
expect(bookings_tax.id).to eq prefetched_bookings_tax_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::ChangeOvers 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 ".change_overs", :vcr do
|
7
9
|
it "returns change_overs" do
|
8
10
|
expect(client.change_overs).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::ChangeOvers do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".change_over", :vcr do
|
16
|
+
let(:prefetched_change_over_id) {
|
17
|
+
find_resource("#{@casette_base_path}_change_overs/returns_change_overs.yml", "change_overs")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single change_over" do
|
15
|
-
change_over = client.change_over(
|
16
|
-
expect(change_over.id).to eq
|
21
|
+
change_over = client.change_over(prefetched_change_over_id)
|
22
|
+
expect(change_over.id).to eq prefetched_change_over_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Clients do
|
4
4
|
let(:api) { 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 ".clients", :vcr do
|
7
9
|
it "returns clients" do
|
8
10
|
expect(api.clients).not_to be_empty
|
@@ -11,19 +13,23 @@ describe BookingSync::API::Client::Clients do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".client", :vcr do
|
16
|
+
let(:prefetched_client_id) {
|
17
|
+
find_resource("#{@casette_base_path}_clients/returns_clients.yml", "clients")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single client" do
|
15
|
-
client = api.client(
|
16
|
-
expect(client.id).to eq
|
21
|
+
client = api.client(prefetched_client_id)
|
22
|
+
expect(client.id).to eq prefetched_client_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
26
|
describe ".create_client", :vcr do
|
21
27
|
let(:attributes) do
|
22
28
|
{
|
23
|
-
fullname: "
|
24
|
-
emails: [{ label: "default", email: "
|
25
|
-
country_code: "
|
26
|
-
city: "
|
29
|
+
fullname: "Halldor Helgason",
|
30
|
+
emails: [{ label: "default", email: "halldor@example.com" }],
|
31
|
+
country_code: "IS",
|
32
|
+
city: "Reykjavik"
|
27
33
|
}
|
28
34
|
end
|
29
35
|
|
@@ -36,24 +42,28 @@ describe BookingSync::API::Client::Clients do
|
|
36
42
|
it "returns newly created client" do
|
37
43
|
VCR.use_cassette("BookingSync_API_Client_Clients/_create_client/creates_a_new_client") do
|
38
44
|
client = api.create_client(attributes)
|
39
|
-
expect(client.emails).to eq [{ label: "default", email: "
|
40
|
-
expect(client.fullname).to eq ("
|
45
|
+
expect(client.emails).to eq [{ label: "default", email: "halldor@example.com" }]
|
46
|
+
expect(client.fullname).to eq ("Halldor Helgason")
|
41
47
|
end
|
42
48
|
end
|
43
49
|
end
|
44
50
|
|
45
51
|
describe ".edit_client", :vcr do
|
52
|
+
let(:created_client_id) {
|
53
|
+
find_resource("#{@casette_base_path}_create_client/creates_a_new_client.yml", "clients")[:id]
|
54
|
+
}
|
55
|
+
|
46
56
|
it "updates given client by ID" do
|
47
|
-
api.edit_client(
|
48
|
-
assert_requested :put, bs_url("clients
|
49
|
-
body: { clients: [{ fullname: "
|
57
|
+
api.edit_client(created_client_id, fullname: "Knut Eljassen")
|
58
|
+
assert_requested :put, bs_url("clients/#{created_client_id}"),
|
59
|
+
body: { clients: [{ fullname: "Knut Eljassen" }] }.to_json
|
50
60
|
end
|
51
61
|
|
52
62
|
it "returns updated client" do
|
53
63
|
VCR.use_cassette("BookingSync_API_Client_Clients/_edit_client/updates_given_client_by_ID") do
|
54
|
-
client = api.edit_client(
|
64
|
+
client = api.edit_client(created_client_id, fullname: "Knut Eljassen")
|
55
65
|
expect(client).to be_kind_of(BookingSync::API::Resource)
|
56
|
-
expect(client.fullname).to eq("
|
66
|
+
expect(client.fullname).to eq("Knut Eljassen")
|
57
67
|
end
|
58
68
|
end
|
59
69
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Destinations 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 ".destinations", :vcr do
|
7
9
|
it "returns destinations" do
|
8
10
|
expect(client.destinations).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::Destinations do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".destination", :vcr do
|
16
|
+
let(:prefetched_destination_id) {
|
17
|
+
find_resource("#{@casette_base_path}_destinations/returns_destinations.yml", "destinations")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single destination" do
|
15
|
-
destination = client.destination(
|
16
|
-
expect(destination.id).to eq
|
21
|
+
destination = client.destination(prefetched_destination_id)
|
22
|
+
expect(destination.id).to eq prefetched_destination_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Fees 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 ".fees", :vcr do
|
7
9
|
it "returns fees" do
|
8
10
|
expect(client.fees).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::Fees do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".fee", :vcr do
|
16
|
+
let(:prefetched_fee_id) {
|
17
|
+
find_resource("#{@casette_base_path}_fees/returns_fees.yml", "fees")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single fee" do
|
15
|
-
fee = client.fee(
|
16
|
-
expect(fee.id).to eq
|
21
|
+
fee = client.fee(prefetched_fee_id)
|
22
|
+
expect(fee.id).to eq prefetched_fee_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Inquiries 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 ".inquiries", :vcr do
|
7
9
|
it "returns inquiries" do
|
8
10
|
expect(client.inquiries).not_to be_empty
|
@@ -11,16 +13,19 @@ describe BookingSync::API::Client::Inquiries do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".inquiry", :vcr do
|
16
|
+
let(:prefetched_inquiry_id) {
|
17
|
+
find_resource("#{@casette_base_path}_inquiries/returns_inquiries.yml", "inquiries")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single inquiry" do
|
15
|
-
inquiry = client.inquiry(
|
16
|
-
expect(inquiry.id).to eq
|
21
|
+
inquiry = client.inquiry(prefetched_inquiry_id)
|
22
|
+
expect(inquiry.id).to eq prefetched_inquiry_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
26
|
describe ".create_inquiry", :vcr do
|
21
27
|
let(:attributes) do
|
22
28
|
{
|
23
|
-
rental_id: 7,
|
24
29
|
start_at: Time.now,
|
25
30
|
end_at: Time.now + 86400, # one day
|
26
31
|
firstname: "John",
|
@@ -28,19 +33,20 @@ describe BookingSync::API::Client::Inquiries do
|
|
28
33
|
email: "john@example.com"
|
29
34
|
}
|
30
35
|
end
|
31
|
-
let(:rental) { BookingSync::API::Resource.new(client, id:
|
36
|
+
let(:rental) { BookingSync::API::Resource.new(client, id: 5116) }
|
37
|
+
|
32
38
|
|
33
39
|
it "creates a new inquiry" do
|
34
40
|
client.create_inquiry(rental, attributes)
|
35
|
-
assert_requested :post, bs_url("rentals/
|
41
|
+
assert_requested :post, bs_url("rentals/#{rental}/inquiries"),
|
36
42
|
body: { inquiries: [attributes] }.to_json
|
37
43
|
end
|
38
44
|
|
39
45
|
it "returns newly created inquiry" do
|
40
46
|
VCR.use_cassette("BookingSync_API_Client_Inquiries/_create_inquiry/creates_a_new_inquiry") do
|
41
47
|
inquiry = client.create_inquiry(rental, attributes)
|
42
|
-
expect(inquiry.
|
43
|
-
expect(inquiry.firstname).to
|
48
|
+
expect(inquiry.links.rental).to eq(rental.id)
|
49
|
+
expect(inquiry.firstname).to eq("John")
|
44
50
|
end
|
45
51
|
end
|
46
52
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::LivingRooms 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 ".living_rooms", :vcr do
|
7
9
|
it "returns living_rooms" do
|
8
10
|
expect(client.living_rooms).not_to be_empty
|
@@ -11,19 +13,23 @@ describe BookingSync::API::Client::LivingRooms do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".living_room", :vcr do
|
16
|
+
let(:prefetched_living_room_id) {
|
17
|
+
find_resource("#{@casette_base_path}_living_rooms/returns_living_rooms.yml", "living_rooms")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single living_room" do
|
15
|
-
living_room = client.living_room(
|
16
|
-
expect(living_room.id).to eq
|
21
|
+
living_room = client.living_room(prefetched_living_room_id)
|
22
|
+
expect(living_room.id).to eq prefetched_living_room_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
26
|
describe ".create_living_room", :vcr do
|
21
27
|
let(:attributes) { { sofa_beds_count: 2 } }
|
22
|
-
let(:rental) { BookingSync::API::Resource.new(client, id:
|
28
|
+
let(:rental) { BookingSync::API::Resource.new(client, id: 5116) }
|
23
29
|
|
24
30
|
it "creates a new living_room" do
|
25
31
|
client.create_living_room(rental, attributes)
|
26
|
-
assert_requested :post, bs_url("rentals/
|
32
|
+
assert_requested :post, bs_url("rentals/#{rental}/living_rooms"),
|
27
33
|
body: { living_rooms: [attributes] }.to_json
|
28
34
|
end
|
29
35
|
|
@@ -37,16 +43,19 @@ describe BookingSync::API::Client::LivingRooms do
|
|
37
43
|
|
38
44
|
describe ".edit_living_room", :vcr do
|
39
45
|
let(:attributes) { { sofa_beds_count: 3 } }
|
46
|
+
let(:created_living_room_id) {
|
47
|
+
find_resource("#{@casette_base_path}_create_living_room/creates_a_new_living_room.yml", "living_rooms")[:id]
|
48
|
+
}
|
40
49
|
|
41
50
|
it "updates given living_room by ID" do
|
42
|
-
client.edit_living_room(
|
43
|
-
assert_requested :put, bs_url("living_rooms
|
51
|
+
client.edit_living_room(created_living_room_id, attributes)
|
52
|
+
assert_requested :put, bs_url("living_rooms/#{created_living_room_id}"),
|
44
53
|
body: { living_rooms: [attributes] }.to_json
|
45
54
|
end
|
46
55
|
|
47
56
|
it "returns updated living_room" do
|
48
57
|
VCR.use_cassette("BookingSync_API_Client_LivingRooms/_edit_living_room/updates_given_living_room_by_ID") do
|
49
|
-
living_room = client.edit_living_room(
|
58
|
+
living_room = client.edit_living_room(created_living_room_id, attributes)
|
50
59
|
expect(living_room).to be_kind_of(BookingSync::API::Resource)
|
51
60
|
expect(living_room.sofa_beds_count).to eq(attributes[:sofa_beds_count])
|
52
61
|
end
|
@@ -54,9 +63,13 @@ describe BookingSync::API::Client::LivingRooms do
|
|
54
63
|
end
|
55
64
|
|
56
65
|
describe ".cancel_living_room", :vcr do
|
66
|
+
let(:created_living_room_id) {
|
67
|
+
find_resource("#{@casette_base_path}_create_living_room/creates_a_new_living_room.yml", "living_rooms")[:id]
|
68
|
+
}
|
69
|
+
|
57
70
|
it "cancels given living_room" do
|
58
|
-
client.cancel_living_room(
|
59
|
-
assert_requested :delete, bs_url("living_rooms
|
71
|
+
client.cancel_living_room(created_living_room_id)
|
72
|
+
assert_requested :delete, bs_url("living_rooms/#{created_living_room_id}")
|
60
73
|
end
|
61
74
|
end
|
62
75
|
end
|