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::NightlyRateMaps 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 ".nightly_rate_maps", :vcr do
|
7
9
|
it "returns nightly_rate_maps" do
|
8
10
|
expect(client.nightly_rate_maps).not_to be_empty
|
@@ -11,24 +13,31 @@ describe BookingSync::API::Client::NightlyRateMaps do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".nightly_rate_map", :vcr do
|
16
|
+
let(:prefetched_nightly_rate_map_id) {
|
17
|
+
find_resource("#{@casette_base_path}_nightly_rate_maps/returns_nightly_rate_maps.yml", "nightly_rate_maps")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single nightly_rate_map" do
|
15
|
-
nightly_rate_map = client.nightly_rate_map(
|
16
|
-
expect(nightly_rate_map.id).to eq
|
21
|
+
nightly_rate_map = client.nightly_rate_map(prefetched_nightly_rate_map_id)
|
22
|
+
expect(nightly_rate_map.id).to eq prefetched_nightly_rate_map_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
26
|
describe ".edit_nightly_rate_map", :vcr do
|
21
|
-
let(:attributes) { { rates_map: (["10"] * 1096).join(",") } }
|
27
|
+
let(:attributes) { { rates_map: (["10"] * 1096).join(","), start_date: "2016-12-11" } }
|
28
|
+
let(:prefetched_nightly_rate_map_id) {
|
29
|
+
find_resource("#{@casette_base_path}_nightly_rate_maps/returns_nightly_rate_maps.yml", "nightly_rate_maps")[:id]
|
30
|
+
}
|
22
31
|
|
23
32
|
it "updates given nightly_rate_map by ID" do
|
24
|
-
client.edit_nightly_rate_map(
|
25
|
-
assert_requested :put, bs_url("nightly_rate_maps
|
33
|
+
client.edit_nightly_rate_map(prefetched_nightly_rate_map_id, attributes)
|
34
|
+
assert_requested :put, bs_url("nightly_rate_maps/#{prefetched_nightly_rate_map_id}"),
|
26
35
|
body: { nightly_rate_maps: [attributes] }.to_json
|
27
36
|
end
|
28
37
|
|
29
38
|
it "returns updated nightly_rate_map" do
|
30
39
|
VCR.use_cassette("BookingSync_API_Client_NightlyRateMaps/_edit_nightly_rate_map/updates_given_nightly_rate_map_by_ID") do
|
31
|
-
nightly_rate_map = client.edit_nightly_rate_map(
|
40
|
+
nightly_rate_map = client.edit_nightly_rate_map(prefetched_nightly_rate_map_id, attributes)
|
32
41
|
expect(nightly_rate_map).to be_kind_of(BookingSync::API::Resource)
|
33
42
|
expect(nightly_rate_map.rates_map).to eq attributes[:rates_map]
|
34
43
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::PaymentGateways 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 ".payment_gateways", :vcr do
|
7
9
|
it "returns payment gateways" do
|
8
10
|
expect(client.payment_gateways).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::PaymentGateways do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".payment_gateway", :vcr do
|
16
|
+
let(:prefetched_payment_gateway_id) {
|
17
|
+
find_resource("#{@casette_base_path}_payment_gateways/returns_payment_gateways.yml", "payment_gateways")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single payment gateway" do
|
15
|
-
payment_gateway = client.payment_gateway(
|
16
|
-
expect(payment_gateway.id).to eq
|
21
|
+
payment_gateway = client.payment_gateway(prefetched_payment_gateway_id)
|
22
|
+
expect(payment_gateway.id).to eq prefetched_payment_gateway_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Payments 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 ".payments", :vcr do
|
7
9
|
it "returns payments" do
|
8
10
|
expect(api.payments).not_to be_empty
|
@@ -11,50 +13,66 @@ describe BookingSync::API::Client::Payments do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".payment", :vcr do
|
16
|
+
let(:prefetched_payment_id) {
|
17
|
+
find_resource("#{@casette_base_path}_payments/returns_payments.yml", "payments")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single payment" do
|
15
|
-
payment = api.payment(
|
16
|
-
expect(payment.id).to eq
|
21
|
+
payment = api.payment(prefetched_payment_id)
|
22
|
+
expect(payment.id).to eq prefetched_payment_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
26
|
describe ".create_payment", :vcr do
|
21
|
-
let(:
|
27
|
+
let(:booking_id) do
|
28
|
+
bookings = find_resources("#{casette_dir}/BookingSync_API_Client_Bookings/_bookings/returns_bookings.yml", "bookings")
|
29
|
+
bookings.detect { |b| b["status"] == "Booked" }["id"]
|
30
|
+
end
|
31
|
+
let(:attributes) { { amount_in_cents: 200, kind: "cash", paid_at: "2016-12-06T11:34:05Z" } }
|
22
32
|
|
23
33
|
it "creates a new payment" do
|
24
|
-
api.create_payment(
|
25
|
-
assert_requested :post, bs_url("payments"),
|
26
|
-
body: {
|
34
|
+
api.create_payment(booking_id, attributes)
|
35
|
+
assert_requested :post, bs_url("bookings/#{booking_id}/payments"),
|
36
|
+
body: { payments: [attributes] }.to_json
|
27
37
|
end
|
28
38
|
|
29
39
|
it "returns newly created payment" do
|
30
40
|
VCR.use_cassette("BookingSync_API_Client_Payments/_create_payment/creates_a_new_payment") do
|
31
|
-
payment = api.create_payment(
|
32
|
-
expect(payment.
|
33
|
-
expect(payment.kind).to
|
41
|
+
payment = api.create_payment(booking_id, attributes)
|
42
|
+
expect(payment.amount_in_cents).to eq(200)
|
43
|
+
expect(payment.kind).to eq("cash")
|
34
44
|
end
|
35
45
|
end
|
36
46
|
end
|
37
47
|
|
38
48
|
describe ".edit_payment", :vcr do
|
49
|
+
let(:created_payment_id) {
|
50
|
+
find_resource("#{@casette_base_path}_create_payment/creates_a_new_payment.yml", "payments")[:id]
|
51
|
+
}
|
52
|
+
|
39
53
|
it "updates given payment by ID" do
|
40
|
-
api.edit_payment(
|
41
|
-
assert_requested :put, bs_url("payments
|
42
|
-
body: { payments: [{ kind: "
|
54
|
+
api.edit_payment(created_payment_id, kind: "cheque")
|
55
|
+
assert_requested :put, bs_url("payments/#{created_payment_id}"),
|
56
|
+
body: { payments: [{ kind: "cheque" }] }.to_json
|
43
57
|
end
|
44
58
|
|
45
59
|
it "returns updated payment" do
|
46
60
|
VCR.use_cassette("BookingSync_API_Client_Payments/_edit_payment/updates_given_payment_by_ID") do
|
47
|
-
payment = api.edit_payment(
|
61
|
+
payment = api.edit_payment(created_payment_id, kind: "cheque")
|
48
62
|
expect(payment).to be_kind_of(BookingSync::API::Resource)
|
49
|
-
expect(payment.kind).to eq("
|
63
|
+
expect(payment.kind).to eq("cheque")
|
50
64
|
end
|
51
65
|
end
|
52
66
|
end
|
53
67
|
|
54
68
|
describe ".cancel_payment", :vcr do
|
69
|
+
let(:created_payment_id) {
|
70
|
+
find_resource("#{@casette_base_path}_create_payment/creates_a_new_payment.yml", "payments")[:id]
|
71
|
+
}
|
72
|
+
|
55
73
|
it "cancels given payment" do
|
56
|
-
api.cancel_payment(
|
57
|
-
assert_requested :delete, bs_url("payments
|
74
|
+
api.cancel_payment(created_payment_id)
|
75
|
+
assert_requested :delete, bs_url("payments/#{created_payment_id}")
|
58
76
|
end
|
59
77
|
end
|
60
78
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Periods 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 ".periods", :vcr do
|
7
9
|
it "returns periods" do
|
8
10
|
expect(client.periods).not_to be_empty
|
@@ -11,53 +13,66 @@ describe BookingSync::API::Client::Periods do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".period", :vcr do
|
16
|
+
let(:prefetched_period_id) {
|
17
|
+
find_resource("#{@casette_base_path}_periods/returns_periods.yml", "periods")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single period" do
|
15
|
-
period = client.period(
|
16
|
-
expect(period.id).to eq
|
21
|
+
period = client.period(prefetched_period_id)
|
22
|
+
expect(period.id).to eq prefetched_period_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
26
|
describe ".create_period", :vcr do
|
21
|
-
let(:attributes) { {
|
22
|
-
let(:season) {
|
27
|
+
let(:attributes) { { start_date: "2017-04-10", end_date: "2017-04-22" } }
|
28
|
+
let(:season) {
|
29
|
+
find_resource("#{casette_dir}/BookingSync_API_Client_Seasons/_seasons/returns_seasons.yml", "seasons")
|
30
|
+
}
|
23
31
|
|
24
32
|
it "creates a new period" do
|
25
33
|
client.create_period(season, attributes)
|
26
|
-
assert_requested :post, bs_url("seasons/
|
34
|
+
assert_requested :post, bs_url("seasons/#{season}/periods"),
|
27
35
|
body: { periods: [attributes] }.to_json
|
28
36
|
end
|
29
37
|
|
30
38
|
it "returns newly created period" do
|
31
39
|
VCR.use_cassette("BookingSync_API_Client_Periods/_create_period/creates_a_new_period") do
|
32
40
|
period = client.create_period(season, attributes)
|
33
|
-
expect(period.
|
34
|
-
expect(period.
|
41
|
+
expect(period.start_date).to eq(Time.parse(attributes[:start_date]))
|
42
|
+
expect(period.end_date).to eq(Time.parse(attributes[:end_date]))
|
35
43
|
end
|
36
44
|
end
|
37
45
|
end
|
38
46
|
|
39
47
|
describe ".edit_period", :vcr do
|
40
|
-
let(:attributes) { {
|
48
|
+
let(:attributes) { { end_date: "2017-07-15" } }
|
49
|
+
let(:created_period_id) {
|
50
|
+
find_resource("#{@casette_base_path}_create_period/creates_a_new_period.yml", "periods")[:id]
|
51
|
+
}
|
41
52
|
|
42
53
|
it "updates given period by ID" do
|
43
|
-
client.edit_period(
|
44
|
-
assert_requested :put, bs_url("periods
|
54
|
+
client.edit_period(created_period_id, attributes)
|
55
|
+
assert_requested :put, bs_url("periods/#{created_period_id}"),
|
45
56
|
body: { periods: [attributes] }.to_json
|
46
57
|
end
|
47
58
|
|
48
59
|
it "returns updated period" do
|
49
60
|
VCR.use_cassette("BookingSync_API_Client_Periods/_edit_period/updates_given_period_by_ID") do
|
50
|
-
period = client.edit_period(
|
61
|
+
period = client.edit_period(created_period_id, attributes)
|
51
62
|
expect(period).to be_kind_of(BookingSync::API::Resource)
|
52
|
-
expect(period.
|
63
|
+
expect(period.end_date).to eq(Time.parse(attributes[:end_date]))
|
53
64
|
end
|
54
65
|
end
|
55
66
|
end
|
56
67
|
|
57
68
|
describe ".delete_period", :vcr do
|
69
|
+
let(:created_period_id) {
|
70
|
+
find_resource("#{@casette_base_path}_create_period/creates_a_new_period.yml", "periods")[:id]
|
71
|
+
}
|
72
|
+
|
58
73
|
it "deletes given period" do
|
59
|
-
client.delete_period(
|
60
|
-
assert_requested :delete, bs_url("periods
|
74
|
+
client.delete_period(created_period_id)
|
75
|
+
assert_requested :delete, bs_url("periods/#{created_period_id}")
|
61
76
|
end
|
62
77
|
end
|
63
78
|
end
|
@@ -2,7 +2,9 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe BookingSync::API::Client::Photos do
|
4
4
|
let(:client) { BookingSync::API::Client.new(test_access_token) }
|
5
|
-
let(:rental) { BookingSync::API::Resource.new(client, id:
|
5
|
+
let(:rental) { BookingSync::API::Resource.new(client, id: 5116) }
|
6
|
+
|
7
|
+
before { |ex| @casette_base_path = casette_path(casette_dir, ex.metadata) }
|
6
8
|
|
7
9
|
describe ".photos", :vcr do
|
8
10
|
it "returns photos" do
|
@@ -12,9 +14,13 @@ describe BookingSync::API::Client::Photos do
|
|
12
14
|
end
|
13
15
|
|
14
16
|
describe ".photo", :vcr do
|
17
|
+
let(:prefetched_photo_id) {
|
18
|
+
find_resource("#{@casette_base_path}_photos/returns_photos.yml", "photos")[:id]
|
19
|
+
}
|
20
|
+
|
15
21
|
it "returns a single photo" do
|
16
|
-
photo = client.photo(
|
17
|
-
expect(photo.id).to eq
|
22
|
+
photo = client.photo(prefetched_photo_id)
|
23
|
+
expect(photo.id).to eq prefetched_photo_id
|
18
24
|
end
|
19
25
|
end
|
20
26
|
|
@@ -26,7 +32,7 @@ describe BookingSync::API::Client::Photos do
|
|
26
32
|
|
27
33
|
it "creates a photo with photo path" do
|
28
34
|
photo = client.create_photo(rental, attributes)
|
29
|
-
assert_requested :post, bs_url("rentals/
|
35
|
+
assert_requested :post, bs_url("rentals/#{rental}/photos"),
|
30
36
|
body: { photos: [attributes] }.to_json
|
31
37
|
expect(photo.kind).to eq("livingroom")
|
32
38
|
end
|
@@ -34,7 +40,7 @@ describe BookingSync::API::Client::Photos do
|
|
34
40
|
it "creates a photo with encoded photo file" do
|
35
41
|
encoded = Base64.encode64(File.read("spec/fixtures/files/test.jpg"))
|
36
42
|
photo = client.create_photo(rental, photo: encoded, kind: "livingroom")
|
37
|
-
assert_requested :post, bs_url("rentals/
|
43
|
+
assert_requested :post, bs_url("rentals/#{rental}/photos"),
|
38
44
|
body: { photos: [photo: encoded, kind: "livingroom"] }.to_json
|
39
45
|
expect(photo.kind).to eq("livingroom")
|
40
46
|
end
|
@@ -43,7 +49,7 @@ describe BookingSync::API::Client::Photos do
|
|
43
49
|
remote_url = "https://www.ruby-lang.org/images/header-ruby-logo.png"
|
44
50
|
photo = client.create_photo(rental, remote_photo_url: remote_url,
|
45
51
|
kind: "livingroom")
|
46
|
-
assert_requested :post, bs_url("rentals/
|
52
|
+
assert_requested :post, bs_url("rentals/#{rental}/photos"),
|
47
53
|
body: { photos: [remote_photo_url: remote_url, kind: "livingroom"] }.to_json
|
48
54
|
expect(photo.kind).to eq("livingroom")
|
49
55
|
end
|
@@ -58,20 +64,28 @@ describe BookingSync::API::Client::Photos do
|
|
58
64
|
end
|
59
65
|
|
60
66
|
describe ".edit_photo", :vcr do
|
67
|
+
let(:created_photo_id) {
|
68
|
+
find_resource("#{@casette_base_path}_create_photo/creates_a_photo_with_photo_path.yml", "photos")[:id]
|
69
|
+
}
|
70
|
+
|
61
71
|
it "updates photo's description" do
|
62
|
-
photo = client.edit_photo(
|
72
|
+
photo = client.edit_photo(created_photo_id, description_en: "Not funny anymore")
|
63
73
|
expect(photo.description.en).to eq("Not funny anymore")
|
64
74
|
end
|
65
75
|
|
66
76
|
it "updates photo's image file" do
|
67
|
-
photo = client.edit_photo(
|
77
|
+
photo = client.edit_photo(created_photo_id, file_path: "spec/fixtures/files/test.jpg")
|
68
78
|
expect(photo.description.en).to eq("Not funny anymore")
|
69
79
|
end
|
70
80
|
end
|
71
81
|
|
72
82
|
describe ".delete_photo", :vcr do
|
83
|
+
let(:created_photo_id) {
|
84
|
+
find_resource("#{@casette_base_path}_create_photo/creates_a_photo_with_photo_path.yml", "photos")[:id]
|
85
|
+
}
|
86
|
+
|
73
87
|
it "delete given photo" do
|
74
|
-
expect(client.delete_photo(
|
88
|
+
expect(client.delete_photo(created_photo_id)).to be_nil
|
75
89
|
end
|
76
90
|
end
|
77
91
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::PreferencesGeneralSettings 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 ".preferences_general_settings", :vcr do
|
7
9
|
it "returns preferences_general_settings" do
|
8
10
|
expect(api.preferences_general_settings).not_to be_empty
|
@@ -11,17 +13,22 @@ describe BookingSync::API::Client::PreferencesGeneralSettings do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".edit_preferences_general_setting", :vcr do
|
16
|
+
let(:prefetched_preferences_general_settings_id) {
|
17
|
+
find_resource("#{@casette_base_path}_preferences_general_settings/returns_preferences_general_settings.yml",
|
18
|
+
"preferences_general_settings")[:id]
|
19
|
+
}
|
20
|
+
|
14
21
|
it "updates given preferences_general_setting by ID" do
|
15
|
-
api.edit_preferences_general_setting(
|
16
|
-
assert_requested :put, bs_url("preferences_general_settings
|
22
|
+
api.edit_preferences_general_setting(prefetched_preferences_general_settings_id, selected_locales: ["de"])
|
23
|
+
assert_requested :put, bs_url("preferences_general_settings/#{prefetched_preferences_general_settings_id}"),
|
17
24
|
body: { preferences_general_settings: [{ selected_locales: ["de"] }] }.to_json
|
18
25
|
end
|
19
26
|
|
20
27
|
it "returns updated preferences_general_setting" do
|
21
28
|
VCR.use_cassette("BookingSync_API_Client_PreferencesGeneralSettings/_edit_preferences_general_setting/updates_given_preferences_general_setting_by_ID") do
|
22
|
-
setting = api.edit_preferences_general_setting(
|
29
|
+
setting = api.edit_preferences_general_setting(prefetched_preferences_general_settings_id, selected_locales: ["de"])
|
23
30
|
expect(setting).to be_kind_of(BookingSync::API::Resource)
|
24
|
-
expect(setting.selected_locales).to eq ["en", "de"]
|
31
|
+
expect(setting.selected_locales).to eq ["en", "fr", "de"]
|
25
32
|
end
|
26
33
|
end
|
27
34
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::RatesRules 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 ".rates_rules", :vcr do
|
7
9
|
it "returns rates rules" do
|
8
10
|
expect(client.rates_rules).not_to be_empty
|
@@ -11,17 +13,21 @@ describe BookingSync::API::Client::RatesRules do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".rates_rule", :vcr do
|
16
|
+
let(:prefetched_rates_rule_id) {
|
17
|
+
find_resource("#{@casette_base_path}_rates_rules/returns_rates_rules.yml", "rates_rules")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single rates_rule" do
|
15
|
-
rates_rule = client.rates_rule(
|
16
|
-
expect(rates_rule.id).to eq
|
21
|
+
rates_rule = client.rates_rule(prefetched_rates_rule_id)
|
22
|
+
expect(rates_rule.id).to eq prefetched_rates_rule_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
26
|
describe ".create_rates_rule", :vcr do
|
21
27
|
let(:attributes) do
|
22
28
|
{
|
23
|
-
start_date: "
|
24
|
-
end_date: "
|
29
|
+
start_date: "2017-04-10",
|
30
|
+
end_date: "2017-04-22",
|
25
31
|
kind: "stay_at_least",
|
26
32
|
percentage: 10,
|
27
33
|
variables: { length: 1, unit: "days" }
|
@@ -38,24 +44,27 @@ describe BookingSync::API::Client::RatesRules do
|
|
38
44
|
it "returns newly created rates_rule" do
|
39
45
|
VCR.use_cassette("BookingSync_API_Client_RatesRules/_create_rates_rule/creates_a_new_rates_rule") do
|
40
46
|
rates_rule = client.create_rates_rule(rates_table, attributes)
|
41
|
-
expect(rates_rule.start_date).to
|
42
|
-
expect(rates_rule.end_date).to
|
47
|
+
expect(rates_rule.start_date).to eq(Time.parse(attributes[:start_date]))
|
48
|
+
expect(rates_rule.end_date).to eq(Time.parse(attributes[:end_date]))
|
43
49
|
end
|
44
50
|
end
|
45
51
|
end
|
46
52
|
|
47
53
|
describe ".edit_rates_rule", :vcr do
|
48
|
-
let(:attributes) { { end_date: "
|
54
|
+
let(:attributes) { { start_date: "2017-07-01", end_date: "2017-07-15" } }
|
55
|
+
let(:created_rates_rule_id) {
|
56
|
+
find_resource("#{@casette_base_path}_create_rates_rule/creates_a_new_rates_rule.yml", "rates_rules")[:id]
|
57
|
+
}
|
49
58
|
|
50
59
|
it "updates given rates_rule by ID" do
|
51
|
-
client.edit_rates_rule(
|
52
|
-
assert_requested :put, bs_url("rates_rules
|
60
|
+
client.edit_rates_rule(created_rates_rule_id, attributes)
|
61
|
+
assert_requested :put, bs_url("rates_rules/#{created_rates_rule_id}"),
|
53
62
|
body: { rates_rules: [attributes] }.to_json
|
54
63
|
end
|
55
64
|
|
56
65
|
it "returns updated rates_rule" do
|
57
66
|
VCR.use_cassette("BookingSync_API_Client_RatesRules/_edit_rates_rule/updates_given_rates_rule_by_ID") do
|
58
|
-
rates_rule = client.edit_rates_rule(
|
67
|
+
rates_rule = client.edit_rates_rule(created_rates_rule_id, attributes)
|
59
68
|
expect(rates_rule).to be_kind_of(BookingSync::API::Resource)
|
60
69
|
expect(rates_rule.end_date).to eq(Time.parse(attributes[:end_date]))
|
61
70
|
end
|
@@ -63,9 +72,13 @@ describe BookingSync::API::Client::RatesRules do
|
|
63
72
|
end
|
64
73
|
|
65
74
|
describe ".delete_rates_rule", :vcr do
|
75
|
+
let(:created_rates_rule_id) {
|
76
|
+
find_resource("#{@casette_base_path}_create_rates_rule/creates_a_new_rates_rule.yml", "rates_rules")[:id]
|
77
|
+
}
|
78
|
+
|
66
79
|
it "deletes given rates_rule" do
|
67
|
-
client.delete_rates_rule(
|
68
|
-
assert_requested :delete, bs_url("rates_rules
|
80
|
+
client.delete_rates_rule(created_rates_rule_id)
|
81
|
+
assert_requested :delete, bs_url("rates_rules/#{created_rates_rule_id}")
|
69
82
|
end
|
70
83
|
end
|
71
84
|
end
|