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::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(34562)
16
- expect(review.id).to eq 34562
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: 1) }
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/1/reviews"),
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 eql(attributes[:comment])
34
- expect(review.rating).to eql(attributes[:rating])
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(1803)
16
- expect(season.id).to eq 1803
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", ratio: 0.2, minimum_stay: 4 } }
22
- let(:rates_table) { BookingSync::API::Resource.new(client, id: 13) }
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/13/seasons"),
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 eql(attributes[:name])
34
- expect(season.minimum_stay).to eql(attributes[:minimum_stay])
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(6, attributes)
45
- assert_requested :put, bs_url("seasons/6"),
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(6, attributes)
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(10)
61
- assert_requested :delete, bs_url("seasons/10")
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(1874)
16
- expect(source.id).to eq 1874
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 eql(attributes[:name])
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: "HomeAway.com" }
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(4, attributes)
46
- assert_requested :put, bs_url("sources/4"),
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(4, attributes)
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 eql(attributes[:name])
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(86)
16
- expect(special_offer.id).to eq 86
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
- name: "New special offer",
24
- start_at: "2014-04-28",
25
- end_at: "2014-05-28",
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) { BookingSync::API::Resource.new(client, id: 12) }
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/12/special_offers"),
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 eql(attributes[:name])
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
- { name: "Updated special offer" }
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(3, attributes)
52
- assert_requested :put, bs_url("special_offers/3"),
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(3, attributes)
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[:name])
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(4)
68
- assert_requested :delete, bs_url("special_offers/4")
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" => "1",
10
- "start_at" => "2016-01-15 16:00:00",
11
- "end_at" => "2016-01-23 10:00:00",
12
- "adults" => "3",
13
- "children" => "2",
14
- "final_price" => "2125.42",
15
- "price_to_pay_now" => "2125.42",
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" => "1",
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 eql(Time.parse("2016-01-15 16:00:00 UTC"))
45
- expect(booking.end_at).to eql(Time.parse("2016-01-23 10:00:00 UTC"))
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(168)
16
- expect(tax.id).to eq 168
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 eql("xyz")
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 eql(response)
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 eql(405)
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 eql("https://www.bookingsync.com/api/v3")
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 eql("https://bookingsync.dev/api/v3")
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 eql(count: 10)
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 eql(text: "first request")
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 eql(1)
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