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::Reviews 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 ".reviews", :vcr do
|
7
9
|
it "returns reviews" do
|
8
10
|
expect(client.reviews).not_to be_empty
|
@@ -11,27 +13,31 @@ describe BookingSync::API::Client::Reviews do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".review", :vcr do
|
16
|
+
let(:prefetched_review_id) {
|
17
|
+
find_resource("#{@casette_base_path}_reviews/returns_reviews.yml", "reviews")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single review" do
|
15
|
-
review = client.review(
|
16
|
-
expect(review.id).to eq
|
21
|
+
review = client.review(prefetched_review_id)
|
22
|
+
expect(review.id).to eq prefetched_review_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
26
|
describe ".create_review", :vcr do
|
21
27
|
let(:attributes) { { comment: "Awesome place", rating: 5 } }
|
22
|
-
let(:booking) { BookingSync::API::Resource.new(client, id:
|
28
|
+
let(:booking) { BookingSync::API::Resource.new(client, id: 840059) }
|
23
29
|
|
24
30
|
it "creates a new review" do
|
25
31
|
client.create_review(booking, attributes)
|
26
|
-
assert_requested :post, bs_url("bookings/
|
32
|
+
assert_requested :post, bs_url("bookings/#{booking}/reviews"),
|
27
33
|
body: { reviews: [attributes] }.to_json
|
28
34
|
end
|
29
35
|
|
30
36
|
it "returns newly created review" do
|
31
37
|
VCR.use_cassette("BookingSync_API_Client_Reviews/_create_review/creates_a_new_review") do
|
32
38
|
review = client.create_review(booking, attributes)
|
33
|
-
expect(review.comment).to
|
34
|
-
expect(review.rating).to
|
39
|
+
expect(review.comment).to eq(attributes[:comment])
|
40
|
+
expect(review.rating).to eq(attributes[:rating])
|
35
41
|
end
|
36
42
|
end
|
37
43
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Seasons 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 ".seasons", :vcr do
|
7
9
|
it "returns seasons" do
|
8
10
|
expect(client.seasons).not_to be_empty
|
@@ -11,54 +13,68 @@ describe BookingSync::API::Client::Seasons do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".season", :vcr do
|
16
|
+
let(:prefetched_season_id) {
|
17
|
+
find_resource("#{@casette_base_path}_seasons/returns_seasons.yml", "seasons")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single season" do
|
15
|
-
season = client.season(
|
16
|
-
expect(season.id).to eq
|
21
|
+
season = client.season(prefetched_season_id)
|
22
|
+
expect(season.id).to eq prefetched_season_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
26
|
describe ".create_season", :vcr do
|
21
|
-
let(:attributes) { { name: "New season",
|
22
|
-
let(:rates_table)
|
27
|
+
let(:attributes) { { name: "New season", ratio_percentage: 0.2, minimum_stay: 4 } }
|
28
|
+
let(:rates_table) do
|
29
|
+
find_resource("#{casette_dir}/BookingSync_API_Client_RatesTables/_rates_tables/returns_rates_tables.yml", "rates_tables")
|
30
|
+
end
|
23
31
|
|
24
32
|
it "creates a new season" do
|
25
33
|
client.create_season(rates_table, attributes)
|
26
|
-
assert_requested :post, bs_url("rates_tables/
|
34
|
+
assert_requested :post, bs_url("rates_tables/#{rates_table}/seasons"),
|
27
35
|
body: { seasons: [attributes] }.to_json
|
28
36
|
end
|
29
37
|
|
30
38
|
it "returns newly created season" do
|
31
39
|
VCR.use_cassette("BookingSync_API_Client_Seasons/_create_season/creates_a_new_season") do
|
32
40
|
season = client.create_season(rates_table, attributes)
|
33
|
-
expect(season.name).to
|
34
|
-
expect(season.minimum_stay).to
|
41
|
+
expect(season.name).to eq(en: attributes[:name])
|
42
|
+
expect(season.minimum_stay).to eq(attributes[:minimum_stay])
|
35
43
|
end
|
36
44
|
end
|
37
45
|
end
|
38
46
|
|
39
47
|
describe ".edit_season", :vcr do
|
40
48
|
let(:attributes) {
|
41
|
-
{ name: "Updated season" }
|
49
|
+
{ name: "Updated season name 2" }
|
42
50
|
}
|
51
|
+
let(:created_season_id) {
|
52
|
+
find_resource("#{@casette_base_path}_create_season/creates_a_new_season.yml", "seasons")[:id]
|
53
|
+
}
|
54
|
+
|
43
55
|
it "updates given season by ID" do
|
44
|
-
client.edit_season(
|
45
|
-
assert_requested :put, bs_url("seasons
|
56
|
+
client.edit_season(created_season_id, attributes)
|
57
|
+
assert_requested :put, bs_url("seasons/#{created_season_id}"),
|
46
58
|
body: { seasons: [attributes] }.to_json
|
47
59
|
end
|
48
60
|
|
49
61
|
it "returns updated season" do
|
50
62
|
VCR.use_cassette("BookingSync_API_Client_Seasons/_edit_season/updates_given_season_by_ID") do
|
51
|
-
season = client.edit_season(
|
63
|
+
season = client.edit_season(created_season_id, attributes)
|
52
64
|
expect(season).to be_kind_of(BookingSync::API::Resource)
|
53
|
-
expect(season.name).to eq(attributes[:name])
|
65
|
+
expect(season.name).to eq(en: attributes[:name])
|
54
66
|
end
|
55
67
|
end
|
56
68
|
end
|
57
69
|
|
58
70
|
describe ".delete_season", :vcr do
|
71
|
+
let(:created_season_id) {
|
72
|
+
find_resource("#{@casette_base_path}_create_season/creates_a_new_season.yml", "seasons")[:id]
|
73
|
+
}
|
74
|
+
|
59
75
|
it "deletes given season" do
|
60
|
-
client.delete_season(
|
61
|
-
assert_requested :delete, bs_url("seasons
|
76
|
+
client.delete_season(created_season_id)
|
77
|
+
assert_requested :delete, bs_url("seasons/#{created_season_id}")
|
62
78
|
end
|
63
79
|
end
|
64
80
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Sources 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 ".sources", :vcr do
|
7
9
|
it "returns sources" do
|
8
10
|
expect(client.sources).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::Sources do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".source", :vcr do
|
16
|
+
let(:prefetched_source_id) {
|
17
|
+
find_resource("#{@casette_base_path}_sources/returns_sources.yml", "sources")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single source" do
|
15
|
-
source = client.source(
|
16
|
-
expect(source.id).to eq
|
21
|
+
source = client.source(prefetched_source_id)
|
22
|
+
expect(source.id).to eq prefetched_source_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
@@ -31,27 +37,30 @@ describe BookingSync::API::Client::Sources do
|
|
31
37
|
it "returns newly created source" do
|
32
38
|
VCR.use_cassette("BookingSync_API_Client_Sources/_create_source/creates_a_new_source") do
|
33
39
|
source = client.create_source(attributes)
|
34
|
-
expect(source.name).to
|
40
|
+
expect(source.name).to eq(attributes[:name])
|
35
41
|
end
|
36
42
|
end
|
37
43
|
end
|
38
44
|
|
39
45
|
describe ".edit_source", :vcr do
|
40
46
|
let(:attributes) {
|
41
|
-
{ name: "
|
47
|
+
{ name: "another test source" }
|
48
|
+
}
|
49
|
+
let(:created_source_id) {
|
50
|
+
find_resource("#{@casette_base_path}_create_source/creates_a_new_source.yml", "sources")[:id]
|
42
51
|
}
|
43
52
|
|
44
53
|
it "updates given source by ID" do
|
45
|
-
client.edit_source(
|
46
|
-
assert_requested :put, bs_url("sources
|
54
|
+
client.edit_source(created_source_id, attributes)
|
55
|
+
assert_requested :put, bs_url("sources/#{created_source_id}"),
|
47
56
|
body: { sources: [attributes] }.to_json
|
48
57
|
end
|
49
58
|
|
50
59
|
it "returns updated source" do
|
51
60
|
VCR.use_cassette("BookingSync_API_Client_Sources/_edit_source/updates_given_source_by_ID") do
|
52
|
-
source = client.edit_source(
|
61
|
+
source = client.edit_source(created_source_id, attributes)
|
53
62
|
expect(source).to be_kind_of(BookingSync::API::Resource)
|
54
|
-
expect(source.name).to
|
63
|
+
expect(source.name).to eq(attributes[:name])
|
55
64
|
end
|
56
65
|
end
|
57
66
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::SpecialOffers 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 ".special_offers", :vcr do
|
7
9
|
it "returns special_offers" do
|
8
10
|
expect(client.special_offers).not_to be_empty
|
@@ -11,61 +13,74 @@ describe BookingSync::API::Client::SpecialOffers do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".special_offer", :vcr do
|
16
|
+
let(:prefetched_special_offer_id) {
|
17
|
+
find_resource("#{@casette_base_path}_special_offers/returns_special_offers.yml", "special_offers")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single special_offer" do
|
15
|
-
special_offer = client.special_offer(
|
16
|
-
expect(special_offer.id).to eq
|
21
|
+
special_offer = client.special_offer(prefetched_special_offer_id)
|
22
|
+
expect(special_offer.id).to eq prefetched_special_offer_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
26
|
describe ".create_special_offer", :vcr do
|
21
27
|
let(:attributes) {
|
22
28
|
{
|
23
|
-
|
24
|
-
|
25
|
-
|
29
|
+
name_en: "New special offer",
|
30
|
+
start_date: "2017-04-28",
|
31
|
+
end_date: "2017-05-28",
|
26
32
|
discount: 5
|
27
33
|
}
|
28
34
|
}
|
29
|
-
let(:rental)
|
35
|
+
let(:rental) do
|
36
|
+
find_resource("#{casette_dir}/BookingSync_API_Client_Rentals/_rental/returns_a_single_rental.yml", "rentals")
|
37
|
+
end
|
30
38
|
|
31
39
|
it "creates a new special_offer" do
|
32
40
|
client.create_special_offer(rental, attributes)
|
33
|
-
assert_requested :post, bs_url("rentals/
|
41
|
+
assert_requested :post, bs_url("rentals/#{rental}/special_offers"),
|
34
42
|
body: { special_offers: [attributes] }.to_json
|
35
43
|
end
|
36
44
|
|
37
45
|
it "returns newly created special_offer" do
|
38
46
|
VCR.use_cassette("BookingSync_API_Client_SpecialOffers/_create_special_offer/creates_a_new_special_offer") do
|
39
47
|
special_offer = client.create_special_offer(rental, attributes)
|
40
|
-
expect(special_offer.name).to
|
48
|
+
expect(special_offer.name).to eq(en: attributes[:name_en])
|
41
49
|
end
|
42
50
|
end
|
43
51
|
end
|
44
52
|
|
45
53
|
describe ".edit_special_offer", :vcr do
|
46
54
|
let(:attributes) {
|
47
|
-
{
|
55
|
+
{ name_en: "Updated special offer" }
|
56
|
+
}
|
57
|
+
let(:created_special_offer_id) {
|
58
|
+
find_resource("#{@casette_base_path}_create_special_offer/creates_a_new_special_offer.yml", "special_offers")[:id]
|
48
59
|
}
|
49
60
|
|
50
61
|
it "updates given special_offer by ID" do
|
51
|
-
client.edit_special_offer(
|
52
|
-
assert_requested :put, bs_url("special_offers
|
62
|
+
client.edit_special_offer(created_special_offer_id, attributes)
|
63
|
+
assert_requested :put, bs_url("special_offers/#{created_special_offer_id}"),
|
53
64
|
body: { special_offers: [attributes] }.to_json
|
54
65
|
end
|
55
66
|
|
56
67
|
it "returns updated special_offer" do
|
57
68
|
VCR.use_cassette("BookingSync_API_Client_SpecialOffers/_edit_special_offer/updates_given_special_offer_by_ID") do
|
58
|
-
special_offer = client.edit_special_offer(
|
69
|
+
special_offer = client.edit_special_offer(created_special_offer_id, attributes)
|
59
70
|
expect(special_offer).to be_kind_of(BookingSync::API::Resource)
|
60
|
-
expect(special_offer.name).to eq(attributes[:
|
71
|
+
expect(special_offer.name).to eq(en: attributes[:name_en])
|
61
72
|
end
|
62
73
|
end
|
63
74
|
end
|
64
75
|
|
65
76
|
describe ".delete_special_offer", :vcr do
|
77
|
+
let(:created_special_offer_id) {
|
78
|
+
find_resource("#{@casette_base_path}_create_special_offer/creates_a_new_special_offer.yml", "special_offers")[:id]
|
79
|
+
}
|
80
|
+
|
66
81
|
it "deletes given special_offer" do
|
67
|
-
client.delete_special_offer(
|
68
|
-
assert_requested :delete, bs_url("special_offers
|
82
|
+
client.delete_special_offer(created_special_offer_id)
|
83
|
+
assert_requested :delete, bs_url("special_offers/#{created_special_offer_id}")
|
69
84
|
end
|
70
85
|
end
|
71
86
|
end
|
@@ -6,19 +6,15 @@ describe BookingSync::API::Client::StrictBookings do
|
|
6
6
|
describe ".create_strict_booking", :vcr do
|
7
7
|
let(:params) do
|
8
8
|
{
|
9
|
-
"rental_id" =>
|
10
|
-
"start_at" => "
|
11
|
-
"end_at" => "
|
12
|
-
"adults" =>
|
13
|
-
"children" =>
|
14
|
-
"final_price" => "
|
15
|
-
"price_to_pay_now" => "
|
9
|
+
"rental_id" => 25938,
|
10
|
+
"start_at" => "2017-05-22 16:00:00",
|
11
|
+
"end_at" => "2017-05-29 10:00:00",
|
12
|
+
"adults" => 3,
|
13
|
+
"children" => 2,
|
14
|
+
"final_price" => "63",
|
15
|
+
"price_to_pay_now" => "18.9",
|
16
16
|
"currency" => "EUR",
|
17
|
-
"source_id" => "
|
18
|
-
"bookings_fees" => [
|
19
|
-
{ "rentals_fee_id" => "1", "times_booked" => "1" },
|
20
|
-
{ "rentals_fee_id" => "3", "times_booked" => "1" }
|
21
|
-
],
|
17
|
+
"source_id" => "4504",
|
22
18
|
"client" => {
|
23
19
|
"firstname" => "Lazar",
|
24
20
|
"email" => "email@example.com",
|
@@ -41,8 +37,8 @@ describe BookingSync::API::Client::StrictBookings do
|
|
41
37
|
it "returns newly created booking" do
|
42
38
|
VCR.use_cassette("BookingSync_API_Client_StrictBookings/_create_strict_booking/creates_a_booking") do
|
43
39
|
booking = client.create_strict_booking(params)
|
44
|
-
expect(booking.start_at).to
|
45
|
-
expect(booking.end_at).to
|
40
|
+
expect(booking.start_at).to eq(Time.parse("2017-05-22 16:00:00 UTC"))
|
41
|
+
expect(booking.end_at).to eq(Time.parse("2017-05-29 10:00:00 UTC"))
|
46
42
|
end
|
47
43
|
end
|
48
44
|
end
|
@@ -3,6 +3,8 @@ require "spec_helper"
|
|
3
3
|
describe BookingSync::API::Client::Taxes 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 ".taxes", :vcr do
|
7
9
|
it "returns taxes" do
|
8
10
|
expect(client.taxes).not_to be_empty
|
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::Taxes do
|
|
11
13
|
end
|
12
14
|
|
13
15
|
describe ".tax", :vcr do
|
16
|
+
let(:prefetched_tax_id) {
|
17
|
+
find_resource("#{@casette_base_path}_taxes/returns_taxes.yml", "taxes")[:id]
|
18
|
+
}
|
19
|
+
|
14
20
|
it "returns a single tax" do
|
15
|
-
tax = client.tax(
|
16
|
-
expect(tax.id).to eq
|
21
|
+
tax = client.tax(prefetched_tax_id)
|
22
|
+
expect(tax.id).to eq prefetched_tax_id
|
17
23
|
end
|
18
24
|
end
|
19
25
|
end
|
@@ -6,7 +6,7 @@ describe BookingSync::API::Client do
|
|
6
6
|
describe "#new" do
|
7
7
|
it "initializes client object with given token" do
|
8
8
|
client = BookingSync::API::Client.new("xyz")
|
9
|
-
expect(client.token).to
|
9
|
+
expect(client.token).to eq("xyz")
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -80,7 +80,7 @@ describe BookingSync::API::Client do
|
|
80
80
|
response = double(BookingSync::API::Response)
|
81
81
|
allow(client).to receive(:call) { response }
|
82
82
|
resources = client.request(:get, "resource")
|
83
|
-
expect(resources).to
|
83
|
+
expect(resources).to eq(response)
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
@@ -167,7 +167,7 @@ describe BookingSync::API::Client do
|
|
167
167
|
expect {
|
168
168
|
client.get("resource")
|
169
169
|
}.to raise_error(BookingSync::API::UnsupportedResponse) { |error|
|
170
|
-
expect(error.status).to
|
170
|
+
expect(error.status).to eq(405)
|
171
171
|
expect(error.headers).to eq("content-type" => "application/vnd.api+json")
|
172
172
|
expect(error.body).to eq("Whoops!")
|
173
173
|
expect(error.message).to include("Received unsupported response from BookingSync API")
|
@@ -216,7 +216,7 @@ describe BookingSync::API::Client do
|
|
216
216
|
describe "#api_endpoint" do
|
217
217
|
it "returns URL to the API" do
|
218
218
|
ENV["BOOKINGSYNC_URL"] = nil
|
219
|
-
expect(client.api_endpoint).to
|
219
|
+
expect(client.api_endpoint).to eq("https://www.bookingsync.com/api/v3")
|
220
220
|
end
|
221
221
|
|
222
222
|
context "user specifies base URL via BOOKINGSYNC_URL env" do
|
@@ -229,7 +229,7 @@ describe BookingSync::API::Client do
|
|
229
229
|
end
|
230
230
|
|
231
231
|
it "returns custom URL to the API" do
|
232
|
-
expect(client.api_endpoint).to
|
232
|
+
expect(client.api_endpoint).to eq("https://bookingsync.dev/api/v3")
|
233
233
|
end
|
234
234
|
end
|
235
235
|
end
|
@@ -275,7 +275,7 @@ describe BookingSync::API::Client do
|
|
275
275
|
it "returns last response" do
|
276
276
|
stub_get("resources", body: { meta: { count: 10 }, resources: [] }.to_json)
|
277
277
|
client.get("resources")
|
278
|
-
expect(client.last_response.meta).to
|
278
|
+
expect(client.last_response.meta).to eq(count: 10)
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
@@ -288,7 +288,23 @@ describe BookingSync::API::Client do
|
|
288
288
|
describe "#pagination_first_response" do
|
289
289
|
it "returns first response of a paginated call" do
|
290
290
|
client.paginate("resources", auto_paginate: true)
|
291
|
-
expect(client.pagination_first_response.meta).to
|
291
|
+
expect(client.pagination_first_response.meta).to eq(text: "first request")
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
describe "with block" do
|
296
|
+
before do
|
297
|
+
stub_get("resources?per_page=50", headers: {}, body: { meta: { text: "first request" }, resources: [{ id: 1 }] }.to_json)
|
298
|
+
end
|
299
|
+
|
300
|
+
context "when there is only one page with results" do
|
301
|
+
it "invokes block" do
|
302
|
+
block = double("block")
|
303
|
+
expect(block).to receive(:do_stuff)
|
304
|
+
client.paginate("resources", per_page: 50) do |batch|
|
305
|
+
block.do_stuff
|
306
|
+
end
|
307
|
+
end
|
292
308
|
end
|
293
309
|
end
|
294
310
|
end
|
@@ -13,7 +13,7 @@ describe BookingSync::API::Relation do
|
|
13
13
|
describe ".from_links" do
|
14
14
|
it "returns a hash of relations" do
|
15
15
|
relations = BookingSync::API::Relation.from_links(client, links)
|
16
|
-
expect(relations.size).to
|
16
|
+
expect(relations.size).to eq(1)
|
17
17
|
expect(relations).to be_kind_of(Hash)
|
18
18
|
expect(relations["foo.photos"]).to be_kind_of(BookingSync::API::Relation)
|
19
19
|
end
|