bookingsync-api 0.0.29 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e684e01278017c058321923e665bf96ba3caa420
|
4
|
+
data.tar.gz: 6a2121dd54961a277ae61b9bf5d7f23ef8519e58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd3d7e0824cb828a2b384c7288e5f347d1208439703892aeffb3a60cc216570d17f6479fd1b702624ac1529ba51d57f48272a1f4581d5961aab4fd229b6d3a44
|
7
|
+
data.tar.gz: decd8c0854ee18f3f5cd9e9cb3c1989712cd0ec95d5d43f5f38ef0fa0225e9c7c353bbc83faaf27dec6e73671527fe0f75367f1eebcda96d39622e881aeb54b8
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -9,23 +9,31 @@ This gem allows Ruby developers to programmatically access https://www.bookingsy
|
|
9
9
|
|
10
10
|
Add this line to your application's Gemfile:
|
11
11
|
|
12
|
-
|
12
|
+
```ruby
|
13
|
+
gem 'bookingsync-api'
|
14
|
+
```
|
13
15
|
|
14
16
|
And then execute:
|
15
17
|
|
16
|
-
|
18
|
+
```
|
19
|
+
$ bundle
|
20
|
+
```
|
17
21
|
|
18
22
|
Or install it yourself as:
|
19
23
|
|
20
|
-
|
24
|
+
```
|
25
|
+
$ gem install bookingsync-api
|
26
|
+
```
|
21
27
|
|
22
28
|
## Usage
|
23
29
|
|
24
30
|
Gem assumes that you already have OAuth token for an account.
|
25
31
|
|
26
|
-
|
27
|
-
|
28
|
-
|
32
|
+
```ruby
|
33
|
+
api = BookingSync::API.new("OAUTH_TOKEN")
|
34
|
+
rentals = api.rentals # => [BookingSync::API::Resource, BookingSync::API::Resource]
|
35
|
+
rentals.first.name # => "Small apartment"
|
36
|
+
```
|
29
37
|
|
30
38
|
### Pagination
|
31
39
|
|
@@ -33,25 +41,33 @@ All endpoints returning a collection of resources can be paginated. There are th
|
|
33
41
|
|
34
42
|
Specify `:per_page` and `:page` params. It's useful when implementing pagination on your site.
|
35
43
|
|
36
|
-
|
44
|
+
```ruby
|
45
|
+
api.bookings(per_page: 10, page: 1) => [BookingSync::API::Resource, BookingSync::API::Resource, ...]
|
46
|
+
```
|
37
47
|
|
38
48
|
Use pagination with a block.
|
39
49
|
|
40
|
-
|
41
|
-
|
42
|
-
|
50
|
+
```ruby
|
51
|
+
api.bookings(per_page: 10) do |batch|
|
52
|
+
# display 10 bookings, will make one HTTP request for each batch
|
53
|
+
end
|
54
|
+
```
|
43
55
|
|
44
56
|
Fetch all resources (with multiple requests under the hood) and return one big array.
|
45
57
|
|
46
|
-
|
58
|
+
```ruby
|
59
|
+
api.bookings(auto_paginate: true) => [BookingSync::API::Resource, BookingSync::API::Resource, ...]
|
60
|
+
```
|
47
61
|
|
48
62
|
### Meta information
|
49
63
|
|
50
64
|
Some endpoints return additional info about resource in meta section. To fetch it you need to
|
51
65
|
access last response.
|
52
66
|
|
53
|
-
|
54
|
-
|
67
|
+
```ruby
|
68
|
+
api.rentals(updated_since: "2014-01-01 15:43:96 UTC") # => [BookingSync::API::Resource, BookingSync::API::Resource, ...]
|
69
|
+
api.last_response.meta # => {"deleted_ids" => [1, 3, 4]}
|
70
|
+
```
|
55
71
|
|
56
72
|
### Logging
|
57
73
|
|
@@ -64,7 +80,9 @@ There are two ways to enable logging:
|
|
64
80
|
|
65
81
|
2. Pass your own logger to API client, it can be for example `Rails.logger`.
|
66
82
|
|
67
|
-
|
83
|
+
```ruby
|
84
|
+
api = BookingSync::API.new("OAUTH_TOKEN", logger: Rails.logger)
|
85
|
+
```
|
68
86
|
|
69
87
|
### Instrumentation
|
70
88
|
|
@@ -75,7 +93,9 @@ information anywhere.
|
|
75
93
|
To hook instrumentations into `ActiveSupport::Notifications`, pass the
|
76
94
|
module into the API client initializer:
|
77
95
|
|
78
|
-
|
96
|
+
```ruby
|
97
|
+
api = BookingSync::API.new("OAUTH_TOKEN", instrumenter: ActiveSupport::Notifications)
|
98
|
+
```
|
79
99
|
|
80
100
|
#### Log levels
|
81
101
|
|
@@ -94,18 +114,24 @@ See [API documentation](http://docs.api.bookingsync.com).
|
|
94
114
|
|
95
115
|
## Running specs
|
96
116
|
|
97
|
-
|
117
|
+
```
|
118
|
+
bundle exec rspec
|
119
|
+
```
|
98
120
|
|
99
121
|
OR
|
100
122
|
|
101
|
-
|
123
|
+
```
|
124
|
+
bundle exec guard
|
125
|
+
```
|
102
126
|
|
103
127
|
### Recording VCR cassettes
|
104
128
|
|
105
129
|
For developing bookingsync-api gem you need OAuth access token. In order to record a cassette,
|
106
130
|
you need to run spec with below environment variables.
|
107
131
|
|
108
|
-
|
132
|
+
```
|
133
|
+
ACCESS_TOKEN=abc bundle exec rspec
|
134
|
+
```
|
109
135
|
|
110
136
|
If you want to change a cassette, you need to delete it first.
|
111
137
|
|
@@ -2,7 +2,6 @@ require "bookingsync/api/middleware/logger"
|
|
2
2
|
require "bookingsync/api/client/accounts"
|
3
3
|
require "bookingsync/api/client/amenities"
|
4
4
|
require "bookingsync/api/client/availabilities"
|
5
|
-
require "bookingsync/api/client/billing_addresses"
|
6
5
|
require "bookingsync/api/client/bathrooms"
|
7
6
|
require "bookingsync/api/client/bedrooms"
|
8
7
|
require "bookingsync/api/client/bookings"
|
@@ -43,7 +42,6 @@ module BookingSync::API
|
|
43
42
|
include BookingSync::API::Client::Accounts
|
44
43
|
include BookingSync::API::Client::Amenities
|
45
44
|
include BookingSync::API::Client::Availabilities
|
46
|
-
include BookingSync::API::Client::BillingAddresses
|
47
45
|
include BookingSync::API::Client::Bathrooms
|
48
46
|
include BookingSync::API::Client::Bedrooms
|
49
47
|
include BookingSync::API::Client::Bookings
|
@@ -15,6 +15,17 @@ module BookingSync::API
|
|
15
15
|
def accounts(options = {}, &block)
|
16
16
|
paginate :accounts, options, &block
|
17
17
|
end
|
18
|
+
|
19
|
+
# Get a single account
|
20
|
+
#
|
21
|
+
# @param account [BookingSync::API::Resource|Integer] Account or ID
|
22
|
+
# of the account.
|
23
|
+
# @param options [Hash] A customizable set of query options.
|
24
|
+
# @option options [Array] fields: List of fields to be fetched.
|
25
|
+
# @return [BookingSync::API::Resource]
|
26
|
+
def account(account, options = {})
|
27
|
+
get("accounts/#{account}", options).pop
|
28
|
+
end
|
18
29
|
end
|
19
30
|
end
|
20
31
|
end
|
@@ -17,6 +17,17 @@ module BookingSync::API
|
|
17
17
|
paginate :bathrooms, options, &block
|
18
18
|
end
|
19
19
|
|
20
|
+
# Get a single bathroom
|
21
|
+
#
|
22
|
+
# @param bathroom [BookingSync::API::Resource|Integer] Bedroom or ID
|
23
|
+
# of the bathroom.
|
24
|
+
# @param options [Hash] A customizable set of query options.
|
25
|
+
# @option options [Array] fields: List of fields to be fetched.
|
26
|
+
# @return [BookingSync::API::Resource]
|
27
|
+
def bathroom(bathroom, options = {})
|
28
|
+
get("bathrooms/#{bathroom}", options).pop
|
29
|
+
end
|
30
|
+
|
20
31
|
# Create a new bathroom
|
21
32
|
#
|
22
33
|
# @param rental [BookingSync::API::Resource|Integer] Rental or ID of
|
@@ -17,6 +17,17 @@ module BookingSync::API
|
|
17
17
|
paginate :bedrooms, options, &block
|
18
18
|
end
|
19
19
|
|
20
|
+
# Get a single bedroom
|
21
|
+
#
|
22
|
+
# @param bedroom [BookingSync::API::Resource|Integer] Bedroom or ID
|
23
|
+
# of the bedroom.
|
24
|
+
# @param options [Hash] A customizable set of query options.
|
25
|
+
# @option options [Array] fields: List of fields to be fetched.
|
26
|
+
# @return [BookingSync::API::Resource]
|
27
|
+
def bedroom(bedroom, options = {})
|
28
|
+
get("bedrooms/#{bedroom}", options).pop
|
29
|
+
end
|
30
|
+
|
20
31
|
# Create a new bedroom
|
21
32
|
#
|
22
33
|
# @param rental [BookingSync::API::Resource|Integer] Rental or ID of
|
@@ -17,6 +17,17 @@ module BookingSync::API
|
|
17
17
|
def bookings_fees(options = {}, &block)
|
18
18
|
paginate :bookings_fees, options, &block
|
19
19
|
end
|
20
|
+
|
21
|
+
# Get a single bookings fee
|
22
|
+
#
|
23
|
+
# @param bookings_fee [BookingSync::API::Resource|Integer] BookingsFee or ID
|
24
|
+
# of the bookings 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 bookings_fee(bookings_fee, options = {})
|
29
|
+
get("bookings_fees/#{bookings_fee}", options).pop
|
30
|
+
end
|
20
31
|
end
|
21
32
|
end
|
22
33
|
end
|
@@ -17,6 +17,17 @@ module BookingSync::API
|
|
17
17
|
def bookings_payments(options = {}, &block)
|
18
18
|
paginate :bookings_payments, options, &block
|
19
19
|
end
|
20
|
+
|
21
|
+
# Get a single bookings payment
|
22
|
+
#
|
23
|
+
# @param bookings_payment [BookingSync::API::Resource|Integer] BookingsPayment or ID
|
24
|
+
# of the bookings payment.
|
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 bookings_payment(bookings_payment, options = {})
|
29
|
+
get("bookings_payments/#{bookings_payment}", options).pop
|
30
|
+
end
|
20
31
|
end
|
21
32
|
end
|
22
33
|
end
|
@@ -17,6 +17,17 @@ module BookingSync::API
|
|
17
17
|
def bookings_taxes(options = {}, &block)
|
18
18
|
paginate :bookings_taxes, options, &block
|
19
19
|
end
|
20
|
+
|
21
|
+
# Get a single bookings tax
|
22
|
+
#
|
23
|
+
# @param bookings_tax [BookingSync::API::Resource|Integer] BookingsTax or ID
|
24
|
+
# of the bookings 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 bookings_tax(bookings_tax, options = {})
|
29
|
+
get("bookings_taxes/#{bookings_tax}", options).pop
|
30
|
+
end
|
20
31
|
end
|
21
32
|
end
|
22
33
|
end
|
@@ -18,6 +18,17 @@ module BookingSync::API
|
|
18
18
|
paginate :clients, options, &block
|
19
19
|
end
|
20
20
|
|
21
|
+
# Get a single client
|
22
|
+
#
|
23
|
+
# @param client [BookingSync::API::Resource|Integer] Client or ID
|
24
|
+
# of the client.
|
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 client(client, options = {})
|
29
|
+
get("clients/#{client}", options).pop
|
30
|
+
end
|
31
|
+
|
21
32
|
# Create a new client
|
22
33
|
#
|
23
34
|
# @param options [Hash] Client attributes
|
@@ -17,6 +17,17 @@ module BookingSync::API
|
|
17
17
|
def destinations(options = {}, &block)
|
18
18
|
paginate :destinations, options, &block
|
19
19
|
end
|
20
|
+
|
21
|
+
# Get a single destination
|
22
|
+
#
|
23
|
+
# @param destination [BookingSync::API::Resource|Integer] Destination or ID
|
24
|
+
# of the destination.
|
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 destination(destination, options = {})
|
29
|
+
get("destinations/#{destination}", options).pop
|
30
|
+
end
|
20
31
|
end
|
21
32
|
end
|
22
33
|
end
|
@@ -17,6 +17,17 @@ module BookingSync::API
|
|
17
17
|
def fees(options = {}, &block)
|
18
18
|
paginate :fees, options, &block
|
19
19
|
end
|
20
|
+
|
21
|
+
# Get a single fee
|
22
|
+
#
|
23
|
+
# @param fee [BookingSync::API::Resource|Integer] Fee or ID
|
24
|
+
# of the 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 fee(fee, options = {})
|
29
|
+
get("fees/#{fee}", options).pop
|
30
|
+
end
|
20
31
|
end
|
21
32
|
end
|
22
33
|
end
|
@@ -11,6 +11,17 @@ module BookingSync::API
|
|
11
11
|
paginate :inquiries, options, &block
|
12
12
|
end
|
13
13
|
|
14
|
+
# Get a single inquiry
|
15
|
+
#
|
16
|
+
# @param inquiry [BookingSync::API::Resource|Integer] Inquiry or ID
|
17
|
+
# of the inquiry.
|
18
|
+
# @param options [Hash] A customizable set of query options.
|
19
|
+
# @option options [Array] fields: List of fields to be fetched.
|
20
|
+
# @return [BookingSync::API::Resource]
|
21
|
+
def inquiry(inquiry, options = {})
|
22
|
+
get("inquiries/#{inquiry}", options).pop
|
23
|
+
end
|
24
|
+
|
14
25
|
# Create a new inquiry
|
15
26
|
#
|
16
27
|
# @param rental [BookingSync::API::Resource] Rental or ID of the rental
|
@@ -18,6 +18,17 @@ module BookingSync::API
|
|
18
18
|
paginate :payments, options, &block
|
19
19
|
end
|
20
20
|
|
21
|
+
# Get a single payment
|
22
|
+
#
|
23
|
+
# @param payment [BookingSync::API::Resource|Integer] Payment or ID
|
24
|
+
# of the payment.
|
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 payment(payment, options = {})
|
29
|
+
get("payments/#{payment}", options).pop
|
30
|
+
end
|
31
|
+
|
21
32
|
# Create a new payment
|
22
33
|
#
|
23
34
|
# @param booking_id [Integer] ID of the booking
|
@@ -18,6 +18,17 @@ module BookingSync::API
|
|
18
18
|
paginate :periods, options, &block
|
19
19
|
end
|
20
20
|
|
21
|
+
# Get a single period
|
22
|
+
#
|
23
|
+
# @param period [BookingSync::API::Resource|Integer] Period or ID
|
24
|
+
# of the period.
|
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 period(period, options = {})
|
29
|
+
get("periods/#{period}", options).pop
|
30
|
+
end
|
31
|
+
|
21
32
|
# Create a new period
|
22
33
|
#
|
23
34
|
# @param season [BookingSync::API::Resource|Integer] Season or ID of
|
@@ -20,6 +20,17 @@ module BookingSync::API
|
|
20
20
|
paginate :photos, options, &block
|
21
21
|
end
|
22
22
|
|
23
|
+
# Get a single photo
|
24
|
+
#
|
25
|
+
# @param photo [BookingSync::API::Resource|Integer] Photo or ID
|
26
|
+
# of the photo.
|
27
|
+
# @param options [Hash] A customizable set of query options.
|
28
|
+
# @option options [Array] fields: List of fields to be fetched.
|
29
|
+
# @return [BookingSync::API::Resource]
|
30
|
+
def photo(photo, options = {})
|
31
|
+
get("photos/#{photo}", options).pop
|
32
|
+
end
|
33
|
+
|
23
34
|
# Create a photo
|
24
35
|
#
|
25
36
|
# @param rental [BookingSync::API::Resource|Integer] Rental object or ID
|
@@ -18,6 +18,17 @@ module BookingSync::API
|
|
18
18
|
def rates(options = {}, &block)
|
19
19
|
paginate :rates, options, &block
|
20
20
|
end
|
21
|
+
|
22
|
+
# Get a single rate
|
23
|
+
#
|
24
|
+
# @param rate [BookingSync::API::Resource|Integer] Rate or ID
|
25
|
+
# of the rate.
|
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 rate(rate, options = {})
|
30
|
+
get("rates/#{rate}", options).pop
|
31
|
+
end
|
21
32
|
end
|
22
33
|
end
|
23
34
|
end
|
@@ -17,6 +17,50 @@ module BookingSync::API
|
|
17
17
|
def rates_rules(options = {}, &block)
|
18
18
|
paginate :rates_rules, options, &block
|
19
19
|
end
|
20
|
+
|
21
|
+
# Get a single rates_rule
|
22
|
+
#
|
23
|
+
# @param rates_rule [BookingSync::API::Resource|Integer] RatesRule or ID
|
24
|
+
# of the rates_rule.
|
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_rule(rates_rule, options = {})
|
29
|
+
get("rates_rules/#{rates_rule}", options).pop
|
30
|
+
end
|
31
|
+
|
32
|
+
# Create a new rates_rule
|
33
|
+
#
|
34
|
+
# @param rates_table [BookingSync::API::Resource|Integer] RatesTable or ID of
|
35
|
+
# the rates_table for which rates_rule will be created.
|
36
|
+
# @param options [Hash] RatesRule's attributes.
|
37
|
+
# @return [BookingSync::API::Resource] Newly created rates_rule.
|
38
|
+
def create_rates_rule(rates_table, options = {})
|
39
|
+
post("rates_tables/#{rates_table}/rates_rules", rates_rules: [options]).pop
|
40
|
+
end
|
41
|
+
|
42
|
+
# Edit a rates_rule
|
43
|
+
#
|
44
|
+
# @param rates_rule [BookingSync::API::Resource|Integer] RatesRule or ID of
|
45
|
+
# the rates_rule to be updated.
|
46
|
+
# @param options [Hash] RatesRule attributes to be updated.
|
47
|
+
# @return [BookingSync::API::Resource] Updated rates_rule on success,
|
48
|
+
# exception is raised otherwise.
|
49
|
+
# @example
|
50
|
+
# rates_rule = @api.rates_rules.first
|
51
|
+
# @api.edit_rates_rule(rates_rule, { percentage: 10 })
|
52
|
+
def edit_rates_rule(rates_rule, options = {})
|
53
|
+
put("rates_rules/#{rates_rule}", rates_rules: [options]).pop
|
54
|
+
end
|
55
|
+
|
56
|
+
# Delete a rates_rule
|
57
|
+
#
|
58
|
+
# @param rates_rule [BookingSync::API::Resource|Integer] RatesRule or ID
|
59
|
+
# of the rates_rule to be deleted.
|
60
|
+
# @return [NilClass] Returns nil on success.
|
61
|
+
def delete_rates_rule(rates_rule)
|
62
|
+
delete "rates_rules/#{rates_rule}"
|
63
|
+
end
|
20
64
|
end
|
21
65
|
end
|
22
66
|
end
|