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.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -1
  3. data/README.md +44 -18
  4. data/lib/bookingsync/api/client.rb +0 -2
  5. data/lib/bookingsync/api/client/accounts.rb +11 -0
  6. data/lib/bookingsync/api/client/bathrooms.rb +11 -0
  7. data/lib/bookingsync/api/client/bedrooms.rb +11 -0
  8. data/lib/bookingsync/api/client/bookings_fees.rb +11 -0
  9. data/lib/bookingsync/api/client/bookings_payments.rb +11 -0
  10. data/lib/bookingsync/api/client/bookings_taxes.rb +11 -0
  11. data/lib/bookingsync/api/client/clients.rb +11 -0
  12. data/lib/bookingsync/api/client/destinations.rb +11 -0
  13. data/lib/bookingsync/api/client/fees.rb +11 -0
  14. data/lib/bookingsync/api/client/inquiries.rb +11 -0
  15. data/lib/bookingsync/api/client/payments.rb +11 -0
  16. data/lib/bookingsync/api/client/periods.rb +11 -0
  17. data/lib/bookingsync/api/client/photos.rb +11 -0
  18. data/lib/bookingsync/api/client/rates.rb +11 -0
  19. data/lib/bookingsync/api/client/rates_rules.rb +44 -0
  20. data/lib/bookingsync/api/client/rates_tables.rb +11 -0
  21. data/lib/bookingsync/api/client/rental_agreements.rb +11 -0
  22. data/lib/bookingsync/api/client/rentals_amenities.rb +23 -0
  23. data/lib/bookingsync/api/client/rentals_fees.rb +11 -0
  24. data/lib/bookingsync/api/client/reviews.rb +11 -0
  25. data/lib/bookingsync/api/client/seasons.rb +11 -0
  26. data/lib/bookingsync/api/client/sources.rb +11 -0
  27. data/lib/bookingsync/api/client/special_offers.rb +11 -0
  28. data/lib/bookingsync/api/client/taxes.rb +11 -0
  29. data/lib/bookingsync/api/version.rb +1 -1
  30. data/spec/bookingsync/api/client/accounts_spec.rb +7 -0
  31. data/spec/bookingsync/api/client/bathrooms_spec.rb +7 -0
  32. data/spec/bookingsync/api/client/bedrooms_spec.rb +7 -0
  33. data/spec/bookingsync/api/client/bookings_fees_spec.rb +9 -2
  34. data/spec/bookingsync/api/client/{billings_payments_spec.rb → bookings_payments_spec.rb} +7 -0
  35. data/spec/bookingsync/api/client/bookings_taxes_spec.rb +9 -2
  36. data/spec/bookingsync/api/client/clients_spec.rb +16 -13
  37. data/spec/bookingsync/api/client/destinations_spec.rb +7 -0
  38. data/spec/bookingsync/api/client/fees_spec.rb +9 -2
  39. data/spec/bookingsync/api/client/inquiries_spec.rb +7 -0
  40. data/spec/bookingsync/api/client/payments_spec.rb +7 -0
  41. data/spec/bookingsync/api/client/periods_spec.rb +7 -0
  42. data/spec/bookingsync/api/client/photos_spec.rb +7 -0
  43. data/spec/bookingsync/api/client/rates_rules_spec.rb +59 -0
  44. data/spec/bookingsync/api/client/rates_spec.rb +7 -0
  45. data/spec/bookingsync/api/client/rates_tables_spec.rb +7 -0
  46. data/spec/bookingsync/api/client/rental_agreements_spec.rb +7 -0
  47. data/spec/bookingsync/api/client/rentals_amenities_spec.rb +36 -8
  48. data/spec/bookingsync/api/client/rentals_fees_spec.rb +9 -2
  49. data/spec/bookingsync/api/client/reviews_spec.rb +7 -0
  50. data/spec/bookingsync/api/client/seasons_spec.rb +7 -0
  51. data/spec/bookingsync/api/client/sources_spec.rb +7 -0
  52. data/spec/bookingsync/api/client/special_offers_spec.rb +7 -0
  53. data/spec/bookingsync/api/client/taxes_spec.rb +9 -2
  54. data/spec/fixtures/cassettes/BookingSync_API_Client_Accounts/_account/returns_a_single_account.yml +80 -0
  55. data/spec/fixtures/cassettes/BookingSync_API_Client_Bathrooms/_bathroom/returns_a_single_bathroom.yml +81 -0
  56. data/spec/fixtures/cassettes/BookingSync_API_Client_Bedrooms/_bedroom/returns_a_single_bedroom.yml +81 -0
  57. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsFees/_bookings_fee/returns_a_single_bookings_fee.yml +81 -0
  58. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsPayments/_bookings_payment/returns_a_single_bookings_payment.yml +80 -0
  59. data/spec/fixtures/cassettes/BookingSync_API_Client_BookingsTaxes/_bookings_tax/returns_a_single_bookings_tax.yml +81 -0
  60. data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_client/returns_a_single_client.yml +81 -0
  61. data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_clients/returns_clients.yml +87 -0
  62. data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_create_client/creates_a_new_client.yml +76 -0
  63. data/spec/fixtures/cassettes/BookingSync_API_Client_Clients/_edit_client/updates_given_client_by_ID.yml +74 -0
  64. data/spec/fixtures/cassettes/BookingSync_API_Client_Destinations/_destination/returns_a_single_destination.yml +83 -0
  65. data/spec/fixtures/cassettes/BookingSync_API_Client_Fees/_fee/returns_a_single_fee.yml +81 -0
  66. data/spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_inquiry/returns_a_single_inquiry.yml +80 -0
  67. data/spec/fixtures/cassettes/BookingSync_API_Client_Payments/_payment/returns_a_single_payment.yml +80 -0
  68. data/spec/fixtures/cassettes/BookingSync_API_Client_Periods/_period/returns_a_single_period.yml +80 -0
  69. data/spec/fixtures/cassettes/BookingSync_API_Client_Photos/_photo/returns_a_single_photo.yml +80 -0
  70. data/spec/fixtures/cassettes/BookingSync_API_Client_Rates/_rate/returns_a_single_rate.yml +80 -0
  71. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_create_rates_rule/creates_a_new_rates_rule.yml +75 -0
  72. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_delete_rates_rule/deletes_given_rates_rule.yml +67 -0
  73. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_edit_rates_rule/updates_given_rates_rule_by_ID.yml +73 -0
  74. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_rates_rule/returns_a_single_rates_rule.yml +80 -0
  75. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesRules/_rates_rules/returns_rates_rules.yml +38 -22
  76. data/spec/fixtures/cassettes/BookingSync_API_Client_RatesTables/_rates_table/returns_a_single_rates_table.yml +80 -0
  77. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_rental_agreement/returns_a_single_rental_agreement.yml +80 -0
  78. 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
  79. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_delete_rentals_amenity/deletes_given_rentals_amenity.yml +67 -0
  80. 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
  81. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalsFees/_rentals_fee/returns_a_single_rentals_fee.yml +81 -0
  82. data/spec/fixtures/cassettes/BookingSync_API_Client_Reviews/_review/returns_a_single_review.yml +81 -0
  83. data/spec/fixtures/cassettes/BookingSync_API_Client_Seasons/_season/returns_a_single_season.yml +81 -0
  84. data/spec/fixtures/cassettes/BookingSync_API_Client_Sources/_source/returns_a_single_source.yml +80 -0
  85. data/spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_special_offer/returns_a_single_special_offer.yml +81 -0
  86. data/spec/fixtures/cassettes/BookingSync_API_Client_Taxes/_tax/returns_a_single_tax.yml +81 -0
  87. metadata +68 -19
  88. data/lib/bookingsync/api/client/billing_addresses.rb +0 -22
  89. data/spec/bookingsync/api/client/billing_addresses_spec.rb +0 -12
  90. data/spec/fixtures/cassettes/BookingSync_API_Client_BillingAddresses/_billing_addresses/returns_billing_addresses.yml +0 -65
  91. data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_clients/returns_clients.yml +0 -66
  92. data/spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_create_client/creates_a_new_client.yml +0 -64
  93. 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: df0f78f0a79e9a32da557bccb9ad5777f77e2ea2
4
- data.tar.gz: 6003bf2692a48dfe8cf60fe537161ed3991cb89d
3
+ metadata.gz: e684e01278017c058321923e665bf96ba3caa420
4
+ data.tar.gz: 6a2121dd54961a277ae61b9bf5d7f23ef8519e58
5
5
  SHA512:
6
- metadata.gz: 0358693bc5ae14c4038876ddd2ab0c5c7226e7ab60bea6b2c968fb04976e501d4112a590eac504b2ff9182b94251738f331ded764941824d9ddb9bd495343285
7
- data.tar.gz: 372ca716f9c91593ac6d27c15ef1f4492bca2961a0c2ad31e653d0f0e0954e412c43d606eb92a2d4141670a41550f65cfd22064197cccd1b8689701991d852a8
6
+ metadata.gz: cd3d7e0824cb828a2b384c7288e5f347d1208439703892aeffb3a60cc216570d17f6479fd1b702624ac1529ba51d57f48272a1f4581d5961aab4fd229b6d3a44
7
+ data.tar.gz: decd8c0854ee18f3f5cd9e9cb3c1989712cd0ec95d5d43f5f38ef0fa0225e9c7c353bbc83faaf27dec6e73671527fe0f75367f1eebcda96d39622e881aeb54b8
data/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Changelog
2
2
 
3
- ## master
3
+ ## 0.0.30
4
+
5
+ - Add missing CRUD actions to existing endpoints.
6
+ - Remove unused BillingAddresses endpoint.
4
7
 
5
8
  ## 0.0.29
6
9
 
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
- gem 'bookingsync-api'
12
+ ```ruby
13
+ gem 'bookingsync-api'
14
+ ```
13
15
 
14
16
  And then execute:
15
17
 
16
- $ bundle
18
+ ```
19
+ $ bundle
20
+ ```
17
21
 
18
22
  Or install it yourself as:
19
23
 
20
- $ gem install bookingsync-api
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
- api = BookingSync::API.new("OAUTH_TOKEN")
27
- rentals = api.rentals # => [BookingSync::API::Resource, BookingSync::API::Resource]
28
- rentals.first.name # => "Small apartment"
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
- api.bookings(per_page: 10, page: 1) => [BookingSync::API::Resource, BookingSync::API::Resource, ...]
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
- api.bookings(per_page: 10) do |batch|
41
- # display 10 bookings, will make one HTTP request for each batch
42
- end
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
- api.bookings(auto_paginate: true) => [BookingSync::API::Resource, BookingSync::API::Resource, ...]
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
- api.rentals(updated_since: "2014-01-01 15:43:96 UTC") # => [BookingSync::API::Resource, BookingSync::API::Resource, ...]
54
- api.last_response.meta # => {"deleted_ids" => [1, 3, 4]}
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
- api = BookingSync::API.new("OAUTH_TOKEN", logger: Rails.logger)
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
- api = BookingSync::API.new("OAUTH_TOKEN", instrumenter: ActiveSupport::Notifications)
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
- bundle exec rspec
117
+ ```
118
+ bundle exec rspec
119
+ ```
98
120
 
99
121
  OR
100
122
 
101
- bundle exec guard
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
- ACCESS_TOKEN=abc bundle exec rspec
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