bookingsync-api 0.0.32 → 0.0.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (21) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/CHANGELOG.md +8 -0
  4. data/lib/bookingsync/api/client.rb +7 -2
  5. data/lib/bookingsync/api/client/rental_cancelation_policies.rb +34 -0
  6. data/lib/bookingsync/api/client/rental_cancelation_policy_items.rb +34 -0
  7. data/lib/bookingsync/api/client/{instant_bookings.rb → strict_bookings.rb} +4 -4
  8. data/lib/bookingsync/api/error.rb +1 -0
  9. data/lib/bookingsync/api/version.rb +1 -1
  10. data/spec/bookingsync/api/client/rental_cancelation_policies_spec.rb +18 -0
  11. data/spec/bookingsync/api/client/rental_cancelation_policy_items_spec.rb +18 -0
  12. data/spec/bookingsync/api/client/strict_bookings_spec.rb +49 -0
  13. data/spec/bookingsync/api/client_spec.rb +9 -0
  14. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicies/_rental_cancelation_policies/returns_rental_cancelation_policies.yml +73 -0
  15. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicies/_rental_cancelation_policy/returns_a_single_rental_cancelation_policy.yml +73 -0
  16. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicyItems/_rental_cancelation_policy_item/returns_a_single_rental_cancelation_policy_item.yml +73 -0
  17. data/spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicyItems/_rental_cancelation_policy_items/returns_rental_cancelation_policy_items.yml +72 -0
  18. data/spec/fixtures/cassettes/BookingSync_API_Client_StrictBookings/_create_strict_booking/creates_a_booking.yml +69 -0
  19. metadata +22 -8
  20. data/spec/bookingsync/api/client/instant_bookings_spec.rb +0 -44
  21. data/spec/fixtures/cassettes/BookingSync_API_Client_InstantBookings/_create_instant_booking/creates_a_booking.yml +0 -68
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bdef22e6fd7715a95e8d49c62d3e312dfcd10a3f
4
- data.tar.gz: 0b2dd6172adaebfc8ba991c57cd95f31862c2f2c
3
+ metadata.gz: dc79948ffe2690c6ffcce2a593ec60f92a613e23
4
+ data.tar.gz: 27a6eee56aab6549201ee42279737c8c4011c3ec
5
5
  SHA512:
6
- metadata.gz: 6d2d900082d34b2d91dad5588ed2019a8522fa2dc9531a1fe0cc6d9c5810431b2d18f9c00eb6f3494e9737790dc809fd3e24d1eb34b017a0e54e6014c98169c6
7
- data.tar.gz: 5b06f174ab183454113fc3e3230e108410c0cbdfe2bf4b8f33286ff4389f777e6f9b8db784b3ad32d4a0124c28cd40e26f6183b8e3ee6409d133d2d74d1e923b
6
+ metadata.gz: a555a2b2d83fa71d487a9b891697ed542f7a3b242b6a3ac56ceb83607b7ea4b69d55df63d400ff1e66ddc71aa53b3c4672ddb12858b2f51f8f501d0b8c1efee9
7
+ data.tar.gz: 9348e3b64c384c4ccfa2b2d8cc44a4e0a4ce1442152558090682ac3957a421e8ae912ab32772f846b767501e40e1eacdf2321a9fd300f4bf54197e6bcb5d72ca
data/.travis.yml CHANGED
@@ -4,3 +4,5 @@ rvm:
4
4
  - "2.0"
5
5
  - "2.1"
6
6
  - "2.2"
7
+ before_install:
8
+ - gem install bundler -v 1.11.2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## Master
4
+
5
+ ## 0.0.33
6
+
7
+ - Add support for rental_cancelation_policies and rental_cancelation_policy_items endpoints.
8
+ - Rename instant bookings to strict bookings
9
+ - Raise RateLimitExceeded error for 429 response status.
10
+
3
11
  ## 0.0.32
4
12
 
5
13
  - Add support for preferences_payments endpoint.
@@ -12,7 +12,7 @@ require "bookingsync/api/client/clients"
12
12
  require "bookingsync/api/client/destinations"
13
13
  require "bookingsync/api/client/fees"
14
14
  require "bookingsync/api/client/inquiries"
15
- require "bookingsync/api/client/instant_bookings"
15
+ require "bookingsync/api/client/strict_bookings"
16
16
  require "bookingsync/api/client/periods"
17
17
  require "bookingsync/api/client/payments"
18
18
  require "bookingsync/api/client/preferences_payments"
@@ -24,6 +24,8 @@ require "bookingsync/api/client/rentals"
24
24
  require "bookingsync/api/client/rentals_fees"
25
25
  require "bookingsync/api/client/rentals_amenities"
26
26
  require "bookingsync/api/client/rental_agreements"
27
+ require "bookingsync/api/client/rental_cancelation_policies"
28
+ require "bookingsync/api/client/rental_cancelation_policy_items"
27
29
  require "bookingsync/api/client/reviews"
28
30
  require "bookingsync/api/client/seasons"
29
31
  require "bookingsync/api/client/special_offers"
@@ -53,7 +55,7 @@ module BookingSync::API
53
55
  include BookingSync::API::Client::Destinations
54
56
  include BookingSync::API::Client::Fees
55
57
  include BookingSync::API::Client::Inquiries
56
- include BookingSync::API::Client::InstantBookings
58
+ include BookingSync::API::Client::StrictBookings
57
59
  include BookingSync::API::Client::Periods
58
60
  include BookingSync::API::Client::Payments
59
61
  include BookingSync::API::Client::PreferencesPayments
@@ -65,6 +67,8 @@ module BookingSync::API
65
67
  include BookingSync::API::Client::RentalsFees
66
68
  include BookingSync::API::Client::RentalsAmenities
67
69
  include BookingSync::API::Client::RentalAgreements
70
+ include BookingSync::API::Client::RentalCancelationPolicies
71
+ include BookingSync::API::Client::RentalCancelationPolicyItems
68
72
  include BookingSync::API::Client::Reviews
69
73
  include BookingSync::API::Client::Seasons
70
74
  include BookingSync::API::Client::SpecialOffers
@@ -311,6 +315,7 @@ module BookingSync::API
311
315
  when 403; raise Forbidden.new(response)
312
316
  when 404; raise NotFound.new(response)
313
317
  when 422; raise UnprocessableEntity.new(response)
318
+ when 429; raise RateLimitExceeded.new(response)
314
319
  else raise UnsupportedResponse.new(response)
315
320
  end
316
321
  end
@@ -0,0 +1,34 @@
1
+ module BookingSync::API
2
+ class Client
3
+ module RentalCancelationPolicies
4
+ # List rental cancelation policies.
5
+ #
6
+ # Returns rental cancelation policies for the rentals of the account
7
+ # and account itself user is authenticated with.
8
+ # @param options [Hash] A customizable set of options.
9
+ # @option options [Array] fields: List of fields to be fetched.
10
+ # @return [Array<BookingSync::API::Resource>] Array of rental cancelation policies.
11
+ #
12
+ # @example Get the list of rental cancelation policies for the current account
13
+ # policy = @api.rental_cancelation_policies
14
+ # policy.first.body # => "My rental cancelation policy"
15
+ # @example Get the list of rental cancelation policies only with body for smaller response
16
+ # @api.rental_cancelation_policies(fields: :body)
17
+ # @see http://docs.api.bookingsync.com/reference/endpoints/rental_cancelation_policies/#list-rental_cancelation_policies
18
+ def rental_cancelation_policies(options = {}, &block)
19
+ paginate :rental_cancelation_policies, options, &block
20
+ end
21
+
22
+ # Get a single rental cancelation policy
23
+ #
24
+ # @param rental_cancelation_policy [BookingSync::API::Resource|Integer] RentalCancelationPolicy or ID
25
+ # of the rental cancelation policy.
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_cancelation_policy(rental_cancelation_policy, options = {})
30
+ get("rental_cancelation_policies/#{rental_cancelation_policy}", options).pop
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ module BookingSync::API
2
+ class Client
3
+ module RentalCancelationPolicyItems
4
+ # List rental cancelation policy items.
5
+ #
6
+ # Returns rental cancelation policy items for the rentals of the account
7
+ # and account itself user is authenticated with.
8
+ # @param options [Hash] A customizable set of options.
9
+ # @option options [Array] fields: List of fields to be fetched.
10
+ # @return [Array<BookingSync::API::Resource>] Array of rental cancelation policy items.
11
+ #
12
+ # @example Get the list of rental cancelation policy items for the current account
13
+ # item = @api.rental_cancelation_policy_items
14
+ # item.first.eligible_days # => 10
15
+ # @example Get the list of rental cancelation policy items only with eligible_days for smaller response
16
+ # @api.rental_cancelation_policy_items(fields: :eligible_days)
17
+ # @see http://docs.api.bookingsync.com/reference/endpoints/rental_cancelation_policy_items/#list-rental_cancelation_policy_items
18
+ def rental_cancelation_policy_items(options = {}, &block)
19
+ paginate :rental_cancelation_policy_items, options, &block
20
+ end
21
+
22
+ # Get a single rental cancelation policy item
23
+ #
24
+ # @param rental_cancelation_policy_item [BookingSync::API::Resource|Integer] RentalCancelationPolicyItem or ID
25
+ # of the rental cancelation policy item.
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_cancelation_policy_item(rental_cancelation_policy_item, options = {})
30
+ get("rental_cancelation_policy_items/#{rental_cancelation_policy_item}", options).pop
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,12 +1,12 @@
1
1
  module BookingSync::API
2
2
  class Client
3
- module InstantBookings
4
- # Create an instant booking
3
+ module StrictBookings
4
+ # Create a strict booking
5
5
  #
6
6
  # @param options [Hash] Booking attributes.
7
7
  # @return [BookingSync::API::Resource] Newly created booking.
8
- def create_instant_booking(options = {})
9
- post("instant_bookings", bookings: [options]).pop
8
+ def create_strict_booking(options = {})
9
+ post("strict_bookings", bookings: [options]).pop
10
10
  end
11
11
  end
12
12
  end
@@ -21,6 +21,7 @@ Body : #{body}}
21
21
  class Forbidden < Error; end
22
22
  class UnprocessableEntity < Error; end
23
23
  class NotFound < Error; end
24
+ class RateLimitExceeded < Error; end
24
25
  class UnsupportedResponse < Error
25
26
  def message
26
27
  super("Received unsupported response from BookingSync API")
@@ -1,5 +1,5 @@
1
1
  module BookingSync
2
2
  module API
3
- VERSION = "0.0.32"
3
+ VERSION = "0.0.33"
4
4
  end
5
5
  end
@@ -0,0 +1,18 @@
1
+ require "spec_helper"
2
+
3
+ describe BookingSync::API::Client::RentalCancelationPolicies do
4
+ let(:client) { BookingSync::API::Client.new(test_access_token) }
5
+
6
+ describe ".rental_cancelation_policies", :vcr do
7
+ it "returns rental cancelation policies" do
8
+ expect(client.rental_cancelation_policies).not_to be_empty
9
+ assert_requested :get, bs_url("rental_cancelation_policies")
10
+ end
11
+ end
12
+
13
+ describe ".rental_cancelation_policy", :vcr do
14
+ it "returns a single rental cancelation policy" do
15
+ expect(client.rental_cancelation_policy(13).body).to eq "``` body ``` "
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require "spec_helper"
2
+
3
+ describe BookingSync::API::Client::RentalCancelationPolicyItems do
4
+ let(:client) { BookingSync::API::Client.new(test_access_token) }
5
+
6
+ describe ".rental_cancelation_policy_items", :vcr do
7
+ it "returns rental cancelation policy items" do
8
+ expect(client.rental_cancelation_policy_items).not_to be_empty
9
+ assert_requested :get, bs_url("rental_cancelation_policy_items")
10
+ end
11
+ end
12
+
13
+ describe ".rental_cancelation_policy_item", :vcr do
14
+ it "returns a single rental cancelation policy item" do
15
+ expect(client.rental_cancelation_policy_item(13).penalty_percentage).to eq "20.0"
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,49 @@
1
+ require "spec_helper"
2
+
3
+ describe BookingSync::API::Client::StrictBookings do
4
+ let(:client) { BookingSync::API::Client.new(test_access_token) }
5
+
6
+ describe ".create_strict_booking", :vcr do
7
+ let(:params) do
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",
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
+ ],
22
+ "client" => {
23
+ "firstname" => "Lazar",
24
+ "email" => "email@example.com",
25
+ "lastname" => "Angelov",
26
+ "phone_number" => "123-123-123",
27
+ "country_code" => "US"
28
+ },
29
+ "comments" => [
30
+ { "content" => "some content" }
31
+ ]
32
+ }
33
+ end
34
+
35
+ it "creates a booking" do
36
+ client.create_strict_booking(params)
37
+ assert_requested :post, bs_url("strict_bookings"),
38
+ body: {bookings: [params]}.to_json
39
+ end
40
+
41
+ it "returns newly created booking" do
42
+ VCR.use_cassette('BookingSync_API_Client_StrictBookings/_create_strict_booking/creates_a_booking') do
43
+ 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"))
46
+ end
47
+ end
48
+ end
49
+ end
@@ -151,6 +151,15 @@ describe BookingSync::API::Client do
151
151
  end
152
152
  end
153
153
 
154
+ context "API returns 429" do
155
+ it "raises RateLimitExceeded exception" do
156
+ stub_get("resource", status: 429)
157
+ expect {
158
+ client.get("resource")
159
+ }.to raise_error(BookingSync::API::RateLimitExceeded)
160
+ end
161
+ end
162
+
154
163
  context "API returns unsupported status code outside 200..299 range" do
155
164
  it "raises UnsupportedResponse exception" do
156
165
  stub_get("resource", status: 405, body: "Whoops!",
@@ -0,0 +1,73 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.bookingsync.com/api/v3/rental_cancelation_policies
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - BookingSync API gem v0.0.29
12
+ Accept:
13
+ - application/vnd.api+json
14
+ Content-Type:
15
+ - application/vnd.api+json
16
+ Authorization:
17
+ - Bearer <<ACCESS_TOKEN>>
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ X-Frame-Options:
26
+ - SAMEORIGIN
27
+ X-Xss-Protection:
28
+ - 1; mode=block
29
+ X-Content-Type-Options:
30
+ - nosniff
31
+ X-Ratelimit-Limit:
32
+ - '1000'
33
+ X-Ratelimit-Reset:
34
+ - '1443110400'
35
+ X-Ratelimit-Remaining:
36
+ - '999'
37
+ Link:
38
+ - <https://bookingsync.dev/api/v3/rental_cancelation_policies?page=1>; rel="first",
39
+ <https://bookingsync.dev/api/v3/rental_cancelation_policies?page=1>; rel="last"
40
+ X-Total-Pages:
41
+ - '1'
42
+ X-Total-Count:
43
+ - '2'
44
+ Content-Type:
45
+ - application/vnd.api+json; charset=utf-8
46
+ Etag:
47
+ - '"10f5bfc57d70c6a495f13179be8d0091"'
48
+ Cache-Control:
49
+ - max-age=0, private, must-revalidate
50
+ P3p:
51
+ - CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
52
+ OUR SAMi OTRo UNRo PUBi IND UNI STA"
53
+ Set-Cookie:
54
+ - ahoy_track=true; path=/
55
+ - ahoy_visit=abfa9b9a-9bc2-4184-aa08-3fee33d9b4cc; path=/; expires=Thu, 01 Oct
56
+ 2015 15:44:34 -0000
57
+ - ahoy_visitor=b8e37dc9-653d-495f-af68-2c2567c9b3ce; path=/; expires=Sun, 24
58
+ Sep 2017 15:44:34 -0000
59
+ X-Request-Id:
60
+ - f1683121-6f49-455d-bdb8-15d4461044b4
61
+ X-Runtime:
62
+ - '0.461940'
63
+ Date:
64
+ - Thu, 24 Sep 2015 15:44:35 GMT
65
+ Connection:
66
+ - close
67
+ body:
68
+ encoding: UTF-8
69
+ string: '{"links":{"rental_cancelation_policies.account":"https://bookingsync.dev/api/v3/accounts/{rental_cancelation_policies.policeable.id}","rental_cancelation_policies.rental":"https://bookingsync.dev/api/v3/rentals/{rental_cancelation_policies.policeable.id}","rental_cancelation_policies.rental_cancelation_policy_items":"https://bookingsync.dev/api/v3/rental_cancelation_policy_items/{rental_cancelation_policies.rental_cancelation_policy_items}"},"rental_cancelation_policies":[{"links":{"policeable":{"id":1,"type":"Rental"},"rental_cancelation_policy_items":[1]},"id":1,"body":"```
70
+ sdf ```","created_at":"2015-09-23T11:48:15Z","updated_at":"2015-09-23T11:48:15Z"},{"links":{"policeable":{"id":1,"type":"Account"},"rental_cancelation_policy_items":[2]},"id":2,"body":"body","created_at":"2015-09-23T12:03:46Z","updated_at":"2015-09-23T12:03:46Z"}]}'
71
+ http_version:
72
+ recorded_at: Thu, 24 Sep 2015 15:44:35 GMT
73
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,73 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://bookingsync.dev/api/v3/rental_cancelation_policies/13
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - BookingSync API gem v0.0.29
12
+ Accept:
13
+ - application/vnd.api+json
14
+ Content-Type:
15
+ - application/vnd.api+json
16
+ Authorization:
17
+ - Bearer <<ACCESS_TOKEN>>
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ X-Frame-Options:
26
+ - SAMEORIGIN
27
+ X-Xss-Protection:
28
+ - 1; mode=block
29
+ X-Content-Type-Options:
30
+ - nosniff
31
+ X-Ratelimit-Limit:
32
+ - '1000'
33
+ X-Ratelimit-Reset:
34
+ - '1445256000'
35
+ X-Ratelimit-Remaining:
36
+ - '997'
37
+ Link:
38
+ - <https://bookingsync.dev/api/v3/rental_cancelation_policies/13?page=1>; rel="first",
39
+ <https://bookingsync.dev/api/v3/rental_cancelation_policies/13?page=1>; rel="last"
40
+ X-Total-Pages:
41
+ - '1'
42
+ X-Total-Count:
43
+ - '1'
44
+ Content-Type:
45
+ - application/vnd.api+json; charset=utf-8
46
+ Etag:
47
+ - '"26530303f51b8dde408d2c2369fe967f"'
48
+ Cache-Control:
49
+ - max-age=0, private, must-revalidate
50
+ P3p:
51
+ - CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
52
+ OUR SAMi OTRo UNRo PUBi IND UNI STA"
53
+ Set-Cookie:
54
+ - ahoy_track=true; path=/
55
+ - ahoy_visit=bab31074-0c50-4443-9e2c-164ef308108a; path=/; expires=Mon, 26 Oct
56
+ 2015 11:42:28 -0000
57
+ - ahoy_visitor=c61a0ba8-d2f8-4bfc-90ef-de7db5a09b9e; path=/; expires=Thu, 19
58
+ Oct 2017 11:42:28 -0000
59
+ X-Request-Id:
60
+ - 9813b6d1-1cc3-4e50-b88f-c829ad225742
61
+ X-Runtime:
62
+ - '0.131157'
63
+ Date:
64
+ - Mon, 19 Oct 2015 11:42:28 GMT
65
+ Connection:
66
+ - close
67
+ body:
68
+ encoding: UTF-8
69
+ string: '{"links":{"rental_cancelation_policies.rental":"https://bookingsync.dev/api/v3/rentals/{rental_cancelation_policies.rental}","rental_cancelation_policies.rental_cancelation_policy_items":"https://bookingsync.dev/api/v3/rental_cancelation_policy_items/{rental_cancelation_policies.rental_cancelation_policy_items}"},"rental_cancelation_policies":[{"links":{"rental":3,"rental_cancelation_policy_items":[13]},"id":13,"body":"```
70
+ body ``` ","created_at":"2015-09-30T13:09:26Z","updated_at":"2015-09-30T13:09:26Z"}]}'
71
+ http_version:
72
+ recorded_at: Mon, 19 Oct 2015 11:42:28 GMT
73
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,73 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://bookingsync.dev/api/v3/rental_cancelation_policy_items/13
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - BookingSync API gem v0.0.29
12
+ Accept:
13
+ - application/vnd.api+json
14
+ Content-Type:
15
+ - application/vnd.api+json
16
+ Authorization:
17
+ - Bearer <<ACCESS_TOKEN>>
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ X-Frame-Options:
26
+ - SAMEORIGIN
27
+ X-Xss-Protection:
28
+ - 1; mode=block
29
+ X-Content-Type-Options:
30
+ - nosniff
31
+ X-Ratelimit-Limit:
32
+ - '1000'
33
+ X-Ratelimit-Reset:
34
+ - '1445256000'
35
+ X-Ratelimit-Remaining:
36
+ - '998'
37
+ Link:
38
+ - <https://bookingsync.dev/api/v3/rental_cancelation_policy_items/13?page=1>;
39
+ rel="first", <https://bookingsync.dev/api/v3/rental_cancelation_policy_items/13?page=1>;
40
+ rel="last"
41
+ X-Total-Pages:
42
+ - '1'
43
+ X-Total-Count:
44
+ - '1'
45
+ Content-Type:
46
+ - application/vnd.api+json; charset=utf-8
47
+ Etag:
48
+ - '"53510fc2643891459d4f0f2b24d37fc4"'
49
+ Cache-Control:
50
+ - max-age=0, private, must-revalidate
51
+ P3p:
52
+ - CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
53
+ OUR SAMi OTRo UNRo PUBi IND UNI STA"
54
+ Set-Cookie:
55
+ - ahoy_track=true; path=/
56
+ - ahoy_visit=c1ec7f75-65d6-4a01-8414-a1aed019a27b; path=/; expires=Mon, 26 Oct
57
+ 2015 11:41:09 -0000
58
+ - ahoy_visitor=6991d1d4-2988-4a77-8658-5a617130d0bc; path=/; expires=Thu, 19
59
+ Oct 2017 11:41:09 -0000
60
+ X-Request-Id:
61
+ - 1a0a2baa-949b-4fb8-bccb-21bc7ac7d80e
62
+ X-Runtime:
63
+ - '0.093684'
64
+ Date:
65
+ - Mon, 19 Oct 2015 11:41:09 GMT
66
+ Connection:
67
+ - close
68
+ body:
69
+ encoding: UTF-8
70
+ string: '{"links":{"rental_cancelation_policy_items.rental_cancelation_policy":"https://bookingsync.dev/api/v3/rental_cancelation_policies/{rental_cancelation_policy_items.rental_cancelation_policy}"},"rental_cancelation_policy_items":[{"links":{"rental_cancelation_policy":13},"id":13,"eligible_days":12,"penalty_percentage":"20.0","created_at":"2015-09-30T13:09:26Z","updated_at":"2015-09-30T13:09:26Z"}]}'
71
+ http_version:
72
+ recorded_at: Mon, 19 Oct 2015 11:41:09 GMT
73
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,72 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.bookingsync.com/api/v3/rental_cancelation_policy_items
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - BookingSync API gem v0.0.29
12
+ Accept:
13
+ - application/vnd.api+json
14
+ Content-Type:
15
+ - application/vnd.api+json
16
+ Authorization:
17
+ - Bearer <<ACCESS_TOKEN>>
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ X-Frame-Options:
26
+ - SAMEORIGIN
27
+ X-Xss-Protection:
28
+ - 1; mode=block
29
+ X-Content-Type-Options:
30
+ - nosniff
31
+ X-Ratelimit-Limit:
32
+ - '1000'
33
+ X-Ratelimit-Reset:
34
+ - '1443110400'
35
+ X-Ratelimit-Remaining:
36
+ - '998'
37
+ Link:
38
+ - <https://bookingsync.dev/api/v3/rental_cancelation_policy_items?page=1>; rel="first",
39
+ <https://bookingsync.dev/api/v3/rental_cancelation_policy_items?page=1>; rel="last"
40
+ X-Total-Pages:
41
+ - '1'
42
+ X-Total-Count:
43
+ - '2'
44
+ Content-Type:
45
+ - application/vnd.api+json; charset=utf-8
46
+ Etag:
47
+ - '"f53584d748c2c10a0fd445f538bbfc41"'
48
+ Cache-Control:
49
+ - max-age=0, private, must-revalidate
50
+ P3p:
51
+ - CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
52
+ OUR SAMi OTRo UNRo PUBi IND UNI STA"
53
+ Set-Cookie:
54
+ - ahoy_track=true; path=/
55
+ - ahoy_visit=0cac88d7-dbe3-4c19-8a0f-52fb7907821e; path=/; expires=Thu, 01 Oct
56
+ 2015 15:44:43 -0000
57
+ - ahoy_visitor=d413b060-d3e8-4880-9d29-2ae2573fcb82; path=/; expires=Sun, 24
58
+ Sep 2017 15:44:43 -0000
59
+ X-Request-Id:
60
+ - bb775035-3649-4b9c-958f-ce65c12b114d
61
+ X-Runtime:
62
+ - '0.127527'
63
+ Date:
64
+ - Thu, 24 Sep 2015 15:44:43 GMT
65
+ Connection:
66
+ - close
67
+ body:
68
+ encoding: UTF-8
69
+ string: '{"links":{"rental_cancelation_policy_items.rental_cancelation_policy":"https://bookingsync.dev/api/v3/rental_cancelation_policies/{rental_cancelation_policy_items.rental_cancelation_policy}"},"rental_cancelation_policy_items":[{"links":{"rental_cancelation_policy":1},"id":1,"eligible_days":20,"penalty_percentage":"12.0","created_at":"2015-09-23T11:48:15Z","updated_at":"2015-09-23T11:48:15Z"},{"links":{"rental_cancelation_policy":2},"id":2,"eligible_days":20,"penalty_percentage":"10.0","created_at":"2015-09-23T12:03:46Z","updated_at":"2015-09-23T12:03:46Z"}]}'
70
+ http_version:
71
+ recorded_at: Thu, 24 Sep 2015 15:44:43 GMT
72
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,69 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://bookingsync.dev/api/v3/strict_bookings
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"bookings":[{"rental_id":"1","start_at":"2016-01-15 16:00:00","end_at":"2016-01-23
9
+ 10:00:00","adults":"3","children":"2","final_price":"2125.42","price_to_pay_now":"2125.42","currency":"EUR","source_id":"1","bookings_fees":[{"rentals_fee_id":"1","times_booked":"1"},{"rentals_fee_id":"3","times_booked":"1"}],"client":{"firstname":"Lazar","email":"email@example.com","lastname":"Angelov","phone_number":"123-123-123","country_code":"US"},"comments":[{"content":"some
10
+ content"}]}]}'
11
+ headers:
12
+ User-Agent:
13
+ - BookingSync API gem v0.0.32
14
+ Accept:
15
+ - application/vnd.api+json
16
+ Content-Type:
17
+ - application/vnd.api+json
18
+ Authorization:
19
+ - Bearer <<ACCESS_TOKEN>>
20
+ Accept-Encoding:
21
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
22
+ response:
23
+ status:
24
+ code: 201
25
+ message: Created
26
+ headers:
27
+ X-Frame-Options:
28
+ - SAMEORIGIN
29
+ X-Xss-Protection:
30
+ - 1; mode=block
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ X-Ratelimit-Limit:
34
+ - '1000'
35
+ X-Ratelimit-Reset:
36
+ - '1452600000'
37
+ X-Ratelimit-Remaining:
38
+ - '997'
39
+ Location:
40
+ - http://bookingsync.dev/api/v3/bookings/712
41
+ Content-Type:
42
+ - application/vnd.api+json; charset=utf-8
43
+ Etag:
44
+ - '"9b6c760e568781643f084cc43fa9b06b"'
45
+ Cache-Control:
46
+ - max-age=0, private, must-revalidate
47
+ P3p:
48
+ - CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
49
+ OUR SAMi OTRo UNRo PUBi IND UNI STA"
50
+ Set-Cookie:
51
+ - ahoy_track=true; path=/
52
+ - ahoy_visit=29565286-40e5-4d35-a22c-fb2c74300363; path=/; expires=Tue, 19 Jan
53
+ 2016 11:24:31 -0000
54
+ - ahoy_visitor=e3014d71-d2fb-468d-88f9-3bddb16df013; path=/; expires=Fri, 12
55
+ Jan 2018 11:24:31 -0000
56
+ X-Request-Id:
57
+ - d2f95291-b6c1-46ce-badb-2db93d5fa918
58
+ X-Runtime:
59
+ - '0.889861'
60
+ Date:
61
+ - Tue, 12 Jan 2016 11:24:32 GMT
62
+ Connection:
63
+ - close
64
+ body:
65
+ encoding: UTF-8
66
+ string: '{"links":{"bookings.account":"http://bookingsync.dev/api/v3/accounts/{bookings.account}","bookings.rental":"http://bookingsync.dev/api/v3/rentals/{bookings.rental}","bookings.client":"http://bookingsync.dev/api/v3/clients/{bookings.client}","bookings.rental_agreement":"http://bookingsync.dev/api/v3/rental_agreements/{bookings.rental_agreement}","bookings.source":"http://bookingsync.dev/api/v3/sources/{bookings.source}","bookings.bookings_fees":"http://bookingsync.dev/api/v3/bookings_fees/{bookings.bookings_fees}","bookings.bookings_taxes":"http://bookingsync.dev/api/v3/bookings_taxes/{bookings.bookings_taxes}","bookings.bookings_tags":"http://bookingsync.dev/api/v3/bookings_tags/{bookings.bookings_tags}"},"bookings":[{"links":{"account":1,"rental":1,"client":85,"rental_agreement":11,"source":1,"bookings_fees":[337,338],"bookings_taxes":[745,746,747,748],"bookings_tags":[]},"id":712,"start_at":"2016-01-15T16:00:00Z","end_at":"2016-01-23T10:00:00Z","status":"Booked","updated_at":"2016-01-12T11:24:32Z","reference":"0000JS","booked":true,"unavailable":false,"tentative_expires_at":null,"initial_price":"583.2","initial_rental_price":"583.2","discount":null,"final_rental_price":"583.2","final_price":"2125.42","downpayment":null,"paid_amount":"0.0","currency":"EUR","notes":null,"damage_deposit":"0.0","charge_damage_deposit_on_arrival":true,"adults":3,"children":2,"bookings_payments_count":0,"review_requests_count":0,"locked":"doorkeeper/application-2","created_at":"2016-01-12T11:24:32Z","canceled_at":null,"expected_checkin_time":null,"expected_checkout_time":null,"payment_url":"https://www.bookingsync.com/en/mybookings/1/bookings/712/payment","balance_due_at":"2016-01-12T11:24:32Z","owned_by_app":true}]}'
67
+ http_version:
68
+ recorded_at: Tue, 12 Jan 2016 11:24:32 GMT
69
+ recorded_with: VCR 2.9.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookingsync-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.32
4
+ version: 0.0.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Grosjean
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-11 00:00:00.000000000 Z
11
+ date: 2016-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -113,7 +113,6 @@ files:
113
113
  - lib/bookingsync/api/client/destinations.rb
114
114
  - lib/bookingsync/api/client/fees.rb
115
115
  - lib/bookingsync/api/client/inquiries.rb
116
- - lib/bookingsync/api/client/instant_bookings.rb
117
116
  - lib/bookingsync/api/client/payments.rb
118
117
  - lib/bookingsync/api/client/periods.rb
119
118
  - lib/bookingsync/api/client/photos.rb
@@ -122,6 +121,8 @@ files:
122
121
  - lib/bookingsync/api/client/rates_rules.rb
123
122
  - lib/bookingsync/api/client/rates_tables.rb
124
123
  - lib/bookingsync/api/client/rental_agreements.rb
124
+ - lib/bookingsync/api/client/rental_cancelation_policies.rb
125
+ - lib/bookingsync/api/client/rental_cancelation_policy_items.rb
125
126
  - lib/bookingsync/api/client/rentals.rb
126
127
  - lib/bookingsync/api/client/rentals_amenities.rb
127
128
  - lib/bookingsync/api/client/rentals_fees.rb
@@ -129,6 +130,7 @@ files:
129
130
  - lib/bookingsync/api/client/seasons.rb
130
131
  - lib/bookingsync/api/client/sources.rb
131
132
  - lib/bookingsync/api/client/special_offers.rb
133
+ - lib/bookingsync/api/client/strict_bookings.rb
132
134
  - lib/bookingsync/api/client/taxes.rb
133
135
  - lib/bookingsync/api/error.rb
134
136
  - lib/bookingsync/api/middleware/logger.rb
@@ -150,7 +152,6 @@ files:
150
152
  - spec/bookingsync/api/client/destinations_spec.rb
151
153
  - spec/bookingsync/api/client/fees_spec.rb
152
154
  - spec/bookingsync/api/client/inquiries_spec.rb
153
- - spec/bookingsync/api/client/instant_bookings_spec.rb
154
155
  - spec/bookingsync/api/client/payments_spec.rb
155
156
  - spec/bookingsync/api/client/periods_spec.rb
156
157
  - spec/bookingsync/api/client/photos_spec.rb
@@ -159,6 +160,8 @@ files:
159
160
  - spec/bookingsync/api/client/rates_spec.rb
160
161
  - spec/bookingsync/api/client/rates_tables_spec.rb
161
162
  - spec/bookingsync/api/client/rental_agreements_spec.rb
163
+ - spec/bookingsync/api/client/rental_cancelation_policies_spec.rb
164
+ - spec/bookingsync/api/client/rental_cancelation_policy_items_spec.rb
162
165
  - spec/bookingsync/api/client/rentals_amenities_spec.rb
163
166
  - spec/bookingsync/api/client/rentals_fees_spec.rb
164
167
  - spec/bookingsync/api/client/rentals_spec.rb
@@ -166,6 +169,7 @@ files:
166
169
  - spec/bookingsync/api/client/seasons_spec.rb
167
170
  - spec/bookingsync/api/client/sources_spec.rb
168
171
  - spec/bookingsync/api/client/special_offers_spec.rb
172
+ - spec/bookingsync/api/client/strict_bookings_spec.rb
169
173
  - spec/bookingsync/api/client/taxes_spec.rb
170
174
  - spec/bookingsync/api/client_spec.rb
171
175
  - spec/bookingsync/api/error_spec.rb
@@ -216,7 +220,6 @@ files:
216
220
  - spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_create_inquiry/creates_a_new_inquiry.yml
217
221
  - spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_inquiries/returns_inquiries.yml
218
222
  - spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_inquiry/returns_a_single_inquiry.yml
219
- - spec/fixtures/cassettes/BookingSync_API_Client_InstantBookings/_create_instant_booking/creates_a_booking.yml
220
223
  - spec/fixtures/cassettes/BookingSync_API_Client_Payments/_cancel_payment/cancels_given_payment.yml
221
224
  - spec/fixtures/cassettes/BookingSync_API_Client_Payments/_create_payment/creates_a_new_payment.yml
222
225
  - spec/fixtures/cassettes/BookingSync_API_Client_Payments/_edit_payment/updates_given_payment_by_ID.yml
@@ -254,6 +257,10 @@ files:
254
257
  - spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_create_rental_agreement_for_rental/creates_a_new_rental_agreement.yml
255
258
  - spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_rental_agreement/returns_a_single_rental_agreement.yml
256
259
  - spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_rental_agreements/returns_rental_agreements.yml
260
+ - spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicies/_rental_cancelation_policies/returns_rental_cancelation_policies.yml
261
+ - spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicies/_rental_cancelation_policy/returns_a_single_rental_cancelation_policy.yml
262
+ - spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicyItems/_rental_cancelation_policy_item/returns_a_single_rental_cancelation_policy_item.yml
263
+ - spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicyItems/_rental_cancelation_policy_items/returns_rental_cancelation_policy_items.yml
257
264
  - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_create_rental/creates_a_new_rental.yml
258
265
  - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_delete_rental/deletes_given_rental.yml
259
266
  - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_edit_rental/updates_given_rental_by_ID.yml
@@ -293,6 +300,7 @@ files:
293
300
  - spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_edit_special_offer/updates_given_special_offer_by_ID.yml
294
301
  - spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_special_offer/returns_a_single_special_offer.yml
295
302
  - spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_special_offers/returns_special_offers.yml
303
+ - spec/fixtures/cassettes/BookingSync_API_Client_StrictBookings/_create_strict_booking/creates_a_booking.yml
296
304
  - spec/fixtures/cassettes/BookingSync_API_Client_Taxes/_tax/returns_a_single_tax.yml
297
305
  - spec/fixtures/cassettes/BookingSync_API_Client_Taxes/_taxes/returns_taxes.yml
298
306
  - spec/fixtures/cassettes/spec/cassettes/BookingSync_API_Client_Bookings/_create_booking/creates_a_booking_yml.yml
@@ -318,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
326
  version: '0'
319
327
  requirements: []
320
328
  rubyforge_project:
321
- rubygems_version: 2.4.8
329
+ rubygems_version: 2.4.3
322
330
  signing_key:
323
331
  specification_version: 4
324
332
  summary: Ruby interface for accessing https://www.bookingsync.com
@@ -336,7 +344,6 @@ test_files:
336
344
  - spec/bookingsync/api/client/destinations_spec.rb
337
345
  - spec/bookingsync/api/client/fees_spec.rb
338
346
  - spec/bookingsync/api/client/inquiries_spec.rb
339
- - spec/bookingsync/api/client/instant_bookings_spec.rb
340
347
  - spec/bookingsync/api/client/payments_spec.rb
341
348
  - spec/bookingsync/api/client/periods_spec.rb
342
349
  - spec/bookingsync/api/client/photos_spec.rb
@@ -345,6 +352,8 @@ test_files:
345
352
  - spec/bookingsync/api/client/rates_spec.rb
346
353
  - spec/bookingsync/api/client/rates_tables_spec.rb
347
354
  - spec/bookingsync/api/client/rental_agreements_spec.rb
355
+ - spec/bookingsync/api/client/rental_cancelation_policies_spec.rb
356
+ - spec/bookingsync/api/client/rental_cancelation_policy_items_spec.rb
348
357
  - spec/bookingsync/api/client/rentals_amenities_spec.rb
349
358
  - spec/bookingsync/api/client/rentals_fees_spec.rb
350
359
  - spec/bookingsync/api/client/rentals_spec.rb
@@ -352,6 +361,7 @@ test_files:
352
361
  - spec/bookingsync/api/client/seasons_spec.rb
353
362
  - spec/bookingsync/api/client/sources_spec.rb
354
363
  - spec/bookingsync/api/client/special_offers_spec.rb
364
+ - spec/bookingsync/api/client/strict_bookings_spec.rb
355
365
  - spec/bookingsync/api/client/taxes_spec.rb
356
366
  - spec/bookingsync/api/client_spec.rb
357
367
  - spec/bookingsync/api/error_spec.rb
@@ -402,7 +412,6 @@ test_files:
402
412
  - spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_create_inquiry/creates_a_new_inquiry.yml
403
413
  - spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_inquiries/returns_inquiries.yml
404
414
  - spec/fixtures/cassettes/BookingSync_API_Client_Inquiries/_inquiry/returns_a_single_inquiry.yml
405
- - spec/fixtures/cassettes/BookingSync_API_Client_InstantBookings/_create_instant_booking/creates_a_booking.yml
406
415
  - spec/fixtures/cassettes/BookingSync_API_Client_Payments/_cancel_payment/cancels_given_payment.yml
407
416
  - spec/fixtures/cassettes/BookingSync_API_Client_Payments/_create_payment/creates_a_new_payment.yml
408
417
  - spec/fixtures/cassettes/BookingSync_API_Client_Payments/_edit_payment/updates_given_payment_by_ID.yml
@@ -440,6 +449,10 @@ test_files:
440
449
  - spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_create_rental_agreement_for_rental/creates_a_new_rental_agreement.yml
441
450
  - spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_rental_agreement/returns_a_single_rental_agreement.yml
442
451
  - spec/fixtures/cassettes/BookingSync_API_Client_RentalAgreements/_rental_agreements/returns_rental_agreements.yml
452
+ - spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicies/_rental_cancelation_policies/returns_rental_cancelation_policies.yml
453
+ - spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicies/_rental_cancelation_policy/returns_a_single_rental_cancelation_policy.yml
454
+ - spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicyItems/_rental_cancelation_policy_item/returns_a_single_rental_cancelation_policy_item.yml
455
+ - spec/fixtures/cassettes/BookingSync_API_Client_RentalCancelationPolicyItems/_rental_cancelation_policy_items/returns_rental_cancelation_policy_items.yml
443
456
  - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_create_rental/creates_a_new_rental.yml
444
457
  - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_delete_rental/deletes_given_rental.yml
445
458
  - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_edit_rental/updates_given_rental_by_ID.yml
@@ -479,6 +492,7 @@ test_files:
479
492
  - spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_edit_special_offer/updates_given_special_offer_by_ID.yml
480
493
  - spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_special_offer/returns_a_single_special_offer.yml
481
494
  - spec/fixtures/cassettes/BookingSync_API_Client_SpecialOffers/_special_offers/returns_special_offers.yml
495
+ - spec/fixtures/cassettes/BookingSync_API_Client_StrictBookings/_create_strict_booking/creates_a_booking.yml
482
496
  - spec/fixtures/cassettes/BookingSync_API_Client_Taxes/_tax/returns_a_single_tax.yml
483
497
  - spec/fixtures/cassettes/BookingSync_API_Client_Taxes/_taxes/returns_taxes.yml
484
498
  - spec/fixtures/cassettes/spec/cassettes/BookingSync_API_Client_Bookings/_create_booking/creates_a_booking_yml.yml
@@ -1,44 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe BookingSync::API::Client::InstantBookings do
4
- let(:client) { BookingSync::API::Client.new(test_access_token) }
5
-
6
- describe ".create_instant_booking", :vcr do
7
- let(:params) do
8
- {
9
- "rental_id" => "1",
10
- "start_at" => "2015-08-01 16:00:00",
11
- "end_at" => "2015-08-11 10:00:00",
12
- "adults" => "3",
13
- "children" => "2",
14
- "final_price" => "806.82",
15
- "currency" => "EUR",
16
- "bookings_fees_attributes" => {
17
- "0" => { "rentals_fee_id" => "1", "times_booked" => "1" },
18
- "1" => { "rentals_fee_id" => "3", "times_booked" => "1" }
19
- },
20
- "contact_information_attributes" => {
21
- "firstname" => "Lazar",
22
- "email" => "email@example.com",
23
- "lastname" => "Angelov",
24
- "phone_number" => "123-123-123",
25
- "country_code" => "US"
26
- }
27
- }
28
- end
29
-
30
- it "creates a booking" do
31
- client.create_instant_booking(params)
32
- assert_requested :post, bs_url("instant_bookings"),
33
- body: {bookings: [params]}.to_json
34
- end
35
-
36
- it "returns newly created booking" do
37
- VCR.use_cassette('BookingSync_API_Client_InstantBookings/_create_instant_booking/creates_a_booking') do
38
- booking = client.create_instant_booking(params)
39
- expect(booking.start_at).to eql(Time.parse("2015-08-01 16:00:00 UTC"))
40
- expect(booking.end_at).to eql(Time.parse("2015-08-11 10:00:00 UTC"))
41
- end
42
- end
43
- end
44
- end
@@ -1,68 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://www.bookingsync.com/api/v3/instant_bookings
6
- body:
7
- encoding: UTF-8
8
- string: '{"bookings":[{"rental_id":"1","start_at":"2015-08-01 16:00:00","end_at":"2015-08-11
9
- 10:00:00","adults":"3","children":"2","final_price":"806.82","currency":"EUR","bookings_fees_attributes":{"0":{"rentals_fee_id":"1","times_booked":"1"},"1":{"rentals_fee_id":"3","times_booked":"1"}},"contact_information_attributes":{"firstname":"Lazar","email":"email@example.com","lastname":"Angelov","phone_number":"123-123-123","country_code":"US"}}]}'
10
- headers:
11
- User-Agent:
12
- - BookingSync API gem v0.0.26
13
- Accept:
14
- - application/vnd.api+json
15
- Content-Type:
16
- - application/vnd.api+json
17
- Authorization:
18
- - Bearer <<ACCESS_TOKEN>>
19
- Accept-Encoding:
20
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
21
- response:
22
- status:
23
- code: 201
24
- message: Created
25
- headers:
26
- X-Frame-Options:
27
- - SAMEORIGIN
28
- X-Xss-Protection:
29
- - 1; mode=block
30
- X-Content-Type-Options:
31
- - nosniff
32
- X-Ratelimit-Limit:
33
- - '1000'
34
- X-Ratelimit-Reset:
35
- - '1437051600'
36
- X-Ratelimit-Remaining:
37
- - '999'
38
- Location:
39
- - https://www.bookingsync.com/api/v3/bookings/443
40
- Content-Type:
41
- - application/vnd.api+json; charset=utf-8
42
- Etag:
43
- - '"9b3c2cac44aca7897875673b4351573c"'
44
- Cache-Control:
45
- - max-age=0, private, must-revalidate
46
- P3p:
47
- - CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
48
- OUR SAMi OTRo UNRo PUBi IND UNI STA"
49
- Set-Cookie:
50
- - ahoy_track=true; path=/
51
- - ahoy_visit=cc9e3a70-7937-46c9-8a14-3b4d31fb1f66; path=/; expires=Thu, 23 Jul
52
- 2015 12:22:28 -0000
53
- - ahoy_visitor=b8f91275-2917-4228-bc43-f0eee8d812bf; path=/; expires=Sun, 16
54
- Jul 2017 12:22:28 -0000
55
- X-Request-Id:
56
- - 41c24ae5-3424-46be-8249-4bb6e2fbc10f
57
- X-Runtime:
58
- - '0.779185'
59
- Date:
60
- - Thu, 16 Jul 2015 12:22:28 GMT
61
- Connection:
62
- - close
63
- body:
64
- encoding: UTF-8
65
- string: '{"links":{"bookings.account":"https://www.bookingsync.com/api/v3/accounts/{bookings.account}","bookings.rental":"https://www.bookingsync.com/api/v3/rentals/{bookings.rental}","bookings.client":"https://www.bookingsync.com/api/v3/clients/{bookings.client}","bookings.rental_agreement":"https://www.bookingsync.com/api/v3/rental_agreements/{bookings.rental_agreement}","bookings.source":"https://www.bookingsync.com/api/v3/sources/{bookings.source}","bookings.bookings_fees":"https://www.bookingsync.com/api/v3/bookings_fees/{bookings.bookings_fees}","bookings.bookings_taxes":"https://www.bookingsync.com/api/v3/bookings_taxes/{bookings.bookings_taxes}"},"bookings":[{"links":{"account":1,"rental":1,"client":85,"rental_agreement":3,"source":null,"bookings_fees":[221,222],"bookings_taxes":[498,499,500]},"id":443,"start_at":"2015-08-01T16:00:00Z","end_at":"2015-08-11T10:00:00Z","status":"Booked","updated_at":"2015-07-16T12:22:28Z","booked":true,"unavailable":false,"tentative_expires_at":null,"initial_price":"217.17","initial_rental_price":"217.17","discount":null,"final_rental_price":"217.17","final_price":"806.82","downpayment":null,"paid_amount":"0.0","currency":"EUR","notes":null,"adults":3,"children":2,"bookings_payments_count":0,"review_requests_count":0,"locked":null,"created_at":"2015-07-16T12:22:28Z","canceled_at":null,"expected_checkin_time":null,"expected_checkout_time":null,"owned_by_app":false}]}'
66
- http_version:
67
- recorded_at: Thu, 16 Jul 2015 12:22:28 GMT
68
- recorded_with: VCR 2.9.3