bookingsync-api 0.0.29 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/README.md +44 -18
- data/lib/bookingsync/api/client.rb +0 -2
- data/lib/bookingsync/api/client/accounts.rb +11 -0
- data/lib/bookingsync/api/client/bathrooms.rb +11 -0
- data/lib/bookingsync/api/client/bedrooms.rb +11 -0
- data/lib/bookingsync/api/client/bookings_fees.rb +11 -0
- data/lib/bookingsync/api/client/bookings_payments.rb +11 -0
- data/lib/bookingsync/api/client/bookings_taxes.rb +11 -0
- data/lib/bookingsync/api/client/clients.rb +11 -0
- data/lib/bookingsync/api/client/destinations.rb +11 -0
- data/lib/bookingsync/api/client/fees.rb +11 -0
- data/lib/bookingsync/api/client/inquiries.rb +11 -0
- data/lib/bookingsync/api/client/payments.rb +11 -0
- data/lib/bookingsync/api/client/periods.rb +11 -0
- data/lib/bookingsync/api/client/photos.rb +11 -0
- data/lib/bookingsync/api/client/rates.rb +11 -0
- data/lib/bookingsync/api/client/rates_rules.rb +44 -0
- data/lib/bookingsync/api/client/rates_tables.rb +11 -0
- data/lib/bookingsync/api/client/rental_agreements.rb +11 -0
- data/lib/bookingsync/api/client/rentals_amenities.rb +23 -0
- data/lib/bookingsync/api/client/rentals_fees.rb +11 -0
- data/lib/bookingsync/api/client/reviews.rb +11 -0
- data/lib/bookingsync/api/client/seasons.rb +11 -0
- data/lib/bookingsync/api/client/sources.rb +11 -0
- data/lib/bookingsync/api/client/special_offers.rb +11 -0
- data/lib/bookingsync/api/client/taxes.rb +11 -0
- data/lib/bookingsync/api/version.rb +1 -1
- data/spec/bookingsync/api/client/accounts_spec.rb +7 -0
- data/spec/bookingsync/api/client/bathrooms_spec.rb +7 -0
- data/spec/bookingsync/api/client/bedrooms_spec.rb +7 -0
- data/spec/bookingsync/api/client/bookings_fees_spec.rb +9 -2
- data/spec/bookingsync/api/client/{billings_payments_spec.rb → bookings_payments_spec.rb} +7 -0
- data/spec/bookingsync/api/client/bookings_taxes_spec.rb +9 -2
- data/spec/bookingsync/api/client/clients_spec.rb +16 -13
- data/spec/bookingsync/api/client/destinations_spec.rb +7 -0
- data/spec/bookingsync/api/client/fees_spec.rb +9 -2
- data/spec/bookingsync/api/client/inquiries_spec.rb +7 -0
- data/spec/bookingsync/api/client/payments_spec.rb +7 -0
- data/spec/bookingsync/api/client/periods_spec.rb +7 -0
- data/spec/bookingsync/api/client/photos_spec.rb +7 -0
- data/spec/bookingsync/api/client/rates_rules_spec.rb +59 -0
- data/spec/bookingsync/api/client/rates_spec.rb +7 -0
- data/spec/bookingsync/api/client/rates_tables_spec.rb +7 -0
- data/spec/bookingsync/api/client/rental_agreements_spec.rb +7 -0
- data/spec/bookingsync/api/client/rentals_amenities_spec.rb +36 -8
- data/spec/bookingsync/api/client/rentals_fees_spec.rb +9 -2
- data/spec/bookingsync/api/client/reviews_spec.rb +7 -0
- data/spec/bookingsync/api/client/seasons_spec.rb +7 -0
- data/spec/bookingsync/api/client/sources_spec.rb +7 -0
- data/spec/bookingsync/api/client/special_offers_spec.rb +7 -0
- data/spec/bookingsync/api/client/taxes_spec.rb +9 -2
- data/spec/fixtures/cassettes/BookingSync_API_Client_Accounts/_account/returns_a_single_account.yml +80 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bathrooms/_bathroom/returns_a_single_bathroom.yml +81 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bedrooms/_bedroom/returns_a_single_bedroom.yml +81 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsFees/_bookings_fee/returns_a_single_bookings_fee.yml +81 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsPayments/_bookings_payment/returns_a_single_bookings_payment.yml +80 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsTaxes/_bookings_tax/returns_a_single_bookings_tax.yml +81 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_client/returns_a_single_client.yml +81 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_clients/returns_clients.yml +87 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_create_client/creates_a_new_client.yml +76 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_edit_client/updates_given_client_by_ID.yml +74 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Destinations/_destination/returns_a_single_destination.yml +83 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Fees/_fee/returns_a_single_fee.yml +81 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_inquiry/returns_a_single_inquiry.yml +80 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Payments/_payment/returns_a_single_payment.yml +80 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Periods/_period/returns_a_single_period.yml +80 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_photo/returns_a_single_photo.yml +80 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rates/_rate/returns_a_single_rate.yml +80 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_create_rates_rule/creates_a_new_rates_rule.yml +75 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_delete_rates_rule/deletes_given_rates_rule.yml +67 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_edit_rates_rule/updates_given_rates_rule_by_ID.yml +73 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_rates_rule/returns_a_single_rates_rule.yml +80 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_rates_rules/returns_rates_rules.yml +38 -22
- data/spec/fixtures/cassettes/BookingSync_API_Client_RatesTables/_rates_table/returns_a_single_rates_table.yml +80 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_rental_agreement/returns_a_single_rental_agreement.yml +80 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_create_rentals_amenity/{creates_a_new_rental_s_amenity.yml → creates_a_new_rentals_amenity.yml} +31 -23
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_delete_rentals_amenity/deletes_given_rentals_amenity.yml +67 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/{_create_rentals_amenity/returns_newly_created_rental_s_amenity.yml → _edit_rentals_amenity/updates_given_rentals_amenity_by_ID.yml} +34 -27
- data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsFees/_rentals_fee/returns_a_single_rentals_fee.yml +81 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Reviews/_review/returns_a_single_review.yml +81 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Seasons/_season/returns_a_single_season.yml +81 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Sources/_source/returns_a_single_source.yml +80 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_special_offer/returns_a_single_special_offer.yml +81 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Taxes/_tax/returns_a_single_tax.yml +81 -0
- metadata +68 -19
- data/lib/bookingsync/api/client/billing_addresses.rb +0 -22
- data/spec/bookingsync/api/client/billing_addresses_spec.rb +0 -12
- data/spec/fixtures/cassettes/BookingSync_API_Client_BillingAddresses/_billing_addresses/returns_billing_addresses.yml +0 -65
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_clients/returns_clients.yml +0 -66
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_create_client/creates_a_new_client.yml +0 -64
- data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_edit_client/updates_given_client_by_ID.yml +0 -62
@@ -18,6 +18,17 @@ module BookingSync::API
|
|
18
18
|
paginate :rates_tables, options, &block
|
19
19
|
end
|
20
20
|
|
21
|
+
# Get a single rates_table
|
22
|
+
#
|
23
|
+
# @param rates_table [BookingSync::API::Resource|Integer] RatesTable or ID
|
24
|
+
# of the rates_table.
|
25
|
+
# @param options [Hash] A customizable set of query options.
|
26
|
+
# @option options [Array] fields: List of fields to be fetched.
|
27
|
+
# @return [BookingSync::API::Resource]
|
28
|
+
def rates_table(rates_table, options = {})
|
29
|
+
get("rates_tables/#{rates_table}", options).pop
|
30
|
+
end
|
31
|
+
|
21
32
|
# Create a new rates_table
|
22
33
|
#
|
23
34
|
# @param options [Hash] rates_table attributes
|
@@ -19,6 +19,17 @@ module BookingSync::API
|
|
19
19
|
paginate :rental_agreements, options, &block
|
20
20
|
end
|
21
21
|
|
22
|
+
# Get a single rental_agreement
|
23
|
+
#
|
24
|
+
# @param rental_agreement [BookingSync::API::Resource|Integer] RentalAgreement or ID
|
25
|
+
# of the rental_agreement.
|
26
|
+
# @param options [Hash] A customizable set of query options.
|
27
|
+
# @option options [Array] fields: List of fields to be fetched.
|
28
|
+
# @return [BookingSync::API::Resource]
|
29
|
+
def rental_agreement(rental_agreement, options = {})
|
30
|
+
get("rental_agreements/#{rental_agreement}", options).pop
|
31
|
+
end
|
32
|
+
|
22
33
|
# Create a new rental agreement for a booking.
|
23
34
|
#
|
24
35
|
# @param booking [BookingSync::API::Resource|Integer] Booking or ID of
|
@@ -37,6 +37,29 @@ module BookingSync::API
|
|
37
37
|
def create_rentals_amenity(rental, options = {})
|
38
38
|
post("rentals/#{rental}/rentals_amenities", rentals_amenities: [options]).pop
|
39
39
|
end
|
40
|
+
|
41
|
+
# Edit a rentals_amenity
|
42
|
+
#
|
43
|
+
# @param rentals_amenity [BookingSync::API::Resource|Integer] RentalsAmenity or ID of
|
44
|
+
# the rentals_amenity to be updated.
|
45
|
+
# @param options [Hash] rentals_amenity attributes to be updated.
|
46
|
+
# @return [BookingSync::API::Resource] Updated rentals_amenity on success,
|
47
|
+
# exception is raised otherwise.
|
48
|
+
# @example
|
49
|
+
# rentals_amenity = @api.rentals_amenities.first
|
50
|
+
# @api.edit_rentals_amenity(rentals_amenity, { details_en: "Details" })
|
51
|
+
def edit_rentals_amenity(rentals_amenity, options = {})
|
52
|
+
put("rentals_amenities/#{rentals_amenity}", rentals_amenities: [options]).pop
|
53
|
+
end
|
54
|
+
|
55
|
+
# Delete a rentals_amenity
|
56
|
+
#
|
57
|
+
# @param rentals_amenity [BookingSync::API::Resource|Integer] RentalsAmenity or ID
|
58
|
+
# of the rentals_amenity to be deleted.
|
59
|
+
# @return [NilClass] Returns nil on success.
|
60
|
+
def delete_rentals_amenity(rentals_amenity)
|
61
|
+
delete "rentals_amenities/#{rentals_amenity}"
|
62
|
+
end
|
40
63
|
end
|
41
64
|
end
|
42
65
|
end
|
@@ -17,6 +17,17 @@ module BookingSync::API
|
|
17
17
|
def rentals_fees(options = {}, &block)
|
18
18
|
paginate :rentals_fees, options, &block
|
19
19
|
end
|
20
|
+
|
21
|
+
# Get a single rentals_fee
|
22
|
+
#
|
23
|
+
# @param rentals_fee [BookingSync::API::Resource|Integer] RentalsFee or ID
|
24
|
+
# of the rentals_fee.
|
25
|
+
# @param options [Hash] A customizable set of query options.
|
26
|
+
# @option options [Array] fields: List of fields to be fetched.
|
27
|
+
# @return [BookingSync::API::Resource]
|
28
|
+
def rentals_fee(rentals_fee, options = {})
|
29
|
+
get("rentals_fees/#{rentals_fee}", options).pop
|
30
|
+
end
|
20
31
|
end
|
21
32
|
end
|
22
33
|
end
|
@@ -18,6 +18,17 @@ module BookingSync::API
|
|
18
18
|
paginate :reviews, options, &block
|
19
19
|
end
|
20
20
|
|
21
|
+
# Get a single review
|
22
|
+
#
|
23
|
+
# @param review [BookingSync::API::Resource|Integer] Review or ID
|
24
|
+
# of the review.
|
25
|
+
# @param options [Hash] A customizable set of query options.
|
26
|
+
# @option options [Array] fields: List of fields to be fetched.
|
27
|
+
# @return [BookingSync::API::Resource]
|
28
|
+
def review(review, options = {})
|
29
|
+
get("reviews/#{review}", options).pop
|
30
|
+
end
|
31
|
+
|
21
32
|
# Create a new review
|
22
33
|
#
|
23
34
|
# @param booking [BookingSync::API::Resource|Integer] Booking or ID of
|
@@ -18,6 +18,17 @@ module BookingSync::API
|
|
18
18
|
paginate :seasons, options, &block
|
19
19
|
end
|
20
20
|
|
21
|
+
# Get a single season
|
22
|
+
#
|
23
|
+
# @param season [BookingSync::API::Resource|Integer] Season or ID
|
24
|
+
# of the season.
|
25
|
+
# @param options [Hash] A customizable set of query options.
|
26
|
+
# @option options [Array] fields: List of fields to be fetched.
|
27
|
+
# @return [BookingSync::API::Resource]
|
28
|
+
def season(season, options = {})
|
29
|
+
get("seasons/#{season}", options).pop
|
30
|
+
end
|
31
|
+
|
21
32
|
# Create a new season
|
22
33
|
#
|
23
34
|
# @param rates_table [BookingSync::API::Resource|Integer] Rates table
|
@@ -18,6 +18,17 @@ module BookingSync::API
|
|
18
18
|
paginate :sources, options, &block
|
19
19
|
end
|
20
20
|
|
21
|
+
# Get a single source
|
22
|
+
#
|
23
|
+
# @param source [BookingSync::API::Resource|Integer] Source or ID
|
24
|
+
# of the source.
|
25
|
+
# @param options [Hash] A customizable set of query options.
|
26
|
+
# @option options [Array] fields: List of fields to be fetched.
|
27
|
+
# @return [BookingSync::API::Resource]
|
28
|
+
def source(source, options = {})
|
29
|
+
get("sources/#{source}", options).pop
|
30
|
+
end
|
31
|
+
|
21
32
|
# Create a new source
|
22
33
|
#
|
23
34
|
# @param options [Hash] source attributes
|
@@ -18,6 +18,17 @@ module BookingSync::API
|
|
18
18
|
paginate :special_offers, options, &block
|
19
19
|
end
|
20
20
|
|
21
|
+
# Get a single special_offer
|
22
|
+
#
|
23
|
+
# @param special_offer [BookingSync::API::Resource|Integer] SpecialOffer or ID
|
24
|
+
# of the special_offer.
|
25
|
+
# @param options [Hash] A customizable set of query options.
|
26
|
+
# @option options [Array] fields: List of fields to be fetched.
|
27
|
+
# @return [BookingSync::API::Resource]
|
28
|
+
def special_offer(special_offer, options = {})
|
29
|
+
get("special_offers/#{special_offer}", options).pop
|
30
|
+
end
|
31
|
+
|
21
32
|
# Create a new special offer for a rental
|
22
33
|
#
|
23
34
|
# @param rental [BookingSync::API::Resource|Integer] Rental or ID of the
|
@@ -17,6 +17,17 @@ module BookingSync::API
|
|
17
17
|
def taxes(options = {}, &block)
|
18
18
|
paginate :taxes, options, &block
|
19
19
|
end
|
20
|
+
|
21
|
+
# Get a single tax
|
22
|
+
#
|
23
|
+
# @param tax [BookingSync::API::Resource|Integer] Tax or ID
|
24
|
+
# of the tax.
|
25
|
+
# @param options [Hash] A customizable set of query options.
|
26
|
+
# @option options [Array] fields: List of fields to be fetched.
|
27
|
+
# @return [BookingSync::API::Resource]
|
28
|
+
def tax(tax, options = {})
|
29
|
+
get("taxes/#{tax}", options).pop
|
30
|
+
end
|
20
31
|
end
|
21
32
|
end
|
22
33
|
end
|
@@ -9,4 +9,11 @@ describe BookingSync::API::Client::Accounts do
|
|
9
9
|
assert_requested :get, bs_url("accounts")
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
describe ".account", :vcr do
|
14
|
+
it "returns a single account" do
|
15
|
+
account = client.account(3837)
|
16
|
+
expect(account.id).to eq 3837
|
17
|
+
end
|
18
|
+
end
|
12
19
|
end
|
@@ -11,6 +11,13 @@ describe BookingSync::API::Client::Bathrooms do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
describe ".bathroom", :vcr do
|
15
|
+
it "returns a single bathroom" do
|
16
|
+
bathroom = client.bathroom(730)
|
17
|
+
expect(bathroom.id).to eq 730
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
14
21
|
describe ".create_bathroom", :vcr do
|
15
22
|
let(:attributes) {{
|
16
23
|
name_en: "New bathroom",
|
@@ -11,6 +11,13 @@ describe BookingSync::API::Client::Bedrooms do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
describe ".bedroom", :vcr do
|
15
|
+
it "returns a single bedroom" do
|
16
|
+
bedroom = client.bedroom(945)
|
17
|
+
expect(bedroom.id).to eq 945
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
14
21
|
describe ".create_bedroom", :vcr do
|
15
22
|
let(:attributes) {{
|
16
23
|
name_en: "New bedroom",
|
@@ -1,12 +1,19 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe BookingSync::API::Client::BookingsFees do
|
4
|
-
let(:
|
4
|
+
let(:client) { BookingSync::API::Client.new(test_access_token) }
|
5
5
|
|
6
6
|
describe ".bookings_fees", :vcr do
|
7
7
|
it "returns bookings fees" do
|
8
|
-
expect(
|
8
|
+
expect(client.bookings_fees).not_to be_empty
|
9
9
|
assert_requested :get, bs_url("bookings_fees")
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
describe ".bookings_fee", :vcr do
|
14
|
+
it "returns a single bookings_fee" do
|
15
|
+
bookings_fee = client.bookings_fee(8112)
|
16
|
+
expect(bookings_fee.id).to eq 8112
|
17
|
+
end
|
18
|
+
end
|
12
19
|
end
|
@@ -9,4 +9,11 @@ describe BookingSync::API::Client::BookingsPayments do
|
|
9
9
|
assert_requested :get, bs_url("bookings_payments")
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
describe ".bookings_payment", :vcr do
|
14
|
+
it "returns a single bookings_payment" do
|
15
|
+
bookings_payment = client.bookings_payment(71982)
|
16
|
+
expect(bookings_payment.id).to eq 71982
|
17
|
+
end
|
18
|
+
end
|
12
19
|
end
|
@@ -1,12 +1,19 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe BookingSync::API::Client::BookingsTaxes do
|
4
|
-
let(:
|
4
|
+
let(:client) { BookingSync::API::Client.new(test_access_token) }
|
5
5
|
|
6
6
|
describe ".bookings_taxes", :vcr do
|
7
7
|
it "returns bookings taxes" do
|
8
|
-
expect(
|
8
|
+
expect(client.bookings_taxes).not_to be_empty
|
9
9
|
assert_requested :get, bs_url("bookings_taxes")
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
describe ".bookings_tax", :vcr do
|
14
|
+
it "returns a single bookings_tax" do
|
15
|
+
bookings_tax = client.bookings_tax(8157)
|
16
|
+
expect(bookings_tax.id).to eq 8157
|
17
|
+
end
|
18
|
+
end
|
12
19
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe BookingSync::API::Client::
|
3
|
+
describe BookingSync::API::Client::Clients do
|
4
4
|
let(:api) { BookingSync::API::Client.new(test_access_token) }
|
5
5
|
|
6
6
|
describe ".clients", :vcr do
|
@@ -10,14 +10,17 @@ describe BookingSync::API::Client::Bookings do
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
describe ".client", :vcr do
|
14
|
+
it "returns a single client" do
|
15
|
+
client = api.client(77703)
|
16
|
+
expect(client.id).to eq 77703
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
13
20
|
describe ".create_client", :vcr do
|
14
21
|
let(:attributes) {{
|
15
22
|
fullname: "John Smith",
|
16
|
-
|
17
|
-
mobile: "33333333",
|
18
|
-
email: "smith@example.com",
|
19
|
-
fax: "1111111",
|
20
|
-
address1: "Italy",
|
23
|
+
emails: [{ label: "default", email: "smith@example.com" }],
|
21
24
|
country_code: "IT",
|
22
25
|
city: "Rome"
|
23
26
|
}}
|
@@ -29,24 +32,24 @@ describe BookingSync::API::Client::Bookings do
|
|
29
32
|
end
|
30
33
|
|
31
34
|
it "returns newly created client" do
|
32
|
-
VCR.use_cassette('
|
35
|
+
VCR.use_cassette('BookingSync_API_Client_Clients/_create_client/creates_a_new_client') do
|
33
36
|
client = api.create_client(attributes)
|
34
|
-
expect(client.
|
35
|
-
expect(client.fullname).to
|
37
|
+
expect(client.emails).to eq [{:label=>"default", :email=>"smith@example.com"}]
|
38
|
+
expect(client.fullname).to eq ("John Smith")
|
36
39
|
end
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
40
43
|
describe ".edit_client", :vcr do
|
41
44
|
it "updates given client by ID" do
|
42
|
-
api.edit_client(
|
43
|
-
assert_requested :put, bs_url("clients/
|
45
|
+
api.edit_client(77703, fullname: "Gary Smith")
|
46
|
+
assert_requested :put, bs_url("clients/77703"),
|
44
47
|
body: {clients: [{fullname: "Gary Smith"}]}.to_json
|
45
48
|
end
|
46
49
|
|
47
50
|
it "returns updated client" do
|
48
|
-
VCR.use_cassette('
|
49
|
-
client = api.edit_client(
|
51
|
+
VCR.use_cassette('BookingSync_API_Client_Clients/_edit_client/updates_given_client_by_ID') do
|
52
|
+
client = api.edit_client(77703, fullname: "Gary Smith")
|
50
53
|
expect(client).to be_kind_of(BookingSync::API::Resource)
|
51
54
|
expect(client.fullname).to eq("Gary Smith")
|
52
55
|
end
|
@@ -9,4 +9,11 @@ describe BookingSync::API::Client::Destinations do
|
|
9
9
|
assert_requested :get, bs_url("destinations")
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
describe ".destination", :vcr do
|
14
|
+
it "returns a single destination" do
|
15
|
+
destination = client.destination(7301)
|
16
|
+
expect(destination.id).to eq 7301
|
17
|
+
end
|
18
|
+
end
|
12
19
|
end
|
@@ -1,12 +1,19 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe BookingSync::API::Client::Fees do
|
4
|
-
let(:
|
4
|
+
let(:client) { BookingSync::API::Client.new(test_access_token) }
|
5
5
|
|
6
6
|
describe ".fees", :vcr do
|
7
7
|
it "returns fees" do
|
8
|
-
expect(
|
8
|
+
expect(client.fees).not_to be_empty
|
9
9
|
assert_requested :get, bs_url("fees")
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
describe ".fee", :vcr do
|
14
|
+
it "returns a single fee" do
|
15
|
+
fee = client.fee(474)
|
16
|
+
expect(fee.id).to eq 474
|
17
|
+
end
|
18
|
+
end
|
12
19
|
end
|
@@ -10,6 +10,13 @@ describe BookingSync::API::Client::Inquiries do
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
describe ".inquiry", :vcr do
|
14
|
+
it "returns a single inquiry" do
|
15
|
+
inquiry = client.inquiry(6087)
|
16
|
+
expect(inquiry.id).to eq 6087
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
13
20
|
describe ".create_inquiry", :vcr do
|
14
21
|
let(:attributes) { {
|
15
22
|
rental_id: 7,
|
@@ -10,6 +10,13 @@ describe BookingSync::API::Client::Payments do
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
describe ".payment", :vcr do
|
14
|
+
it "returns a single payment" do
|
15
|
+
payment = api.payment(71959)
|
16
|
+
expect(payment.id).to eq 71959
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
13
20
|
describe ".create_payment", :vcr do
|
14
21
|
let(:attributes) {{
|
15
22
|
amount: 200,
|
@@ -10,6 +10,13 @@ describe BookingSync::API::Client::Periods do
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
describe ".period", :vcr do
|
14
|
+
it "returns a single period" do
|
15
|
+
period = client.period(4737)
|
16
|
+
expect(period.id).to eq 4737
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
13
20
|
describe ".create_period", :vcr do
|
14
21
|
let(:attributes) { {start_at: "2013-04-10", end_at: "2013-04-22"} }
|
15
22
|
let(:season) { BookingSync::API::Resource.new(client, id: 9) }
|
@@ -11,6 +11,13 @@ describe BookingSync::API::Client::Photos do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
describe ".photo", :vcr do
|
15
|
+
it "returns a single photo" do
|
16
|
+
photo = client.photo(5793)
|
17
|
+
expect(photo.id).to eq 5793
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
14
21
|
describe ".create_photo", :vcr do
|
15
22
|
let(:attributes) do
|
16
23
|
{photo_path: "spec/fixtures/files/test.jpg",
|