bookingsync-api 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bookingsync/api/client.rb +2 -0
- data/lib/bookingsync/api/client/availabilities.rb +20 -0
- data/lib/bookingsync/api/version.rb +1 -1
- data/spec/bookingsync/api/client/availabilities_spec.rb +12 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Availabilities/_availabilities/returns_availabilities.yml +72 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 172be2a9be7aabe819db717e1a3fcda0d7b24b31
|
4
|
+
data.tar.gz: 2af6c9daa8e298c8efe97ddbaf6fd5d38ebb5559
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57f428b0028fb34272143e65dc42f7edd8b21060b330892235ac1bd51a21aa38fff85487527ffded9a432c92b3c3055c0c1eb6ee8dca211f7611bac73ac30325
|
7
|
+
data.tar.gz: f503f807b4cff7bcdc5a748c9a87a8480fc6fc366124ddb114aef39e01702392bf4138217024fd502997a04e870ecd22cc3fc385e089b09df2f6caa07ed6d0b1
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "bookingsync/api/middleware/authentication"
|
2
2
|
require "bookingsync/api/middleware/logger"
|
3
3
|
require "bookingsync/api/client/amenities"
|
4
|
+
require "bookingsync/api/client/availabilities"
|
4
5
|
require "bookingsync/api/client/billing_addresses"
|
5
6
|
require "bookingsync/api/client/bookings"
|
6
7
|
require "bookingsync/api/client/bookings_payments"
|
@@ -29,6 +30,7 @@ require "logger"
|
|
29
30
|
module BookingSync::API
|
30
31
|
class Client
|
31
32
|
include BookingSync::API::Client::Amenities
|
33
|
+
include BookingSync::API::Client::Availabilities
|
32
34
|
include BookingSync::API::Client::BillingAddresses
|
33
35
|
include BookingSync::API::Client::Bookings
|
34
36
|
include BookingSync::API::Client::BookingsPayments
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module BookingSync::API
|
2
|
+
class Client
|
3
|
+
module Availabilities
|
4
|
+
# List availabilities
|
5
|
+
#
|
6
|
+
# Returns availabilities for the rentals of the account, user is authenticated with.
|
7
|
+
# @param options [Hash] A customizable set of options.
|
8
|
+
# @option options [Array] fields: List of fields to be fetched.
|
9
|
+
# @return [Array<BookingSync::API::Resource>] Array of availabilities.
|
10
|
+
#
|
11
|
+
# @example Get the list of availabilities for the current account
|
12
|
+
# availabilities = @api.availabilities
|
13
|
+
# availabilities.first.start_date # => "2014-05-30"
|
14
|
+
# @see http://docs.api.bookingsync.com/reference/endpoints/availabilities/#list-availabilities
|
15
|
+
def availabilities(options = {}, &block)
|
16
|
+
paginate :availabilities, options, &block
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe BookingSync::API::Client::Availabilities do
|
4
|
+
let(:client) { BookingSync::API::Client.new(test_access_token) }
|
5
|
+
|
6
|
+
describe ".availabilities", :vcr do
|
7
|
+
it "returns availabilities" do
|
8
|
+
expect(client.availabilities).not_to be_empty
|
9
|
+
assert_requested :get, bs_url("availabilities")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.bookingsync.com/api/v3/availabilities
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.0
|
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
|
+
Server:
|
26
|
+
- nginx
|
27
|
+
Date:
|
28
|
+
- Fri, 30 May 2014 14:41:39 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/vnd.api+json; charset=utf-8
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
Status:
|
36
|
+
- 200 OK
|
37
|
+
X-Ratelimit-Limit:
|
38
|
+
- '1000'
|
39
|
+
X-Ratelimit-Reset:
|
40
|
+
- '1401462000.0'
|
41
|
+
X-Ratelimit-Remaining:
|
42
|
+
- '999'
|
43
|
+
Link:
|
44
|
+
- <https://www.bookingsync.com/api/v3/availabilities?page=1>; rel="first", <https://www.bookingsync.com/api/v3/availabilities?page=1>;
|
45
|
+
rel="last"
|
46
|
+
X-Total-Pages:
|
47
|
+
- '1'
|
48
|
+
Access-Control-Allow-Origin:
|
49
|
+
- '*'
|
50
|
+
Access-Control-Request-Method:
|
51
|
+
- '*'
|
52
|
+
X-Ua-Compatible:
|
53
|
+
- IE=Edge,chrome=1
|
54
|
+
Etag:
|
55
|
+
- '"6b623e4d61dddf9231440f4e400ee863"'
|
56
|
+
Cache-Control:
|
57
|
+
- must-revalidate, private, max-age=0
|
58
|
+
P3p:
|
59
|
+
- CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
|
60
|
+
OUR SAMi OTRo UNRo PUBi IND UNI STA"
|
61
|
+
X-Request-Id:
|
62
|
+
- b132dddd4fc5659a5ed73340ec3bba42
|
63
|
+
X-Runtime:
|
64
|
+
- '0.158180'
|
65
|
+
X-Rack-Cache:
|
66
|
+
- miss
|
67
|
+
body:
|
68
|
+
encoding: UTF-8
|
69
|
+
string: '{"links":{"availabilities.rental":"https://www.bookingsync.com/api/v3/rentals/{availabilities.rental}"},"availabilities":[{"links":{"rental":2},"id":2,"map":"11000000000111111000000111111000000000111111111111111111111111111111111111111111111111000000001111111111111111111100000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","start_date":"2014-05-30","updated_at":"2014-05-30T14:26:59Z"},{"links":{"rental":3},"id":3,"map":"11110000000000001111110000111111111111111111111111111111100111111111111111111111111111111111111111111111111000000000111111000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","start_date":"2014-05-30","updated_at":"2014-05-30T14:26:59Z"},{"links":{"rental":86},"id":85,"map":"00111111111111111111111111111111000000111111111111111111111111111111111111111111111111111111111111111111110000000000000000111100111111111111100000000000000011111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111110000000","start_date":"2014-05-30","updated_at":"2014-05-30T14:27:01Z"},{"links":{"rental":106},"id":105,"map":"11111000000000001111110011111100000000000000111111000000001111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000","start_date":"2014-05-30","updated_at":"2014-05-30T14:27:01Z"},{"links":{"rental":107},"id":106,"map":"11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000001111110000000011111100000000011111100000000000000000000011111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","start_date":"2014-05-30","updated_at":"2014-05-30T14:27:01Z"},{"links":{"rental":1284},"id":1161,"map":"11111111111111111111111111111000000001111111111111111111111111111111111111111111111110000000000000000111111111111111111111111111111111111111111111111111100011111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","start_date":"2014-05-30","updated_at":"2014-05-30T14:27:20Z"},{"links":{"rental":1285},"id":1162,"map":"00000011111100000000001111111001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000001111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","start_date":"2014-05-30","updated_at":"2014-05-30T14:27:20Z"},{"links":{"rental":3839},"id":2190,"map":"00000000011111111100000000000000000001111111111111111111100111111111111111111100111111111111100011111111111111111000000000000000000000011111100000000000000011111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","start_date":"2014-05-30","updated_at":"2014-05-30T14:27:36Z"},{"links":{"rental":3871},"id":2222,"map":"10011111111111000000000111111100000000000000000000011111111000000111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","start_date":"2014-05-30","updated_at":"2014-05-30T14:27:36Z"},{"links":{"rental":3872},"id":2223,"map":"11111111111111111111111111111111111111111111111111000000000000000000000011111100000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","start_date":"2014-05-30","updated_at":"2014-05-30T14:27:37Z"},{"links":{"rental":3893},"id":2244,"map":"11111111111111111111111111111111111111111111111111000000000000000111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","start_date":"2014-05-30","updated_at":"2014-05-30T14:27:37Z"}]}'
|
70
|
+
http_version:
|
71
|
+
recorded_at: Fri, 30 May 2014 14:41:41 GMT
|
72
|
+
recorded_with: VCR 2.9.0
|
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.
|
4
|
+
version: 0.0.12
|
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: 2014-05-
|
11
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- lib/bookingsync/api.rb
|
101
101
|
- lib/bookingsync/api/client.rb
|
102
102
|
- lib/bookingsync/api/client/amenities.rb
|
103
|
+
- lib/bookingsync/api/client/availabilities.rb
|
103
104
|
- lib/bookingsync/api/client/billing_addresses.rb
|
104
105
|
- lib/bookingsync/api/client/bookings.rb
|
105
106
|
- lib/bookingsync/api/client/bookings_payments.rb
|
@@ -127,6 +128,7 @@ files:
|
|
127
128
|
- lib/bookingsync/api/serializer.rb
|
128
129
|
- lib/bookingsync/api/version.rb
|
129
130
|
- spec/bookingsync/api/client/amenities_spec.rb
|
131
|
+
- spec/bookingsync/api/client/availabilities_spec.rb
|
130
132
|
- spec/bookingsync/api/client/billing_addresses_spec.rb
|
131
133
|
- spec/bookingsync/api/client/billings_payments_spec.rb
|
132
134
|
- spec/bookingsync/api/client/bookings_spec.rb
|
@@ -152,6 +154,7 @@ files:
|
|
152
154
|
- spec/bookingsync/api_spec.rb
|
153
155
|
- spec/fixtures/cassettes/BookingSync_API_Client_Amenities/_amenities/returns_amenities.yml
|
154
156
|
- spec/fixtures/cassettes/BookingSync_API_Client_Amenities/_amenity/returns_amenity.yml
|
157
|
+
- spec/fixtures/cassettes/BookingSync_API_Client_Availabilities/_availabilities/returns_availabilities.yml
|
155
158
|
- spec/fixtures/cassettes/BookingSync_API_Client_BillingAddresses/_billing_addresses/returns_billing_addresses.yml
|
156
159
|
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_a_block/yields_block_with_batch_of_bookings.yml
|
157
160
|
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_auto_paginate_true/returns_all_bookings_joined_from_many_requests.yml
|
@@ -246,6 +249,7 @@ specification_version: 4
|
|
246
249
|
summary: Ruby interface for accessing https://www.bookingsync.com
|
247
250
|
test_files:
|
248
251
|
- spec/bookingsync/api/client/amenities_spec.rb
|
252
|
+
- spec/bookingsync/api/client/availabilities_spec.rb
|
249
253
|
- spec/bookingsync/api/client/billing_addresses_spec.rb
|
250
254
|
- spec/bookingsync/api/client/billings_payments_spec.rb
|
251
255
|
- spec/bookingsync/api/client/bookings_spec.rb
|
@@ -271,6 +275,7 @@ test_files:
|
|
271
275
|
- spec/bookingsync/api_spec.rb
|
272
276
|
- spec/fixtures/cassettes/BookingSync_API_Client_Amenities/_amenities/returns_amenities.yml
|
273
277
|
- spec/fixtures/cassettes/BookingSync_API_Client_Amenities/_amenity/returns_amenity.yml
|
278
|
+
- spec/fixtures/cassettes/BookingSync_API_Client_Availabilities/_availabilities/returns_availabilities.yml
|
274
279
|
- spec/fixtures/cassettes/BookingSync_API_Client_BillingAddresses/_billing_addresses/returns_billing_addresses.yml
|
275
280
|
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_a_block/yields_block_with_batch_of_bookings.yml
|
276
281
|
- spec/fixtures/cassettes/BookingSync_API_Client_Bookings/_bookings/pagination/with_auto_paginate_true/returns_all_bookings_joined_from_many_requests.yml
|