bookingsync-api 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/bookingsync/api/client.rb +2 -0
- data/lib/bookingsync/api/client/accounts.rb +20 -0
- data/lib/bookingsync/api/version.rb +1 -1
- data/spec/bookingsync/api/client/accounts_spec.rb +12 -0
- data/spec/fixtures/cassettes/BookingSync_API_Client_Accounts/_accounts/returns_accounts.yml +80 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dedaad87f42d70c978bff57a60a9e0b2deaea48
|
4
|
+
data.tar.gz: 5c7c0db2aec98137b28a10ff5c0e01abe79e524f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84f451295c384728e84e1576abaf91c5f278949db93f432c1e6db48786bb2d310deaf74448998b39cd3ce62e7c7d4c30e1ff413a12c2afcf4b56e9782a30eac4
|
7
|
+
data.tar.gz: 8cdb15983d4e835904464cba00ef69691a10042847a54cb8c752d7f9c15543ba8ba86298f2bb82d97e1b7340dc816240bbe2376b554b6ba5f09b39f1c48a4e1f
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "bookingsync/api/middleware/logger"
|
2
|
+
require "bookingsync/api/client/accounts"
|
2
3
|
require "bookingsync/api/client/amenities"
|
3
4
|
require "bookingsync/api/client/availabilities"
|
4
5
|
require "bookingsync/api/client/billing_addresses"
|
@@ -35,6 +36,7 @@ require "logger"
|
|
35
36
|
module BookingSync::API
|
36
37
|
class Client
|
37
38
|
extend Forwardable
|
39
|
+
include BookingSync::API::Client::Accounts
|
38
40
|
include BookingSync::API::Client::Amenities
|
39
41
|
include BookingSync::API::Client::Availabilities
|
40
42
|
include BookingSync::API::Client::BillingAddresses
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module BookingSync::API
|
2
|
+
class Client
|
3
|
+
module Accounts
|
4
|
+
# List accounts
|
5
|
+
#
|
6
|
+
# Returns all the accounts that the 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 accounts.
|
10
|
+
#
|
11
|
+
# @example Get the list of accounts for the current account
|
12
|
+
# accounts = @api.accounts
|
13
|
+
# accounts.first.email # => "user@example.com"
|
14
|
+
# @see http://docs.api.bookingsync.com/reference/endpoints/accounts/#list-accounts
|
15
|
+
def accounts(options = {}, &block)
|
16
|
+
paginate :accounts, options, &block
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe BookingSync::API::Client::Accounts do
|
4
|
+
let(:client) { BookingSync::API::Client.new(test_access_token) }
|
5
|
+
|
6
|
+
describe ".accounts", :vcr do
|
7
|
+
it "returns accounts" do
|
8
|
+
expect(client.accounts).not_to be_empty
|
9
|
+
assert_requested :get, bs_url("accounts")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.bookingsync.com/api/v3/accounts
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- BookingSync API gem v0.0.24
|
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
|
+
- Sat, 11 Apr 2015 23:42:07 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
|
+
Strict-Transport-Security:
|
38
|
+
- max-age=31536000
|
39
|
+
X-Frame-Options:
|
40
|
+
- SAMEORIGIN
|
41
|
+
X-Xss-Protection:
|
42
|
+
- 1; mode=block
|
43
|
+
X-Content-Type-Options:
|
44
|
+
- nosniff
|
45
|
+
X-Ratelimit-Limit:
|
46
|
+
- '1000'
|
47
|
+
X-Ratelimit-Reset:
|
48
|
+
- '1428796800'
|
49
|
+
X-Ratelimit-Remaining:
|
50
|
+
- '908'
|
51
|
+
Link:
|
52
|
+
- <https://www.bookingsync.com/api/v3/accounts?page=1>; rel="first", <https://www.bookingsync.com/api/v3/accounts?page=1>;
|
53
|
+
rel="last"
|
54
|
+
X-Total-Pages:
|
55
|
+
- '1'
|
56
|
+
X-Total-Count:
|
57
|
+
- '1'
|
58
|
+
Etag:
|
59
|
+
- '"dd45670c9daed0df6d3050130202d15b"'
|
60
|
+
Cache-Control:
|
61
|
+
- max-age=0, private, must-revalidate
|
62
|
+
P3p:
|
63
|
+
- CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
|
64
|
+
OUR SAMi OTRo UNRo PUBi IND UNI STA"
|
65
|
+
Set-Cookie:
|
66
|
+
- ahoy_track=true; path=/; secure
|
67
|
+
- ahoy_visit=337dda1c-8ab7-4c2b-9386-feaf79fde9f5; path=/; expires=Sat, 18 Apr
|
68
|
+
2015 23:42:07 -0000; secure
|
69
|
+
- ahoy_visitor=250b9b9a-c236-429c-8cac-c028ac678e94; path=/; expires=Tue, 11
|
70
|
+
Apr 2017 23:42:07 -0000; secure
|
71
|
+
X-Request-Id:
|
72
|
+
- 7d5a8d35-4968-477f-950c-269fc3a799b1
|
73
|
+
X-Runtime:
|
74
|
+
- '0.100572'
|
75
|
+
body:
|
76
|
+
encoding: UTF-8
|
77
|
+
string: '{"accounts":[{"business_name":"My Villas","created_at":"2009-12-19T17:11:16Z","id":1,"updated_at":"2013-06-28T10:23:07Z","status":"trial","preferences":{"bookings":{"default_arrival_time":16,"default_departure_time":10}},"email":"demo_en@bookingsync.com"}]}'
|
78
|
+
http_version:
|
79
|
+
recorded_at: Sat, 11 Apr 2015 23:42:07 GMT
|
80
|
+
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.25
|
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-
|
11
|
+
date: 2015-04-11 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.rb
|
102
102
|
- lib/bookingsync/api/client.rb
|
103
|
+
- lib/bookingsync/api/client/accounts.rb
|
103
104
|
- lib/bookingsync/api/client/amenities.rb
|
104
105
|
- lib/bookingsync/api/client/availabilities.rb
|
105
106
|
- lib/bookingsync/api/client/billing_addresses.rb
|
@@ -133,6 +134,7 @@ files:
|
|
133
134
|
- lib/bookingsync/api/response.rb
|
134
135
|
- lib/bookingsync/api/serializer.rb
|
135
136
|
- lib/bookingsync/api/version.rb
|
137
|
+
- spec/bookingsync/api/client/accounts_spec.rb
|
136
138
|
- spec/bookingsync/api/client/amenities_spec.rb
|
137
139
|
- spec/bookingsync/api/client/availabilities_spec.rb
|
138
140
|
- spec/bookingsync/api/client/billing_addresses_spec.rb
|
@@ -165,6 +167,7 @@ files:
|
|
165
167
|
- spec/bookingsync/api/resource_spec.rb
|
166
168
|
- spec/bookingsync/api/response_spec.rb
|
167
169
|
- spec/bookingsync/api_spec.rb
|
170
|
+
- spec/fixtures/cassettes/BookingSync_API_Client_Accounts/_accounts/returns_accounts.yml
|
168
171
|
- spec/fixtures/cassettes/BookingSync_API_Client_Amenities/_amenities/returns_amenities.yml
|
169
172
|
- spec/fixtures/cassettes/BookingSync_API_Client_Amenities/_amenity/returns_amenity.yml
|
170
173
|
- spec/fixtures/cassettes/BookingSync_API_Client_Availabilities/_availabilities/returns_availabilities.yml
|
@@ -268,11 +271,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
271
|
version: '0'
|
269
272
|
requirements: []
|
270
273
|
rubyforge_project:
|
271
|
-
rubygems_version: 2.
|
274
|
+
rubygems_version: 2.2.2
|
272
275
|
signing_key:
|
273
276
|
specification_version: 4
|
274
277
|
summary: Ruby interface for accessing https://www.bookingsync.com
|
275
278
|
test_files:
|
279
|
+
- spec/bookingsync/api/client/accounts_spec.rb
|
276
280
|
- spec/bookingsync/api/client/amenities_spec.rb
|
277
281
|
- spec/bookingsync/api/client/availabilities_spec.rb
|
278
282
|
- spec/bookingsync/api/client/billing_addresses_spec.rb
|
@@ -305,6 +309,7 @@ test_files:
|
|
305
309
|
- spec/bookingsync/api/resource_spec.rb
|
306
310
|
- spec/bookingsync/api/response_spec.rb
|
307
311
|
- spec/bookingsync/api_spec.rb
|
312
|
+
- spec/fixtures/cassettes/BookingSync_API_Client_Accounts/_accounts/returns_accounts.yml
|
308
313
|
- spec/fixtures/cassettes/BookingSync_API_Client_Amenities/_amenities/returns_amenities.yml
|
309
314
|
- spec/fixtures/cassettes/BookingSync_API_Client_Amenities/_amenity/returns_amenity.yml
|
310
315
|
- spec/fixtures/cassettes/BookingSync_API_Client_Availabilities/_availabilities/returns_availabilities.yml
|