bookingsync-api 0.0.36 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -3
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -0
- data/lib/bookingsync/api/client.rb +9 -4
- data/lib/bookingsync/api/client/rentals.rb +3 -2
- data/lib/bookingsync/api/relation.rb +26 -15
- data/lib/bookingsync/api/version.rb +1 -1
- data/spec/bookingsync/api/client/rentals_spec.rb +15 -5
- data/spec/bookingsync/api/relation_spec.rb +17 -10
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/performs_autopagination_using_POST.yml +293 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/rentals_ids_given/makes_a_search_within_given_rentals.yml +33 -27
- data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/returns_rentals.yml +33 -27
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 791a70ff288a995656ed021019811a153c09bbd0
|
4
|
+
data.tar.gz: f55cf148e2733e12ec2796735048b66ff0c04b74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e65b235c91d8c111565be32d5550ea1b1e0ecec399c1d094211dc06737e1b4096a840ed58dc3b812565b672009a8bbb6283edb497f276de04f0d8a76c086c102
|
7
|
+
data.tar.gz: c482ab2587d45b767be5cdb58b8ff687b245e4beb999b119bbbae6370da1b74ddbd306bf584212cd0a01926d94d86c19514e032560894446af1cbab5fc7ef6e0
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -183,7 +183,7 @@ module BookingSync::API
|
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
186
|
-
# Make a HTTP GET request to a path with pagination support.
|
186
|
+
# Make a HTTP GET or POST request to a path with pagination support.
|
187
187
|
#
|
188
188
|
# @param options [Hash]
|
189
189
|
# @option options [Integer] per_page: Number of resources per page
|
@@ -196,7 +196,12 @@ module BookingSync::API
|
|
196
196
|
def paginate(path, options = {}, &block)
|
197
197
|
instrument("paginate.bookingsync_api", path: path) do
|
198
198
|
auto_paginate = options.delete(:auto_paginate)
|
199
|
-
|
199
|
+
request_method = options.delete(:request_method) || :get
|
200
|
+
if request_method == :get
|
201
|
+
response = call(request_method, path, query: options)
|
202
|
+
else
|
203
|
+
response = call(request_method, path, options)
|
204
|
+
end
|
200
205
|
data = response.resources.dup
|
201
206
|
|
202
207
|
if (block_given? or auto_paginate) && response.relations[:next]
|
@@ -209,7 +214,7 @@ module BookingSync::API
|
|
209
214
|
first_request = false
|
210
215
|
end
|
211
216
|
break unless response.relations[:next]
|
212
|
-
response = response.relations[:next].
|
217
|
+
response = response.relations[:next].call({}, method: request_method)
|
213
218
|
end
|
214
219
|
end
|
215
220
|
|
@@ -229,7 +234,7 @@ module BookingSync::API
|
|
229
234
|
instrument("call.bookingsync_api", method: method, path: path) do
|
230
235
|
if [:get, :head].include?(method)
|
231
236
|
options = data
|
232
|
-
data =
|
237
|
+
data = {}
|
233
238
|
end
|
234
239
|
options ||= {}
|
235
240
|
options[:headers] ||= {}
|
@@ -31,7 +31,8 @@ module BookingSync::API
|
|
31
31
|
def rentals_search(options = {}, &block)
|
32
32
|
ids = Array(options.delete(:ids))
|
33
33
|
path = ["rentals", ids.join(","), "search"].compact.join("/")
|
34
|
-
|
34
|
+
defaults = { request_method: :post }
|
35
|
+
paginate path, defaults.merge(options), &block
|
35
36
|
end
|
36
37
|
|
37
38
|
# Get a single rental
|
@@ -82,4 +83,4 @@ module BookingSync::API
|
|
82
83
|
end
|
83
84
|
end
|
84
85
|
end
|
85
|
-
end
|
86
|
+
end
|
@@ -11,11 +11,9 @@ module BookingSync::API
|
|
11
11
|
# @param links [Hash] Hash of relation_name => relation options.
|
12
12
|
# @return [Hash] Hash of relation_name => relation elements.
|
13
13
|
def self.from_links(client, links)
|
14
|
-
|
15
|
-
links.each do |name, options|
|
14
|
+
links.to_h.each_with_object({}) do |(name, options), relations|
|
16
15
|
relations[name] = from_link(client, name, options)
|
17
|
-
end
|
18
|
-
relations
|
16
|
+
end
|
19
17
|
end
|
20
18
|
|
21
19
|
# Build a single Relation from the given options.
|
@@ -50,7 +48,6 @@ module BookingSync::API
|
|
50
48
|
@href = href
|
51
49
|
@href_template = ::Addressable::Template.new(href.to_s)
|
52
50
|
@method = (method || :get).to_sym
|
53
|
-
@available_methods = Set.new methods || [@method]
|
54
51
|
end
|
55
52
|
|
56
53
|
# Make an API request with the curent Relation using GET.
|
@@ -60,15 +57,19 @@ module BookingSync::API
|
|
60
57
|
# @option options [Hash] query: Hash of URL query params to set.
|
61
58
|
# @option options [Symbol] method: Symbol HTTP method.
|
62
59
|
# @return [BookingSync::API::Response] A response
|
63
|
-
def get(
|
64
|
-
|
65
|
-
options[:method] = :get
|
66
|
-
call options
|
60
|
+
def get(data = {})
|
61
|
+
call data, method: :get
|
67
62
|
end
|
68
63
|
|
69
|
-
|
70
|
-
|
71
|
-
|
64
|
+
# Make an API request with the curent Relation using POST.
|
65
|
+
#
|
66
|
+
# @param options [Hash] Options to configure the API request.
|
67
|
+
# @option options [Hash] headers: Hash of API headers to set.
|
68
|
+
# @option options [Hash] query: Hash of URL query params to set.
|
69
|
+
# @option options [Symbol] method: Symbol HTTP method.
|
70
|
+
# @return [BookingSync::API::Response] A response
|
71
|
+
def post(data = {})
|
72
|
+
call data, method: :post
|
72
73
|
end
|
73
74
|
|
74
75
|
# Make an API request with the curent Relation.
|
@@ -81,9 +82,19 @@ module BookingSync::API
|
|
81
82
|
# @option options [Hash] query: Hash of URL query params to set.
|
82
83
|
# @option options [Symbol] method: Symbol HTTP method.
|
83
84
|
# @return [BookingSync::API::Response]
|
84
|
-
def call(data =
|
85
|
-
m = options
|
86
|
-
|
85
|
+
def call(data = {}, options = {})
|
86
|
+
m = options.delete(:method)
|
87
|
+
client.call m || method, href_template, data, options
|
88
|
+
end
|
89
|
+
|
90
|
+
# Return expanded URL
|
91
|
+
|
92
|
+
# @param options [Hash] Params to be included in expanded URL
|
93
|
+
# @return [String] expanded URL
|
94
|
+
|
95
|
+
def href(options = {})
|
96
|
+
return @href if @href_template.nil?
|
97
|
+
@href_template.expand(options.to_h).to_s
|
87
98
|
end
|
88
99
|
end
|
89
100
|
end
|
@@ -25,18 +25,28 @@ describe BookingSync::API::Client::Rentals do
|
|
25
25
|
|
26
26
|
describe ".rentals_search", :vcr do
|
27
27
|
it "returns rentals" do
|
28
|
-
expect(client.rentals_search(start_at: "
|
29
|
-
assert_requested :
|
28
|
+
expect(client.rentals_search(start_at: "2016-06-15", end_at: "2016-06-30")).not_to be_empty
|
29
|
+
assert_requested :post, bs_url("rentals/search"),
|
30
|
+
body: { start_at: "2016-06-15", end_at: "2016-06-30" }.to_json
|
30
31
|
end
|
31
32
|
|
32
33
|
context "rentals ids given" do
|
33
34
|
it "makes a search within given rentals" do
|
34
|
-
rentals = client.rentals_search(ids: [
|
35
|
-
start_at: "2014-06-20", end_at: "2014-06-25")
|
35
|
+
rentals = client.rentals_search(ids: [1, 5], start_at: "2016-06-15", end_at: "2016-06-30")
|
36
36
|
expect(rentals.size).to eq(1)
|
37
|
-
assert_requested :
|
37
|
+
assert_requested :post, bs_url("rentals/1,5/search"),
|
38
|
+
body: { start_at: "2016-06-15", end_at: "2016-06-30" }.to_json
|
38
39
|
end
|
39
40
|
end
|
41
|
+
|
42
|
+
it "performs autopagination using POST" do
|
43
|
+
rentals = client.rentals_search(per_page: 1, auto_paginate: true)
|
44
|
+
expect(rentals.size).to eq(4)
|
45
|
+
assert_requested :post, bs_url("rentals/search"), body: { per_page: 1 }.to_json
|
46
|
+
assert_requested :post, bs_url("rentals/search?page=2&per_page=1")
|
47
|
+
assert_requested :post, bs_url("rentals/search?page=3&per_page=1")
|
48
|
+
assert_requested :post, bs_url("rentals/search?page=4&per_page=1")
|
49
|
+
end
|
40
50
|
end
|
41
51
|
|
42
52
|
describe ".rental", :vcr do
|
@@ -25,24 +25,31 @@ describe BookingSync::API::Relation do
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
describe "#
|
29
|
-
|
30
|
-
|
31
|
-
it "makes HTTP request using API client" do
|
28
|
+
describe "#get" do
|
29
|
+
it "makes a HTTP GET request using call on client" do
|
32
30
|
url_template = ::Addressable::Template.new("http://example.com/photos/{foo.photos}")
|
33
|
-
expect(client).to receive(:call).with(:get, url_template,
|
34
|
-
relation.
|
31
|
+
expect(client).to receive(:call).with(:get, url_template, {fields: [:name, :description]}, {})
|
32
|
+
relation.get(fields: [:name, :description])
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
38
|
-
describe "#
|
39
|
-
it "makes a HTTP
|
36
|
+
describe "#post" do
|
37
|
+
it "makes a HTTP POST request using call on client" do
|
40
38
|
url_template = ::Addressable::Template.new("http://example.com/photos/{foo.photos}")
|
41
|
-
expect(
|
42
|
-
relation.
|
39
|
+
expect(client).to receive(:call).with(:post, url_template, {fields: [:name, :description]}, {})
|
40
|
+
relation.post(fields: [:name, :description])
|
43
41
|
end
|
44
42
|
end
|
45
43
|
|
44
|
+
describe "#call" do
|
45
|
+
let(:client) { double(BookingSync::API::Client) }
|
46
|
+
|
47
|
+
it "makes HTTP request using API client" do
|
48
|
+
url_template = ::Addressable::Template.new("http://example.com/photos/{foo.photos}")
|
49
|
+
expect(client).to receive(:call).with(:get, url_template, {}, {})
|
50
|
+
relation.call
|
51
|
+
end
|
52
|
+
end
|
46
53
|
|
47
54
|
describe "#name" do
|
48
55
|
it "returns relation name" do
|
@@ -0,0 +1,293 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://www.bookingsync.com/api/v3/rentals/search
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"per_page":1}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- BookingSync API gem v0.0.36
|
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
|
+
- '1465578000'
|
35
|
+
X-Ratelimit-Remaining:
|
36
|
+
- '994'
|
37
|
+
Link:
|
38
|
+
- <https://www.bookingsync.com/api/v3/rentals/search?page=1&per_page=1>; rel="first",
|
39
|
+
<https://www.bookingsync.com/api/v3/rentals/search?page=2&per_page=1>; rel="next",
|
40
|
+
<https://www.bookingsync.com/api/v3/rentals/search?page=4&per_page=1>; rel="last"
|
41
|
+
X-Total-Pages:
|
42
|
+
- '4'
|
43
|
+
X-Total-Count:
|
44
|
+
- '4'
|
45
|
+
X-Per-Page:
|
46
|
+
- '1'
|
47
|
+
Content-Type:
|
48
|
+
- application/vnd.api+json; charset=utf-8
|
49
|
+
Etag:
|
50
|
+
- '"6086ae8645789e508c72b4059c55dd0f"'
|
51
|
+
Cache-Control:
|
52
|
+
- max-age=0, private, must-revalidate
|
53
|
+
P3p:
|
54
|
+
- CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
|
55
|
+
OUR SAMi OTRo UNRo PUBi IND UNI STA"
|
56
|
+
Set-Cookie:
|
57
|
+
- ahoy_track=true; path=/
|
58
|
+
- ahoy_visit=ae0d9abc-7e07-47bc-ae70-c1fb554607aa; path=/; expires=Fri, 17 Jun
|
59
|
+
2016 16:03:21 -0000
|
60
|
+
- ahoy_visitor=4b2d5579-802d-4483-b4da-37cbe4af7a68; path=/; expires=Sun, 10
|
61
|
+
Jun 2018 16:03:21 -0000
|
62
|
+
X-Request-Id:
|
63
|
+
- 52fb60fa-59db-4a9b-9b15-4309124a3245
|
64
|
+
X-Runtime:
|
65
|
+
- '0.652057'
|
66
|
+
Date:
|
67
|
+
- Fri, 10 Jun 2016 16:03:21 GMT
|
68
|
+
Connection:
|
69
|
+
- close
|
70
|
+
body:
|
71
|
+
encoding: UTF-8
|
72
|
+
string: '{"links":{"rentals.rentals_fees":"https://www.bookingsync.com/api/v3/rentals_fees/{rentals.rentals_fees}"},"rentals":[{"links":{"rentals_fees":[6,1,3]},"id":1,"currency":"EUR","initial_price":null,"final_price":null,"updated_at":"2016-06-10T15:32:54Z","taxes":[],"price_details":{"taxes":[],"fees":[]},"price_to_pay_now":null}]}'
|
73
|
+
http_version:
|
74
|
+
recorded_at: Fri, 10 Jun 2016 16:03:21 GMT
|
75
|
+
- request:
|
76
|
+
method: post
|
77
|
+
uri: https://www.bookingsync.com/api/v3/rentals/search?page=2&per_page=1
|
78
|
+
body:
|
79
|
+
encoding: UTF-8
|
80
|
+
string: "{}"
|
81
|
+
headers:
|
82
|
+
User-Agent:
|
83
|
+
- BookingSync API gem v0.0.36
|
84
|
+
Accept:
|
85
|
+
- application/vnd.api+json
|
86
|
+
Content-Type:
|
87
|
+
- application/vnd.api+json
|
88
|
+
Authorization:
|
89
|
+
- Bearer <<ACCESS_TOKEN>>
|
90
|
+
Accept-Encoding:
|
91
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
92
|
+
response:
|
93
|
+
status:
|
94
|
+
code: 200
|
95
|
+
message: OK
|
96
|
+
headers:
|
97
|
+
X-Frame-Options:
|
98
|
+
- SAMEORIGIN
|
99
|
+
X-Xss-Protection:
|
100
|
+
- 1; mode=block
|
101
|
+
X-Content-Type-Options:
|
102
|
+
- nosniff
|
103
|
+
X-Ratelimit-Limit:
|
104
|
+
- '1000'
|
105
|
+
X-Ratelimit-Reset:
|
106
|
+
- '1465578000'
|
107
|
+
X-Ratelimit-Remaining:
|
108
|
+
- '993'
|
109
|
+
Link:
|
110
|
+
- <https://www.bookingsync.com/api/v3/rentals/search?page=1&per_page=1>; rel="first",
|
111
|
+
<https://www.bookingsync.com/api/v3/rentals/search?page=1&per_page=1>; rel="prev",
|
112
|
+
<https://www.bookingsync.com/api/v3/rentals/search?page=3&per_page=1>; rel="next",
|
113
|
+
<https://www.bookingsync.com/api/v3/rentals/search?page=4&per_page=1>; rel="last"
|
114
|
+
X-Total-Pages:
|
115
|
+
- '4'
|
116
|
+
X-Total-Count:
|
117
|
+
- '4'
|
118
|
+
X-Per-Page:
|
119
|
+
- '1'
|
120
|
+
Content-Type:
|
121
|
+
- application/vnd.api+json; charset=utf-8
|
122
|
+
Etag:
|
123
|
+
- '"548ee359e03a5cfe1365e07970e796b9"'
|
124
|
+
Cache-Control:
|
125
|
+
- max-age=0, private, must-revalidate
|
126
|
+
P3p:
|
127
|
+
- CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
|
128
|
+
OUR SAMi OTRo UNRo PUBi IND UNI STA"
|
129
|
+
Set-Cookie:
|
130
|
+
- ahoy_track=true; path=/
|
131
|
+
- ahoy_visit=53c6ecd7-0735-453a-ad1f-a53cf26dc7cc; path=/; expires=Fri, 17 Jun
|
132
|
+
2016 16:03:21 -0000
|
133
|
+
- ahoy_visitor=8a5fec08-a9db-4ccf-9a20-950bd08eb783; path=/; expires=Sun, 10
|
134
|
+
Jun 2018 16:03:21 -0000
|
135
|
+
X-Request-Id:
|
136
|
+
- 05c66d45-0073-49e9-b3f6-8352029aa530
|
137
|
+
X-Runtime:
|
138
|
+
- '0.572418'
|
139
|
+
Date:
|
140
|
+
- Fri, 10 Jun 2016 16:03:22 GMT
|
141
|
+
Connection:
|
142
|
+
- close
|
143
|
+
body:
|
144
|
+
encoding: UTF-8
|
145
|
+
string: '{"links":{"rentals.rentals_fees":"https://www.bookingsync.com/api/v3/rentals_fees/{rentals.rentals_fees}"},"rentals":[{"links":{"rentals_fees":[8,7]},"id":2,"currency":"EUR","initial_price":null,"final_price":null,"updated_at":"2016-06-10T15:37:12Z","taxes":[],"price_details":{"taxes":[],"fees":[]},"price_to_pay_now":null}]}'
|
146
|
+
http_version:
|
147
|
+
recorded_at: Fri, 10 Jun 2016 16:03:22 GMT
|
148
|
+
- request:
|
149
|
+
method: post
|
150
|
+
uri: https://www.bookingsync.com/api/v3/rentals/search?page=3&per_page=1
|
151
|
+
body:
|
152
|
+
encoding: UTF-8
|
153
|
+
string: "{}"
|
154
|
+
headers:
|
155
|
+
User-Agent:
|
156
|
+
- BookingSync API gem v0.0.36
|
157
|
+
Accept:
|
158
|
+
- application/vnd.api+json
|
159
|
+
Content-Type:
|
160
|
+
- application/vnd.api+json
|
161
|
+
Authorization:
|
162
|
+
- Bearer <<ACCESS_TOKEN>>
|
163
|
+
Accept-Encoding:
|
164
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
165
|
+
response:
|
166
|
+
status:
|
167
|
+
code: 200
|
168
|
+
message: OK
|
169
|
+
headers:
|
170
|
+
X-Frame-Options:
|
171
|
+
- SAMEORIGIN
|
172
|
+
X-Xss-Protection:
|
173
|
+
- 1; mode=block
|
174
|
+
X-Content-Type-Options:
|
175
|
+
- nosniff
|
176
|
+
X-Ratelimit-Limit:
|
177
|
+
- '1000'
|
178
|
+
X-Ratelimit-Reset:
|
179
|
+
- '1465578000'
|
180
|
+
X-Ratelimit-Remaining:
|
181
|
+
- '992'
|
182
|
+
Link:
|
183
|
+
- <https://www.bookingsync.com/api/v3/rentals/search?page=1&per_page=1>; rel="first",
|
184
|
+
<https://www.bookingsync.com/api/v3/rentals/search?page=2&per_page=1>; rel="prev",
|
185
|
+
<https://www.bookingsync.com/api/v3/rentals/search?page=4&per_page=1>; rel="next",
|
186
|
+
<https://www.bookingsync.com/api/v3/rentals/search?page=4&per_page=1>; rel="last"
|
187
|
+
X-Total-Pages:
|
188
|
+
- '4'
|
189
|
+
X-Total-Count:
|
190
|
+
- '4'
|
191
|
+
X-Per-Page:
|
192
|
+
- '1'
|
193
|
+
Content-Type:
|
194
|
+
- application/vnd.api+json; charset=utf-8
|
195
|
+
Etag:
|
196
|
+
- '"3bb7f13b08dc543ba66e990d61fbca25"'
|
197
|
+
Cache-Control:
|
198
|
+
- max-age=0, private, must-revalidate
|
199
|
+
P3p:
|
200
|
+
- CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
|
201
|
+
OUR SAMi OTRo UNRo PUBi IND UNI STA"
|
202
|
+
Set-Cookie:
|
203
|
+
- ahoy_track=true; path=/
|
204
|
+
- ahoy_visit=8b53ff2d-0b0d-405a-acac-4dec612ac439; path=/; expires=Fri, 17 Jun
|
205
|
+
2016 16:03:22 -0000
|
206
|
+
- ahoy_visitor=f64c95f4-5a9a-4b1b-b3a0-78b8fbfbd6d0; path=/; expires=Sun, 10
|
207
|
+
Jun 2018 16:03:22 -0000
|
208
|
+
X-Request-Id:
|
209
|
+
- 0fa63435-6dc3-44da-ad2e-6f61ac59fc17
|
210
|
+
X-Runtime:
|
211
|
+
- '0.652436'
|
212
|
+
Date:
|
213
|
+
- Fri, 10 Jun 2016 16:03:23 GMT
|
214
|
+
Connection:
|
215
|
+
- close
|
216
|
+
body:
|
217
|
+
encoding: UTF-8
|
218
|
+
string: '{"links":{"rentals.rentals_fees":"https://www.bookingsync.com/api/v3/rentals_fees/{rentals.rentals_fees}"},"rentals":[{"links":{"rentals_fees":[30,29]},"id":3,"currency":"USD","initial_price":null,"final_price":null,"updated_at":"2016-06-10T15:37:25Z","taxes":[],"price_details":{"taxes":[],"fees":[]},"price_to_pay_now":null}]}'
|
219
|
+
http_version:
|
220
|
+
recorded_at: Fri, 10 Jun 2016 16:03:23 GMT
|
221
|
+
- request:
|
222
|
+
method: post
|
223
|
+
uri: https://www.bookingsync.com/api/v3/rentals/search?page=4&per_page=1
|
224
|
+
body:
|
225
|
+
encoding: UTF-8
|
226
|
+
string: "{}"
|
227
|
+
headers:
|
228
|
+
User-Agent:
|
229
|
+
- BookingSync API gem v0.0.36
|
230
|
+
Accept:
|
231
|
+
- application/vnd.api+json
|
232
|
+
Content-Type:
|
233
|
+
- application/vnd.api+json
|
234
|
+
Authorization:
|
235
|
+
- Bearer <<ACCESS_TOKEN>>
|
236
|
+
Accept-Encoding:
|
237
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
238
|
+
response:
|
239
|
+
status:
|
240
|
+
code: 200
|
241
|
+
message: OK
|
242
|
+
headers:
|
243
|
+
X-Frame-Options:
|
244
|
+
- SAMEORIGIN
|
245
|
+
X-Xss-Protection:
|
246
|
+
- 1; mode=block
|
247
|
+
X-Content-Type-Options:
|
248
|
+
- nosniff
|
249
|
+
X-Ratelimit-Limit:
|
250
|
+
- '1000'
|
251
|
+
X-Ratelimit-Reset:
|
252
|
+
- '1465578000'
|
253
|
+
X-Ratelimit-Remaining:
|
254
|
+
- '991'
|
255
|
+
Link:
|
256
|
+
- <https://www.bookingsync.com/api/v3/rentals/search?page=1&per_page=1>; rel="first",
|
257
|
+
<https://www.bookingsync.com/api/v3/rentals/search?page=3&per_page=1>; rel="prev",
|
258
|
+
<https://www.bookingsync.com/api/v3/rentals/search?page=4&per_page=1>; rel="last"
|
259
|
+
X-Total-Pages:
|
260
|
+
- '4'
|
261
|
+
X-Total-Count:
|
262
|
+
- '4'
|
263
|
+
X-Per-Page:
|
264
|
+
- '1'
|
265
|
+
Content-Type:
|
266
|
+
- application/vnd.api+json; charset=utf-8
|
267
|
+
Etag:
|
268
|
+
- '"ec22e49e518880ca8238747be3b5be33"'
|
269
|
+
Cache-Control:
|
270
|
+
- max-age=0, private, must-revalidate
|
271
|
+
P3p:
|
272
|
+
- CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
|
273
|
+
OUR SAMi OTRo UNRo PUBi IND UNI STA"
|
274
|
+
Set-Cookie:
|
275
|
+
- ahoy_track=true; path=/
|
276
|
+
- ahoy_visit=e8410cd4-d8ef-4300-9f74-39de88ab5c91; path=/; expires=Fri, 17 Jun
|
277
|
+
2016 16:03:23 -0000
|
278
|
+
- ahoy_visitor=67c3a830-640f-4c37-b4a6-fbcc016daf39; path=/; expires=Sun, 10
|
279
|
+
Jun 2018 16:03:23 -0000
|
280
|
+
X-Request-Id:
|
281
|
+
- 01caa49a-69c8-47b5-92ea-88c3d8d35d39
|
282
|
+
X-Runtime:
|
283
|
+
- '0.602880'
|
284
|
+
Date:
|
285
|
+
- Fri, 10 Jun 2016 16:03:23 GMT
|
286
|
+
Connection:
|
287
|
+
- close
|
288
|
+
body:
|
289
|
+
encoding: UTF-8
|
290
|
+
string: '{"links":{"rentals.rentals_fees":"https://www.bookingsync.com/api/v3/rentals_fees/{rentals.rentals_fees}"},"rentals":[{"links":{"rentals_fees":[]},"id":154,"currency":null,"initial_price":null,"final_price":null,"updated_at":"2016-06-07T11:00:34Z","taxes":[],"price_details":{"taxes":[],"fees":[]},"price_to_pay_now":null}]}'
|
291
|
+
http_version:
|
292
|
+
recorded_at: Fri, 10 Jun 2016 16:03:23 GMT
|
293
|
+
recorded_with: VCR 2.9.3
|
@@ -1,14 +1,14 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
|
-
method:
|
5
|
-
uri:
|
4
|
+
method: post
|
5
|
+
uri: http://bookingsync.dev/api/v3/rentals/1,5/search
|
6
6
|
body:
|
7
|
-
encoding:
|
8
|
-
string: ''
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"start_at":"2016-06-15","end_at":"2016-06-30"}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
-
|
11
|
+
- BookingSync API gem v0.0.36
|
12
12
|
Accept:
|
13
13
|
- application/vnd.api+json
|
14
14
|
Content-Type:
|
@@ -22,44 +22,50 @@ http_interactions:
|
|
22
22
|
code: 200
|
23
23
|
message: OK
|
24
24
|
headers:
|
25
|
+
X-Frame-Options:
|
26
|
+
- SAMEORIGIN
|
27
|
+
X-Xss-Protection:
|
28
|
+
- 1; mode=block
|
29
|
+
X-Content-Type-Options:
|
30
|
+
- nosniff
|
25
31
|
X-Ratelimit-Limit:
|
26
32
|
- '1000'
|
27
33
|
X-Ratelimit-Reset:
|
28
|
-
- '
|
34
|
+
- '1465574400'
|
29
35
|
X-Ratelimit-Remaining:
|
30
|
-
- '
|
31
|
-
Link:
|
32
|
-
- <https://www.bookingsync.com/api/v3/rentals/323,354/search?end_at=2014-06-25&max_price=400&page=1&start_at=2014-06-20>;
|
33
|
-
rel="first", <https://www.bookingsync.com/api/v3/rentals/323,354/search?end_at=2014-06-25&max_price=400&page=1&start_at=2014-06-20>;
|
34
|
-
rel="last"
|
35
|
-
X-Total-Pages:
|
36
|
-
- '1'
|
37
|
-
Access-Control-Allow-Origin:
|
38
|
-
- "*"
|
39
|
-
Access-Control-Request-Method:
|
40
|
-
- "*"
|
36
|
+
- '992'
|
41
37
|
Content-Type:
|
42
38
|
- application/vnd.api+json; charset=utf-8
|
43
|
-
X-Ua-Compatible:
|
44
|
-
- IE=Edge
|
45
39
|
Etag:
|
46
|
-
- '"
|
40
|
+
- '"c98c554a9f7cf1fee44953129a5e8df5"'
|
47
41
|
Cache-Control:
|
48
42
|
- max-age=0, private, must-revalidate
|
49
43
|
P3p:
|
50
44
|
- CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
|
51
45
|
OUR SAMi OTRo UNRo PUBi IND UNI STA"
|
46
|
+
Set-Cookie:
|
47
|
+
- ahoy_track=true; path=/
|
48
|
+
- ahoy_visit=8f1a606c-9274-431c-8253-d12c45b0bc0a; path=/; expires=Fri, 17 Jun
|
49
|
+
2016 15:33:21 -0000
|
50
|
+
- ahoy_visitor=8f727d5f-a25b-4b93-85c6-930a20d22712; path=/; expires=Sun, 10
|
51
|
+
Jun 2018 15:33:21 -0000
|
52
52
|
X-Request-Id:
|
53
|
-
-
|
53
|
+
- 51f0efed-3c73-405c-b9ce-910edee3d546
|
54
54
|
X-Runtime:
|
55
|
-
- '0.
|
55
|
+
- '0.324886'
|
56
56
|
Date:
|
57
|
-
-
|
57
|
+
- Fri, 10 Jun 2016 15:33:22 GMT
|
58
58
|
Connection:
|
59
59
|
- close
|
60
60
|
body:
|
61
61
|
encoding: UTF-8
|
62
|
-
string: '{"rentals":[{"id":
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
string: '{"links":{"rentals.rentals_fees":"http://bookingsync.dev/api/v3/rentals_fees/{rentals.rentals_fees}"},"rentals":[{"links":{"rentals_fees":[6,1,3]},"id":1,"currency":"EUR","initial_price":1094.4,"final_price":3979.69,"updated_at":"2016-06-10T15:32:54Z","taxes":[{"name":{"fr":"VAT
|
63
|
+
fr","en":"VAT"},"percentage":"23.0","amount":"686.49"}],"price_details":{"taxes":[{"name":{"fr":"VAT
|
64
|
+
fr","en":"VAT"},"percentage":"23.0","amount":"228.83","taxable_type":"Rental","taxable_id":1,"tax_id":1,"included":false},{"name":{"fr":"z
|
65
|
+
other FR","en":"other"},"percentage":"10.0","amount":"99.49","taxable_type":"Rental","taxable_id":1,"tax_id":2,"included":true},{"name":{"fr":"VAT
|
66
|
+
fr","en":"VAT"},"percentage":"23.0","amount":"457.66","taxable_type":"Fee","taxable_id":2,"tax_id":1,"included":false},{"name":{"fr":"z
|
67
|
+
other FR","en":"other"},"percentage":"10.0","amount":"198.98","taxable_type":"Fee","taxable_id":2,"tax_id":2,"included":true}],"fees":[{"name":{"fr":"whatever
|
68
|
+
car","en":"Car"},"required":true,"price":"2188.8","quantity":1,"id":2,"rentals_fee_id":1},{"name":{"fr":"","en":"whatever"},"required":true,"price":"10.0","quantity":1,"id":5,"rentals_fee_id":3}]},"price_to_pay_now":3979.69}]}'
|
69
|
+
http_version:
|
70
|
+
recorded_at: Fri, 10 Jun 2016 15:33:22 GMT
|
71
|
+
recorded_with: VCR 2.9.3
|
data/spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/returns_rentals.yml
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
|
-
method:
|
5
|
-
uri:
|
4
|
+
method: post
|
5
|
+
uri: http://bookingsync.dev/api/v3/rentals/search
|
6
6
|
body:
|
7
|
-
encoding:
|
8
|
-
string: ''
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"start_at":"2016-06-15","end_at":"2016-06-30"}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
-
|
11
|
+
- BookingSync API gem v0.0.36
|
12
12
|
Accept:
|
13
13
|
- application/vnd.api+json
|
14
14
|
Content-Type:
|
@@ -22,44 +22,50 @@ http_interactions:
|
|
22
22
|
code: 200
|
23
23
|
message: OK
|
24
24
|
headers:
|
25
|
+
X-Frame-Options:
|
26
|
+
- SAMEORIGIN
|
27
|
+
X-Xss-Protection:
|
28
|
+
- 1; mode=block
|
29
|
+
X-Content-Type-Options:
|
30
|
+
- nosniff
|
25
31
|
X-Ratelimit-Limit:
|
26
32
|
- '1000'
|
27
33
|
X-Ratelimit-Reset:
|
28
|
-
- '
|
34
|
+
- '1465574400'
|
29
35
|
X-Ratelimit-Remaining:
|
30
|
-
- '
|
31
|
-
Link:
|
32
|
-
- <https://www.bookingsync.com/api/v3/rentals/search?end_at=2014-06-25&page=1&start_at=2014-06-20>;
|
33
|
-
rel="first", <https://www.bookingsync.com/api/v3/rentals/search?end_at=2014-06-25&page=1&start_at=2014-06-20>;
|
34
|
-
rel="last"
|
35
|
-
X-Total-Pages:
|
36
|
-
- '1'
|
37
|
-
Access-Control-Allow-Origin:
|
38
|
-
- "*"
|
39
|
-
Access-Control-Request-Method:
|
40
|
-
- "*"
|
36
|
+
- '990'
|
41
37
|
Content-Type:
|
42
38
|
- application/vnd.api+json; charset=utf-8
|
43
|
-
X-Ua-Compatible:
|
44
|
-
- IE=Edge
|
45
39
|
Etag:
|
46
|
-
- '"
|
40
|
+
- '"c98c554a9f7cf1fee44953129a5e8df5"'
|
47
41
|
Cache-Control:
|
48
42
|
- max-age=0, private, must-revalidate
|
49
43
|
P3p:
|
50
44
|
- CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
|
51
45
|
OUR SAMi OTRo UNRo PUBi IND UNI STA"
|
46
|
+
Set-Cookie:
|
47
|
+
- ahoy_track=true; path=/
|
48
|
+
- ahoy_visit=ca5992fc-a552-4b8c-982d-ce80dd953aa7; path=/; expires=Fri, 17 Jun
|
49
|
+
2016 15:35:58 -0000
|
50
|
+
- ahoy_visitor=0a766d1d-8868-4620-88e0-89d1d867b395; path=/; expires=Sun, 10
|
51
|
+
Jun 2018 15:35:58 -0000
|
52
52
|
X-Request-Id:
|
53
|
-
-
|
53
|
+
- 3e07fee8-683c-4716-8c83-1857d725f6c7
|
54
54
|
X-Runtime:
|
55
|
-
- '0.
|
55
|
+
- '0.327679'
|
56
56
|
Date:
|
57
|
-
-
|
57
|
+
- Fri, 10 Jun 2016 15:35:59 GMT
|
58
58
|
Connection:
|
59
59
|
- close
|
60
60
|
body:
|
61
61
|
encoding: UTF-8
|
62
|
-
string: '{"
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
string: '{"links":{"rentals.rentals_fees":"http://bookingsync.dev/api/v3/rentals_fees/{rentals.rentals_fees}"},"rentals":[{"links":{"rentals_fees":[6,1,3]},"id":1,"currency":"EUR","initial_price":1094.4,"final_price":3979.69,"updated_at":"2016-06-10T15:32:54Z","taxes":[{"name":{"fr":"VAT
|
63
|
+
fr","en":"VAT"},"percentage":"23.0","amount":"686.49"}],"price_details":{"taxes":[{"name":{"fr":"VAT
|
64
|
+
fr","en":"VAT"},"percentage":"23.0","amount":"228.83","taxable_type":"Rental","taxable_id":1,"tax_id":1,"included":false},{"name":{"fr":"z
|
65
|
+
other FR","en":"other"},"percentage":"10.0","amount":"99.49","taxable_type":"Rental","taxable_id":1,"tax_id":2,"included":true},{"name":{"fr":"VAT
|
66
|
+
fr","en":"VAT"},"percentage":"23.0","amount":"457.66","taxable_type":"Fee","taxable_id":2,"tax_id":1,"included":false},{"name":{"fr":"z
|
67
|
+
other FR","en":"other"},"percentage":"10.0","amount":"198.98","taxable_type":"Fee","taxable_id":2,"tax_id":2,"included":true}],"fees":[{"name":{"fr":"whatever
|
68
|
+
car","en":"Car"},"required":true,"price":"2188.8","quantity":1,"id":2,"rentals_fee_id":1},{"name":{"fr":"","en":"whatever"},"required":true,"price":"10.0","quantity":1,"id":5,"rentals_fee_id":3}]},"price_to_pay_now":3979.69}]}'
|
69
|
+
http_version:
|
70
|
+
recorded_at: Fri, 10 Jun 2016 15:35:59 GMT
|
71
|
+
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
|
4
|
+
version: 0.1.0
|
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: 2016-
|
11
|
+
date: 2016-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -284,6 +284,7 @@ files:
|
|
284
284
|
- spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals/returns_rentals_by_ids.yml
|
285
285
|
- spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_meta/returns_meta_information_about_all_rentals.yml
|
286
286
|
- spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_meta/returns_meta_information_about_requested_rentals.yml
|
287
|
+
- spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/performs_autopagination_using_POST.yml
|
287
288
|
- spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/rentals_ids_given/makes_a_search_within_given_rentals.yml
|
288
289
|
- spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/returns_rentals.yml
|
289
290
|
- spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_create_rentals_amenity/creates_a_new_rentals_amenity.yml
|
@@ -339,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
339
340
|
version: '0'
|
340
341
|
requirements: []
|
341
342
|
rubyforge_project:
|
342
|
-
rubygems_version: 2.4.
|
343
|
+
rubygems_version: 2.4.3
|
343
344
|
signing_key:
|
344
345
|
specification_version: 4
|
345
346
|
summary: Ruby interface for accessing https://www.bookingsync.com
|
@@ -487,6 +488,7 @@ test_files:
|
|
487
488
|
- spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals/returns_rentals_by_ids.yml
|
488
489
|
- spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_meta/returns_meta_information_about_all_rentals.yml
|
489
490
|
- spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_meta/returns_meta_information_about_requested_rentals.yml
|
491
|
+
- spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/performs_autopagination_using_POST.yml
|
490
492
|
- spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/rentals_ids_given/makes_a_search_within_given_rentals.yml
|
491
493
|
- spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/returns_rentals.yml
|
492
494
|
- spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_create_rentals_amenity/creates_a_new_rentals_amenity.yml
|