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.
Files changed (202) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/bookingsync-api.gemspec +1 -0
  4. data/lib/bookingsync/api/client.rb +41 -24
  5. data/lib/bookingsync/api/client/payments.rb +1 -1
  6. data/lib/bookingsync/api/client/rentals.rb +2 -2
  7. data/lib/bookingsync/api/version.rb +1 -1
  8. data/spec/bookingsync/api/client/accounts_spec.rb +8 -2
  9. data/spec/bookingsync/api/client/amenities_spec.rb +8 -2
  10. data/spec/bookingsync/api/client/availabilities_spec.rb +8 -2
  11. data/spec/bookingsync/api/client/bathrooms_spec.rb +25 -12
  12. data/spec/bookingsync/api/client/bedrooms_spec.rb +24 -11
  13. data/spec/bookingsync/api/client/booking_comments_spec.rb +23 -10
  14. data/spec/bookingsync/api/client/bookings_fees_spec.rb +8 -2
  15. data/spec/bookingsync/api/client/bookings_payments_spec.rb +8 -2
  16. data/spec/bookingsync/api/client/bookings_spec.rb +36 -20
  17. data/spec/bookingsync/api/client/bookings_taxes_spec.rb +8 -2
  18. data/spec/bookingsync/api/client/change_overs_spec.rb +8 -2
  19. data/spec/bookingsync/api/client/clients_spec.rb +23 -13
  20. data/spec/bookingsync/api/client/destinations_spec.rb +8 -2
  21. data/spec/bookingsync/api/client/fees_spec.rb +8 -2
  22. data/spec/bookingsync/api/client/inquiries_spec.rb +13 -7
  23. data/spec/bookingsync/api/client/living_rooms_spec.rb +22 -9
  24. data/spec/bookingsync/api/client/nightly_rate_maps_spec.rb +15 -6
  25. data/spec/bookingsync/api/client/payment_gateways_spec.rb +8 -2
  26. data/spec/bookingsync/api/client/payments_spec.rb +34 -16
  27. data/spec/bookingsync/api/client/periods_spec.rb +29 -14
  28. data/spec/bookingsync/api/client/photos_spec.rb +23 -9
  29. data/spec/bookingsync/api/client/preferences_general_settings_spec.rb +11 -4
  30. data/spec/bookingsync/api/client/rates_rules_spec.rb +25 -12
  31. data/spec/bookingsync/api/client/rates_spec.rb +8 -2
  32. data/spec/bookingsync/api/client/rates_tables_spec.rb +23 -10
  33. data/spec/bookingsync/api/client/rental_agreements_spec.rb +18 -8
  34. data/spec/bookingsync/api/client/rental_cancelation_policies_spec.rb +8 -1
  35. data/spec/bookingsync/api/client/rental_cancelation_policy_items_spec.rb +8 -1
  36. data/spec/bookingsync/api/client/rentals_amenities_spec.rb +22 -9
  37. data/spec/bookingsync/api/client/rentals_fees_spec.rb +14 -5
  38. data/spec/bookingsync/api/client/rentals_spec.rb +53 -19
  39. data/spec/bookingsync/api/client/reviews_spec.rb +12 -6
  40. data/spec/bookingsync/api/client/seasons_spec.rb +30 -14
  41. data/spec/bookingsync/api/client/sources_spec.rb +17 -8
  42. data/spec/bookingsync/api/client/special_offers_spec.rb +30 -15
  43. data/spec/bookingsync/api/client/strict_bookings_spec.rb +10 -14
  44. data/spec/bookingsync/api/client/taxes_spec.rb +8 -2
  45. data/spec/bookingsync/api/client_spec.rb +23 -7
  46. data/spec/bookingsync/api/relation_spec.rb +1 -1
  47. data/spec/bookingsync/api/resource_spec.rb +8 -8
  48. data/spec/bookingsync/api/response_spec.rb +8 -8
  49. data/spec/fixtures/cassettes/BookingSync_API_Client_Accounts/_account/returns_a_single_account.yml +26 -18
  50. data/spec/fixtures/cassettes/BookingSync_API_Client_Accounts/_accounts/returns_accounts.yml +26 -18
  51. data/spec/fixtures/cassettes/BookingSync_API_Client_Amenities/_amenities/returns_amenities.yml +220 -26
  52. data/spec/fixtures/cassettes/BookingSync_API_Client_Amenities/_amenity/returns_amenity.yml +50 -26
  53. data/spec/fixtures/cassettes/BookingSync_API_Client_Availabilities/_availabilities/returns_availabilities.yml +37 -21
  54. data/spec/fixtures/cassettes/BookingSync_API_Client_Availabilities/_availability/returns_a_single_availability.yml +33 -25
  55. data/spec/fixtures/cassettes/BookingSync_API_Client_Bathrooms/_bathroom/returns_a_single_bathroom.yml +26 -18
  56. data/spec/fixtures/cassettes/BookingSync_API_Client_Bathrooms/_bathrooms/returns_bathrooms.yml +33 -22
  57. data/spec/fixtures/cassettes/BookingSync_API_Client_Bathrooms/_cancel_bathroom/cancels_given_bathroom.yml +21 -15
  58. data/spec/fixtures/cassettes/BookingSync_API_Client_Bathrooms/_create_bathroom/creates_a_new_bathroom.yml +30 -19
  59. data/spec/fixtures/cassettes/BookingSync_API_Client_Bathrooms/_edit_bathroom/updates_given_bathroom_by_ID.yml +26 -19
  60. data/spec/fixtures/cassettes/BookingSync_API_Client_Bedrooms/_bedroom/returns_a_single_bedroom.yml +26 -18
  61. data/spec/fixtures/cassettes/BookingSync_API_Client_Bedrooms/_bedrooms/returns_bedrooms.yml +32 -24
  62. data/spec/fixtures/cassettes/BookingSync_API_Client_Bedrooms/_cancel_bedroom/cancels_given_bedroom.yml +21 -15
  63. data/spec/fixtures/cassettes/BookingSync_API_Client_Bedrooms/_create_bedroom/creates_a_new_bedroom.yml +29 -18
  64. data/spec/fixtures/cassettes/BookingSync_API_Client_Bedrooms/_edit_bedroom/updates_given_bedroom_by_ID.yml +25 -19
  65. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_booking_comment/returns_single_booking_comment.yml +42 -26
  66. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_booking_comments/returns_booking_comments.yml +45 -33
  67. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_create_booking_comment/creates_booking_comment.yml +43 -24
  68. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_create_booking_comment/returns_newly_created_booking_comment.yml +43 -24
  69. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_delete_booking_comment/deletes_given_booking_comment.yml +29 -17
  70. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_edit_booking_comment/returns_updated_booking_comment.yml +36 -22
  71. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingComments/_edit_booking_comment/updates_booking_comment.yml +36 -22
  72. data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_booking/returns_a_single_booking.yml +44 -26
  73. data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_booking/returns_a_single_canceled_booking.yml +30 -23
  74. data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_a_block/yields_block_with_batch_of_bookings.yml +100 -115
  75. data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_auto_paginate_true/returns_all_bookings_joined_from_many_requests.yml +100 -115
  76. data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_per_page_setting/returns_limited_number_of_bookings.yml +52 -28
  77. data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/returns_bookings.yml +57 -25
  78. data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_cancel_booking/cancels_given_booking.yml +36 -20
  79. data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_create_booking/creates_a_booking.yml +49 -26
  80. data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_edit_booking/updates_given_booking_by_ID.yml +44 -24
  81. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsFees/_bookings_fee/returns_a_single_bookings_fee.yml +26 -18
  82. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsFees/_bookings_fees/returns_bookings_fees.yml +27 -19
  83. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsPayments/_bookings_payment/returns_a_single_bookings_payment.yml +26 -18
  84. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsPayments/_bookings_payments/returns_bookings_payments.yml +51 -28
  85. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsTaxes/_bookings_tax/returns_a_single_bookings_tax.yml +26 -18
  86. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsTaxes/_bookings_taxes/returns_bookings_taxes.yml +28 -20
  87. data/spec/fixtures/cassettes/BookingSync_API_Client_ChangeOvers/_change_over/returns_a_single_change_over.yml +44 -38
  88. data/spec/fixtures/cassettes/BookingSync_API_Client_ChangeOvers/_change_overs/returns_change_overs.yml +43 -37
  89. data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_client/returns_a_single_client.yml +27 -19
  90. data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_clients/returns_clients.yml +32 -26
  91. data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_create_client/creates_a_new_client.yml +30 -19
  92. data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_edit_client/updates_given_client_by_ID.yml +25 -19
  93. data/spec/fixtures/cassettes/BookingSync_API_Client_Destinations/_destination/returns_a_single_destination.yml +29 -24
  94. data/spec/fixtures/cassettes/BookingSync_API_Client_Destinations/_destinations/returns_destinations.yml +59 -25
  95. data/spec/fixtures/cassettes/BookingSync_API_Client_Fees/_create_fee/creates_a_new_fee.yml +25 -18
  96. data/spec/fixtures/cassettes/BookingSync_API_Client_Fees/_fee/returns_a_single_fee.yml +26 -18
  97. data/spec/fixtures/cassettes/BookingSync_API_Client_Fees/_fees/returns_fees.yml +31 -19
  98. data/spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_create_inquiry/creates_a_new_inquiry.yml +50 -27
  99. data/spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_inquiries/returns_inquiries.yml +50 -26
  100. data/spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_inquiry/returns_a_single_inquiry.yml +29 -21
  101. data/spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_cancel_living_room/cancels_given_living_room.yml +35 -31
  102. data/spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_create_living_room/creates_a_new_living_room.yml +41 -37
  103. data/spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_edit_living_room/updates_given_living_room_by_ID.yml +38 -34
  104. data/spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_living_room/returns_a_single_living_room.yml +44 -40
  105. data/spec/fixtures/cassettes/BookingSync_API_Client_LivingRooms/_living_rooms/returns_living_rooms.yml +43 -39
  106. data/spec/fixtures/cassettes/BookingSync_API_Client_NightlyRateMaps/_edit_nightly_rate_map/updates_given_nightly_rate_map_by_ID.yml +39 -33
  107. data/spec/fixtures/cassettes/BookingSync_API_Client_NightlyRateMaps/_nightly_rate_map/returns_a_single_nightly_rate_map.yml +44 -38
  108. data/spec/fixtures/cassettes/BookingSync_API_Client_NightlyRateMaps/_nightly_rate_maps/returns_nightly_rate_maps.yml +44 -38
  109. data/spec/fixtures/cassettes/BookingSync_API_Client_PaymentGateways/_payment_gateway/returns_a_single_payment_gateway.yml +38 -24
  110. data/spec/fixtures/cassettes/BookingSync_API_Client_PaymentGateways/_payment_gateways/returns_payment_gateways.yml +37 -23
  111. data/spec/fixtures/cassettes/BookingSync_API_Client_Payments/_cancel_payment/cancels_given_payment.yml +36 -20
  112. data/spec/fixtures/cassettes/BookingSync_API_Client_Payments/_create_payment/creates_a_new_payment.yml +50 -26
  113. data/spec/fixtures/cassettes/BookingSync_API_Client_Payments/_edit_payment/updates_given_payment_by_ID.yml +44 -25
  114. data/spec/fixtures/cassettes/BookingSync_API_Client_Payments/_payment/returns_a_single_payment.yml +26 -18
  115. data/spec/fixtures/cassettes/BookingSync_API_Client_Payments/_payments/returns_payments.yml +55 -27
  116. data/spec/fixtures/cassettes/BookingSync_API_Client_Periods/_create_period/creates_a_new_period.yml +49 -26
  117. data/spec/fixtures/cassettes/BookingSync_API_Client_Periods/_delete_period/deletes_given_period.yml +35 -19
  118. data/spec/fixtures/cassettes/BookingSync_API_Client_Periods/_edit_period/updates_given_period_by_ID.yml +43 -25
  119. data/spec/fixtures/cassettes/BookingSync_API_Client_Periods/_period/returns_a_single_period.yml +28 -20
  120. data/spec/fixtures/cassettes/BookingSync_API_Client_Periods/_periods/returns_periods.yml +49 -25
  121. data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_create_photo/creates_a_photo.yml +47 -24
  122. data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_create_photo/creates_a_photo_with_encoded_photo_file.yml +47 -24
  123. data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_create_photo/creates_a_photo_with_photo_path.yml +47 -24
  124. data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_create_photo/creates_a_photo_with_remote_URL.yml +47 -24
  125. data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_delete_photo/delete_given_photo.yml +37 -21
  126. data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_edit_photo/updates_photo_s_description.yml +42 -23
  127. data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_edit_photo/updates_photo_s_image_file.yml +42 -23
  128. data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_photo/returns_a_single_photo.yml +28 -20
  129. data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_photos/returns_photos.yml +38 -22
  130. data/spec/fixtures/cassettes/BookingSync_API_Client_PreferencesGeneralSettings/_edit_preferences_general_setting/updates_given_preferences_general_setting_by_ID.yml +39 -34
  131. data/spec/fixtures/cassettes/BookingSync_API_Client_PreferencesGeneralSettings/_preferences_general_settings/returns_preferences_general_settings.yml +50 -42
  132. data/spec/fixtures/cassettes/BookingSync_API_Client_Rates/_rate/returns_a_single_rate.yml +28 -20
  133. data/spec/fixtures/cassettes/BookingSync_API_Client_Rates/_rates/returns_rates.yml +48 -24
  134. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_create_rates_rule/creates_a_new_rates_rule.yml +29 -18
  135. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_delete_rates_rule/deletes_given_rates_rule.yml +21 -15
  136. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_edit_rates_rule/updates_given_rates_rule_by_ID.yml +24 -18
  137. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_rates_rule/returns_a_single_rates_rule.yml +26 -18
  138. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_rates_rules/returns_rates_rules.yml +27 -19
  139. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesTables/_create_rates_table/creates_a_new_rates_table.yml +49 -26
  140. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesTables/_delete_rates_table/deletes_given_rates_table.yml +36 -20
  141. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesTables/_edit_rates_table/updates_given_rates_table_by_ID.yml +43 -25
  142. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesTables/_rates_table/returns_a_single_rates_table.yml +26 -18
  143. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesTables/_rates_tables/returns_rates_tables.yml +54 -36
  144. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_create_rental_agreement/creates_a_new_rental_agreement.yml +50 -26
  145. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_create_rental_agreement_for_booking/creates_a_new_rental_agreement.yml +50 -26
  146. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_create_rental_agreement_for_rental/creates_a_new_rental_agreement.yml +50 -26
  147. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_rental_agreement/returns_a_single_rental_agreement.yml +30 -21
  148. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_rental_agreements/returns_rental_agreements.yml +52 -26
  149. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicies/_rental_cancelation_policies/returns_rental_cancelation_policies.yml +48 -27
  150. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicies/_rental_cancelation_policy/returns_a_single_rental_cancelation_policy.yml +42 -26
  151. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicyItems/_rental_cancelation_policy_item/returns_a_single_rental_cancelation_policy_item.yml +41 -25
  152. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicyItems/_rental_cancelation_policy_items/returns_rental_cancelation_policy_items.yml +43 -26
  153. data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_create_rental/creates_a_new_rental.yml +49 -26
  154. data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_delete_rental/deletes_given_rental.yml +36 -20
  155. data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_edit_rental/updates_given_rental_by_ID.yml +44 -28
  156. data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rental/returns_a_single_rental.yml +234 -31
  157. data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rental/with_additional_query_params/returns_a_single_rental_with_defined_params.yml +322 -0
  158. data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals/links/returns_associated_photos.yml +453 -77
  159. data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals/returns_rentals.yml +405 -54
  160. data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals/returns_rentals_by_ids.yml +336 -32
  161. data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_meta/returns_meta_information_about_all_rentals.yml +53 -25
  162. data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_meta/returns_meta_information_about_requested_rentals.yml +55 -26
  163. data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/performs_autopagination_using_POST.yml +121 -81
  164. data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/rentals_ids_given/makes_a_search_within_given_rentals.yml +42 -28
  165. data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/returns_rentals.yml +42 -28
  166. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_create_rentals_amenity/creates_a_new_rentals_amenity.yml +29 -18
  167. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_delete_rentals_amenity/deletes_given_rentals_amenity.yml +21 -15
  168. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_edit_rentals_amenity/updates_given_rentals_amenity_by_ID.yml +24 -18
  169. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenities/links/returns_associated_amenity.yml +104 -52
  170. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenities/links/returns_associated_rental.yml +283 -53
  171. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenities/returns_rentals_amenities.yml +51 -26
  172. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenity/returns_rentals_amenity.yml +50 -26
  173. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsFees/_create_rentals_fee/creates_a_new_rentals_fee.yml +30 -19
  174. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsFees/_rentals_fee/returns_a_single_rentals_fee.yml +30 -22
  175. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsFees/_rentals_fees/returns_rentals_fees.yml +27 -18
  176. data/spec/fixtures/cassettes/BookingSync_API_Client_Reviews/_create_review/creates_a_new_review.yml +49 -26
  177. data/spec/fixtures/cassettes/BookingSync_API_Client_Reviews/_review/returns_a_single_review.yml +26 -18
  178. data/spec/fixtures/cassettes/BookingSync_API_Client_Reviews/_reviews/returns_reviews.yml +41 -33
  179. data/spec/fixtures/cassettes/BookingSync_API_Client_Seasons/_create_season/creates_a_new_season.yml +50 -27
  180. data/spec/fixtures/cassettes/BookingSync_API_Client_Seasons/_delete_season/deletes_given_season.yml +36 -20
  181. data/spec/fixtures/cassettes/BookingSync_API_Client_Seasons/_edit_season/updates_given_season_by_ID.yml +44 -26
  182. data/spec/fixtures/cassettes/BookingSync_API_Client_Seasons/_season/returns_a_single_season.yml +29 -21
  183. data/spec/fixtures/cassettes/BookingSync_API_Client_Seasons/_seasons/returns_seasons.yml +55 -36
  184. data/spec/fixtures/cassettes/BookingSync_API_Client_Sources/_create_source/creates_a_new_source.yml +40 -25
  185. data/spec/fixtures/cassettes/BookingSync_API_Client_Sources/_edit_source/updates_given_source_by_ID.yml +36 -25
  186. data/spec/fixtures/cassettes/BookingSync_API_Client_Sources/_source/returns_a_single_source.yml +26 -18
  187. data/spec/fixtures/cassettes/BookingSync_API_Client_Sources/_sources/returns_sources.yml +42 -24
  188. data/spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_create_special_offer/creates_a_new_special_offer.yml +50 -26
  189. data/spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_delete_special_offer/deletes_given_special_offer.yml +36 -20
  190. data/spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_edit_special_offer/updates_given_special_offer_by_ID.yml +44 -25
  191. data/spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_special_offer/returns_a_single_special_offer.yml +29 -22
  192. data/spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_special_offers/returns_special_offers.yml +48 -24
  193. data/spec/fixtures/cassettes/BookingSync_API_Client_StrictBookings/_create_strict_booking/creates_a_booking.yml +43 -24
  194. data/spec/fixtures/cassettes/BookingSync_API_Client_Taxes/_tax/returns_a_single_tax.yml +26 -18
  195. data/spec/fixtures/cassettes/BookingSync_API_Client_Taxes/_taxes/returns_taxes.yml +28 -19
  196. data/spec/spec_helper.rb +6 -0
  197. data/spec/support/vcr_helper.rb +29 -0
  198. metadata +21 -10
  199. data/lib/bookingsync/api/client/preferences_payments.rb +0 -22
  200. data/spec/bookingsync/api/client/preferences_payments_spec.rb +0 -12
  201. data/spec/fixtures/cassettes/BookingSync_API_Client_PreferencesPayments/_preferences_payments/returns_preferences_payments.yml +0 -80
  202. 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::Rates 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", :vcr do
7
9
  it "returns rates" do
8
10
  expect(client.rates).not_to be_empty
@@ -11,9 +13,13 @@ describe BookingSync::API::Client::Rates do
11
13
  end
12
14
 
13
15
  describe ".rate", :vcr do
16
+ let(:prefetched_rate_id) {
17
+ find_resource("#{@casette_base_path}_rates/returns_rates.yml", "rates")[:id]
18
+ }
19
+
14
20
  it "returns a single rate" do
15
- rate = client.rate(18577)
16
- expect(rate.id).to eq 18577
21
+ rate = client.rate(prefetched_rate_id)
22
+ expect(rate.id).to eq prefetched_rate_id
17
23
  end
18
24
  end
19
25
  end
@@ -3,6 +3,8 @@ require "spec_helper"
3
3
  describe BookingSync::API::Client::RatesTables 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_tables", :vcr do
7
9
  it "returns rates tables" do
8
10
  expect(client.rates_tables).not_to be_empty
@@ -11,15 +13,19 @@ describe BookingSync::API::Client::RatesTables do
11
13
  end
12
14
 
13
15
  describe ".rates_table", :vcr do
16
+ let(:prefetched_rates_table_id) {
17
+ find_resource("#{@casette_base_path}_rates_tables/returns_rates_tables.yml", "rates_tables")[:id]
18
+ }
19
+
14
20
  it "returns a single rates_table" do
15
- rates_table = client.rates_table(274)
16
- expect(rates_table.id).to eq 274
21
+ rates_table = client.rates_table(prefetched_rates_table_id)
22
+ expect(rates_table.id).to eq prefetched_rates_table_id
17
23
  end
18
24
  end
19
25
 
20
26
  describe ".create_rates_table", :vcr do
21
27
  let(:attributes) {
22
- { name: "New rate table" }
28
+ { name: "New test rate table" }
23
29
  }
24
30
 
25
31
  it "creates a new rates_table" do
@@ -31,7 +37,7 @@ describe BookingSync::API::Client::RatesTables do
31
37
  it "returns newly created rates_table" do
32
38
  VCR.use_cassette("BookingSync_API_Client_RatesTables/_create_rates_table/creates_a_new_rates_table") do
33
39
  rates_table = client.create_rates_table(attributes)
34
- expect(rates_table.name).to eql(attributes[:name])
40
+ expect(rates_table.name).to eq(attributes[:name])
35
41
  end
36
42
  end
37
43
  end
@@ -40,26 +46,33 @@ describe BookingSync::API::Client::RatesTables do
40
46
  let(:attributes) {
41
47
  { name: "Updated rate table" }
42
48
  }
49
+ let(:created_rates_table_id) {
50
+ find_resource("#{@casette_base_path}_create_rates_table/creates_a_new_rates_table.yml", "rates_tables")[:id]
51
+ }
43
52
 
44
53
  it "updates given rates_table by ID" do
45
- client.edit_rates_table(11, attributes)
46
- assert_requested :put, bs_url("rates_tables/11"),
54
+ client.edit_rates_table(created_rates_table_id, attributes)
55
+ assert_requested :put, bs_url("rates_tables/#{created_rates_table_id}"),
47
56
  body: { rates_tables: [attributes] }.to_json
48
57
  end
49
58
 
50
59
  it "returns updated rates_table" do
51
60
  VCR.use_cassette("BookingSync_API_Client_RatesTables/_edit_rates_table/updates_given_rates_table_by_ID") do
52
- rates_table = client.edit_rates_table(11, attributes)
61
+ rates_table = client.edit_rates_table(created_rates_table_id, attributes)
53
62
  expect(rates_table).to be_kind_of(BookingSync::API::Resource)
54
- expect(rates_table.name).to eql(attributes[:name])
63
+ expect(rates_table.name).to eq(attributes[:name])
55
64
  end
56
65
  end
57
66
  end
58
67
 
59
68
  describe ".delete_rates_table", :vcr do
69
+ let(:created_rates_table_id) {
70
+ find_resource("#{@casette_base_path}_create_rates_table/creates_a_new_rates_table.yml", "rates_tables")[:id]
71
+ }
72
+
60
73
  it "deletes given rates_table" do
61
- client.delete_rates_table(7)
62
- assert_requested :delete, bs_url("rates_tables/7")
74
+ client.delete_rates_table(created_rates_table_id)
75
+ assert_requested :delete, bs_url("rates_tables/#{created_rates_table_id}")
63
76
  end
64
77
  end
65
78
  end
@@ -6,6 +6,8 @@ describe BookingSync::API::Client::RentalAgreements do
6
6
  { body: "Lorem ipsum" }
7
7
  }
8
8
 
9
+ before { |ex| @casette_base_path = casette_path(casette_dir, ex.metadata) }
10
+
9
11
  describe ".rental_agreements", :vcr do
10
12
  it "returns rental agreements" do
11
13
  expect(client.rental_agreements).not_to be_empty
@@ -14,9 +16,13 @@ describe BookingSync::API::Client::RentalAgreements do
14
16
  end
15
17
 
16
18
  describe ".rental_agreement", :vcr do
19
+ let(:prefetched_rental_agreement_id) {
20
+ find_resource("#{@casette_base_path}_rental_agreements/returns_rental_agreements.yml", "rental_agreements")[:id]
21
+ }
22
+
17
23
  it "returns a single rental_agreement" do
18
- rental_agreement = client.rental_agreement(6905)
19
- expect(rental_agreement.id).to eq 6905
24
+ rental_agreement = client.rental_agreement(prefetched_rental_agreement_id)
25
+ expect(rental_agreement.id).to eq prefetched_rental_agreement_id
20
26
  end
21
27
  end
22
28
 
@@ -30,13 +36,15 @@ describe BookingSync::API::Client::RentalAgreements do
30
36
  it "returns newly created rental agreement" do
31
37
  VCR.use_cassette("BookingSync_API_Client_RentalAgreements/_create_rental_agreement/creates_a_new_rental_agreement") do
32
38
  rental_agreement = client.create_rental_agreement(attributes)
33
- expect(rental_agreement.body).to eql(attributes[:body])
39
+ expect(rental_agreement.body).to eq(attributes[:body])
34
40
  end
35
41
  end
36
42
  end
37
43
 
38
44
  describe ".create_rental_agreement_for_booking", :vcr do
39
- let(:booking) { BookingSync::API::Resource.new(client, id: 2) }
45
+ let(:booking) do
46
+ find_resource("#{casette_dir}/BookingSync_API_Client_Bookings/_booking/returns_a_single_booking.yml", "bookings")
47
+ end
40
48
 
41
49
  it "creates a new rental agreement" do
42
50
  client.create_rental_agreement_for_booking(booking, attributes)
@@ -47,24 +55,26 @@ describe BookingSync::API::Client::RentalAgreements do
47
55
  it "returns newly created rental agreement" do
48
56
  VCR.use_cassette("BookingSync_API_Client_RentalAgreements/_create_rental_agreement_for_booking/creates_a_new_rental_agreement") do
49
57
  rental_agreement = client.create_rental_agreement_for_booking(booking, attributes)
50
- expect(rental_agreement.body).to eql(attributes[:body])
58
+ expect(rental_agreement.body).to eq(attributes[:body])
51
59
  end
52
60
  end
53
61
  end
54
62
 
55
63
  describe ".create_rental_agreement_for_rental", :vcr do
56
- let(:rental) { BookingSync::API::Resource.new(client, id: 20) }
64
+ let(:rental) do
65
+ find_resource("#{casette_dir}/BookingSync_API_Client_Rentals/_rental/returns_a_single_rental.yml", "rentals")
66
+ end
57
67
 
58
68
  it "creates a new rental agreement" do
59
69
  client.create_rental_agreement_for_rental(rental, attributes)
60
- assert_requested :post, bs_url("rentals/20/rental_agreements"),
70
+ assert_requested :post, bs_url("rentals/#{rental}/rental_agreements"),
61
71
  body: { rental_agreements: [attributes] }.to_json
62
72
  end
63
73
 
64
74
  it "returns newly created rental agreement" do
65
75
  VCR.use_cassette("BookingSync_API_Client_RentalAgreements/_create_rental_agreement_for_rental/creates_a_new_rental_agreement") do
66
76
  rental_agreement = client.create_rental_agreement_for_rental(rental, attributes)
67
- expect(rental_agreement.body).to eql(attributes[:body])
77
+ expect(rental_agreement.body).to eq(attributes[:body])
68
78
  end
69
79
  end
70
80
  end
@@ -3,6 +3,8 @@ require "spec_helper"
3
3
  describe BookingSync::API::Client::RentalCancelationPolicies 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 ".rental_cancelation_policies", :vcr do
7
9
  it "returns rental cancelation policies" do
8
10
  expect(client.rental_cancelation_policies).not_to be_empty
@@ -11,8 +13,13 @@ describe BookingSync::API::Client::RentalCancelationPolicies do
11
13
  end
12
14
 
13
15
  describe ".rental_cancelation_policy", :vcr do
16
+ let(:prefetched_rental_cancelation_policy_id) {
17
+ find_resource("#{@casette_base_path}_rental_cancelation_policies/returns_rental_cancelation_policies.yml",
18
+ "rental_cancelation_policies")[:id]
19
+ }
20
+
14
21
  it "returns a single rental cancelation policy" do
15
- expect(client.rental_cancelation_policy(13).body).to eq "``` body ``` "
22
+ expect(client.rental_cancelation_policy(prefetched_rental_cancelation_policy_id).body).to eq "```body```"
16
23
  end
17
24
  end
18
25
  end
@@ -3,6 +3,8 @@ require "spec_helper"
3
3
  describe BookingSync::API::Client::RentalCancelationPolicyItems 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 ".rental_cancelation_policy_items", :vcr do
7
9
  it "returns rental cancelation policy items" do
8
10
  expect(client.rental_cancelation_policy_items).not_to be_empty
@@ -11,8 +13,13 @@ describe BookingSync::API::Client::RentalCancelationPolicyItems do
11
13
  end
12
14
 
13
15
  describe ".rental_cancelation_policy_item", :vcr do
16
+ let(:prefetched_rental_cancelation_policy_item_id) {
17
+ find_resource("#{@casette_base_path}_rental_cancelation_policy_items/returns_rental_cancelation_policy_items.yml",
18
+ "rental_cancelation_policy_items")[:id]
19
+ }
20
+
14
21
  it "returns a single rental cancelation policy item" do
15
- expect(client.rental_cancelation_policy_item(13).penalty_percentage).to eq "20.0"
22
+ expect(client.rental_cancelation_policy_item(prefetched_rental_cancelation_policy_item_id).penalty_percentage).to eq "20.0"
16
23
  end
17
24
  end
18
25
  end
@@ -3,6 +3,8 @@ require "spec_helper"
3
3
  describe BookingSync::API::Client::RentalsAmenities 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 ".rentals_amenities", :vcr do
7
9
  it "returns rentals amenities" do
8
10
  expect(client.rentals_amenities).not_to be_empty
@@ -23,19 +25,23 @@ describe BookingSync::API::Client::RentalsAmenities do
23
25
  end
24
26
 
25
27
  describe ".rentals_amenity", :vcr do
28
+ let(:prefetched_rentals_amenity_id) {
29
+ find_resource("#{@casette_base_path}_rentals_amenities/returns_rentals_amenities.yml", "rentals_amenities")[:id]
30
+ }
31
+
26
32
  it "returns rentals_amenity" do
27
- amenity = client.rentals_amenity(1)
28
- assert_requested :get, bs_url("rentals_amenities/1")
33
+ amenity = client.rentals_amenity(prefetched_rentals_amenity_id)
34
+ assert_requested :get, bs_url("rentals_amenities/#{prefetched_rentals_amenity_id}")
29
35
  end
30
36
  end
31
37
 
32
38
  describe ".create_rentals_amenity", :vcr do
33
- let(:attributes) { { amenity_id: 44, details_en: "Details" } }
39
+ let(:attributes) { { amenity_id: 48, details_en: "Details" } }
34
40
  let(:rental) { BookingSync::API::Resource.new(client, id: 5116) }
35
41
 
36
42
  it "creates a new rentals_amenity" do
37
43
  client.create_rentals_amenity(rental, attributes)
38
- assert_requested :post, bs_url("rentals/5116/rentals_amenities"),
44
+ assert_requested :post, bs_url("rentals/#{rental}/rentals_amenities"),
39
45
  body: { rentals_amenities: [attributes] }.to_json
40
46
  end
41
47
 
@@ -49,16 +55,19 @@ describe BookingSync::API::Client::RentalsAmenities do
49
55
 
50
56
  describe ".edit_rentals_amenity", :vcr do
51
57
  let(:attributes) { { details_en: "New Details" } }
58
+ let(:created_rentals_amenity_id) {
59
+ find_resource("#{@casette_base_path}_create_rentals_amenity/creates_a_new_rentals_amenity.yml", "rentals_amenities")[:id]
60
+ }
52
61
 
53
62
  it "updates given rentals_amenity by ID" do
54
- client.edit_rentals_amenity(6159, attributes)
55
- assert_requested :put, bs_url("rentals_amenities/6159"),
63
+ client.edit_rentals_amenity(created_rentals_amenity_id, attributes)
64
+ assert_requested :put, bs_url("rentals_amenities/#{created_rentals_amenity_id}"),
56
65
  body: { rentals_amenities: [attributes] }.to_json
57
66
  end
58
67
 
59
68
  it "returns updated rentals_amenity" do
60
69
  VCR.use_cassette("BookingSync_API_Client_RentalsAmenities/_edit_rentals_amenity/updates_given_rentals_amenity_by_ID") do
61
- rentals_amenity = client.edit_rentals_amenity(6159, attributes)
70
+ rentals_amenity = client.edit_rentals_amenity(created_rentals_amenity_id, attributes)
62
71
  expect(rentals_amenity).to be_kind_of(BookingSync::API::Resource)
63
72
  expect(rentals_amenity.details).to eq(en: "New Details")
64
73
  end
@@ -66,9 +75,13 @@ describe BookingSync::API::Client::RentalsAmenities do
66
75
  end
67
76
 
68
77
  describe ".delete_rentals_amenity", :vcr do
78
+ let(:created_rentals_amenity_id) {
79
+ find_resource("#{@casette_base_path}_create_rentals_amenity/creates_a_new_rentals_amenity.yml", "rentals_amenities")[:id]
80
+ }
81
+
69
82
  it "deletes given rentals_amenity" do
70
- client.delete_rentals_amenity(32833)
71
- assert_requested :delete, bs_url("rentals_amenities/32833")
83
+ client.delete_rentals_amenity(created_rentals_amenity_id)
84
+ assert_requested :delete, bs_url("rentals_amenities/#{created_rentals_amenity_id}")
72
85
  end
73
86
  end
74
87
  end
@@ -3,6 +3,8 @@ require "spec_helper"
3
3
  describe BookingSync::API::Client::RentalsFees 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 ".rentals_fees", :vcr do
7
9
  it "returns rentals fees" do
8
10
  expect(client.rentals_fees).not_to be_empty
@@ -11,16 +13,23 @@ describe BookingSync::API::Client::RentalsFees do
11
13
  end
12
14
 
13
15
  describe ".rentals_fee", :vcr do
16
+ let(:prefetched_rentals_fee_id) {
17
+ find_resource("#{@casette_base_path}_rentals_fees/returns_rentals_fees.yml", "rentals_fees")[:id]
18
+ }
19
+
14
20
  it "returns a single rentals_fee" do
15
- rentals_fee = client.rentals_fee(3306)
16
- expect(rentals_fee.id).to eq 3306
21
+ rentals_fee = client.rentals_fee(prefetched_rentals_fee_id)
22
+ expect(rentals_fee.id).to eq prefetched_rentals_fee_id
17
23
  end
18
24
  end
19
25
 
20
26
  describe ".create_rentals_fee", :vcr do
27
+ let(:fee_id) {
28
+ find_resource("#{casette_dir}/BookingSync_API_Client_Fees/_fees/returns_fees.yml", "fees")[:id]
29
+ }
21
30
  let(:attributes) do
22
31
  {
23
- fee_id: 659,
32
+ fee_id: fee_id,
24
33
  maximum_bookable: 10,
25
34
  always_applied: true
26
35
  }
@@ -29,14 +38,14 @@ describe BookingSync::API::Client::RentalsFees do
29
38
 
30
39
  it "creates a new rentals_fee" do
31
40
  client.create_rentals_fee(rental, attributes)
32
- assert_requested :post, bs_url("rentals/5116/rentals_fees"),
41
+ assert_requested :post, bs_url("rentals/#{rental}/rentals_fees"),
33
42
  body: { rentals_fees: [attributes] }.to_json
34
43
  end
35
44
 
36
45
  it "returns newly created rentals_fee" do
37
46
  VCR.use_cassette("BookingSync_API_Client_RentalsFees/_create_rentals_fee/creates_a_new_rentals_fee") do
38
47
  rentals_fee = client.create_rentals_fee(rental, attributes)
39
- expect(rentals_fee.links.fee).to eq 659
48
+ expect(rentals_fee.links.fee).to eq fee_id
40
49
  expect(rentals_fee.maximum_bookable).to eq 10
41
50
  expect(rentals_fee.always_applied).to eq true
42
51
  end
@@ -3,6 +3,8 @@ require "spec_helper"
3
3
  describe BookingSync::API::Client::Rentals 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 ".rentals", :vcr do
7
9
  it "returns rentals" do
8
10
  expect(client.rentals).not_to be_empty
@@ -10,9 +12,11 @@ describe BookingSync::API::Client::Rentals do
10
12
  end
11
13
 
12
14
  it "returns rentals by ids" do
13
- rentals = client.rentals(ids: [26, 28])
14
- expect(rentals.size).to eql(2)
15
- assert_requested :get, bs_url("rentals/26,28")
15
+ rental_ids = find_resources("#{@casette_base_path}_rentals/returns_rentals.yml", "rentals").map { |r| r["id"] }[0..1]
16
+
17
+ rentals = client.rentals(ids: rental_ids)
18
+ expect(rentals.size).to eq(2)
19
+ assert_requested :get, bs_url("rentals/#{rental_ids.join(',')}")
16
20
  end
17
21
 
18
22
  describe "links" do
@@ -25,17 +29,21 @@ describe BookingSync::API::Client::Rentals do
25
29
 
26
30
  describe ".rentals_search", :vcr do
27
31
  it "returns rentals" do
28
- expect(client.rentals_search(start_at: "2016-06-15", end_at: "2016-06-30")).not_to be_empty
32
+ expect(client.rentals_search(start_at: "2016-12-15", end_at: "2016-12-22")).not_to be_empty
29
33
  assert_requested :post, bs_url("rentals/search"),
30
- body: { start_at: "2016-06-15", end_at: "2016-06-30" }.to_json
34
+ body: { start_at: "2016-12-15", end_at: "2016-12-22" }.to_json
31
35
  end
32
36
 
33
37
  context "rentals ids given" do
38
+ let(:rental_ids) {
39
+ find_resources("#{@casette_base_path}_rentals/returns_rentals.yml", "rentals").map { |r| r["id"] }[0..1]
40
+ }
41
+
34
42
  it "makes a search within given rentals" do
35
- rentals = client.rentals_search(ids: [1, 5], start_at: "2016-06-15", end_at: "2016-06-30")
43
+ rentals = client.rentals_search(ids: rental_ids, start_at: "2016-12-15", end_at: "2016-12-22")
36
44
  expect(rentals.size).to eq(1)
37
- assert_requested :post, bs_url("rentals/1,5/search"),
38
- body: { start_at: "2016-06-15", end_at: "2016-06-30" }.to_json
45
+ assert_requested :post, bs_url("rentals/#{rental_ids.join(',')}/search"),
46
+ body: { start_at: "2016-12-15", end_at: "2016-12-22" }.to_json
39
47
  end
40
48
  end
41
49
 
@@ -50,9 +58,23 @@ describe BookingSync::API::Client::Rentals do
50
58
  end
51
59
 
52
60
  describe ".rental", :vcr do
61
+ let(:prefetched_rental) {
62
+ find_resource("#{@casette_base_path}_rentals/returns_rentals.yml", "rentals")
63
+ }
64
+
53
65
  it "returns a single rental" do
54
- rental = client.rental(2)
55
- expect(rental.name).to eql("0 est")
66
+ rental = client.rental(prefetched_rental[:id])
67
+ expect(rental.name).to eq(prefetched_rental[:name])
68
+ expect(rental).to_not have_key(:availability)
69
+ end
70
+
71
+ context "with additional query params" do
72
+ it "returns a single rental with defined params" do
73
+ rental = client.rental(prefetched_rental[:id], include: [:availability, :change_over])
74
+ expect(rental.name).to eq(prefetched_rental[:name])
75
+ expect(rental).to have_key(:availability)
76
+ expect(rental).to have_key(:change_over)
77
+ end
56
78
  end
57
79
  end
58
80
 
@@ -68,22 +90,26 @@ describe BookingSync::API::Client::Rentals do
68
90
  it "returns newly created rental" do
69
91
  VCR.use_cassette("BookingSync_API_Client_Rentals/_create_rental/creates_a_new_rental") do
70
92
  rental = client.create_rental(attributes)
71
- expect(rental.name).to eql("New rental")
72
- expect(rental.sleeps).to eql(2)
93
+ expect(rental.name).to eq("New rental")
94
+ expect(rental.sleeps).to eq(2)
73
95
  end
74
96
  end
75
97
  end
76
98
 
77
99
  describe ".edit_rental", :vcr do
100
+ let(:created_rental_id) {
101
+ find_resource("#{casette_dir}/BookingSync_API_Client_Rentals/_create_rental/creates_a_new_rental.yml", "rentals")[:id]
102
+ }
103
+
78
104
  it "updates given rental by ID" do
79
- client.edit_rental(2, name: "Updated Rental name")
80
- assert_requested :put, bs_url("rentals/2"),
105
+ client.edit_rental(created_rental_id, name: "Updated Rental name")
106
+ assert_requested :put, bs_url("rentals/#{created_rental_id}"),
81
107
  body: { rentals: [{ name: "Updated Rental name" }] }.to_json
82
108
  end
83
109
 
84
110
  it "returns updated rental" do
85
111
  VCR.use_cassette("BookingSync_API_Client_Rentals/_edit_rental/updates_given_rental_by_ID") do
86
- rental = client.edit_rental(2, name: "Updated Rental name")
112
+ rental = client.edit_rental(created_rental_id, name: "Updated Rental name")
87
113
  expect(rental).to be_kind_of(BookingSync::API::Resource)
88
114
  expect(rental.name).to eq("Updated Rental name")
89
115
  end
@@ -91,16 +117,24 @@ describe BookingSync::API::Client::Rentals do
91
117
  end
92
118
 
93
119
  describe ".delete_rental", :vcr do
120
+ let(:created_rental_id) {
121
+ find_resource("#{casette_dir}/BookingSync_API_Client_Rentals/_create_rental/creates_a_new_rental.yml", "rentals")[:id]
122
+ }
123
+
94
124
  it "deletes given rental" do
95
- client.delete_rental(4)
96
- assert_requested :delete, bs_url("rentals/4")
125
+ client.delete_rental(created_rental_id)
126
+ assert_requested :delete, bs_url("rentals/#{created_rental_id}")
97
127
  end
98
128
  end
99
129
 
100
130
  describe ".rentals_meta", :vcr do
131
+ let(:rental_ids) {
132
+ find_resources("#{@casette_base_path}_rentals/returns_rentals.yml", "rentals").map { |r| r["id"] }
133
+ }
134
+
101
135
  it "returns meta information about requested rentals" do
102
- client.rentals_meta([67, 68])
103
- assert_requested :get, bs_url("rentals/67,68/meta")
136
+ client.rentals_meta(rental_ids)
137
+ assert_requested :get, bs_url("rentals/#{rental_ids.join(',')}/meta")
104
138
  end
105
139
 
106
140
  it "returns meta information about all rentals" do