bookingsync-api 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c227ffca57d5a71ca428eb080f31d9394886a8c
4
- data.tar.gz: 1a2091bf8a21644e083c5e2477e6f43a8103cedb
3
+ metadata.gz: 08d6720058ec3d13d13447f1ceb97e39b44740d6
4
+ data.tar.gz: 1050fdba11d3ce21578028d35269484c31b9a288
5
5
  SHA512:
6
- metadata.gz: 02414dbb6763973ae82d61818d09e0b0cb34716c9d76dfebf9c56ce979401113a6d451f63636ba4d4a3cdc5f4b65810e729b97eb1d497aa909e62219b0722597
7
- data.tar.gz: 72a59fd4a42a566171750bdb2186f64684da910cf57bb1d7b97b01a8e0d084ebf0bc22e72b16a11d217c5e640bdcf9eaee1439e808b35633ec65e880da6f5e3e
6
+ metadata.gz: 08824e7c2896b4a51e38134c81758a212473b53ab481d4ce12cc17aca94ff7b04fea1d44ecee8085fc20caae3e487adb6a37fc102575fa77d9f8cc61c48c3b33
7
+ data.tar.gz: 5a8cfb28de21e09172eca667234c3ce08d4475c2f5b707380d2cd5894943b2bd720116f5f72a15fb04e2d819d8ca02d50e293b400f7bcf2941f96b52e1091d0a
@@ -18,6 +18,22 @@ module BookingSync::API
18
18
  paginate :rentals, options, &block
19
19
  end
20
20
 
21
+ # Search rentals
22
+ #
23
+ # Returns list of light rentals. Composed of id, initial_price,
24
+ # final_price and updated_at.
25
+ #
26
+ # @param options [Hash] A customizable set of options.
27
+ # @return [Array<BookingSync::API::Resource>] Array of light rentals.
28
+ #
29
+ # @example Search rentals by rental type
30
+ # villas = @api.rentals_search(rental_type: "villa")
31
+ def rentals_search(options = {}, &block)
32
+ ids = Array(options.delete(:ids))
33
+ path = ["rentals", ids.join(","), "search"].compact.join("/")
34
+ paginate path, options, &block
35
+ end
36
+
21
37
  # Create a new rental
22
38
  #
23
39
  # @param options [Hash] rental attributes
@@ -243,7 +243,7 @@ module BookingSync::API
243
243
  end
244
244
 
245
245
  def faraday_options
246
- {builder: middleware, ssl: {verify: verify_ssl?}}
246
+ { builder: middleware, ssl: { verify: verify_ssl? } }
247
247
  end
248
248
 
249
249
  # Return BookingSync base URL. Default is https://www.bookingsync.com
@@ -263,7 +263,7 @@ module BookingSync::API
263
263
  # @return [Boolean] true if SSL needs to be verified
264
264
  # false otherwise
265
265
  def verify_ssl?
266
- ENV["BOOKINGSYNC_VERIFY_SSL"] == "false" ? false : true
266
+ ENV["BOOKINGSYNC_VERIFY_SSL"] != "false"
267
267
  end
268
268
 
269
269
  # Expand an URL template into a full URL
@@ -1,5 +1,5 @@
1
1
  module BookingSync
2
2
  module API
3
- VERSION = "0.0.15"
3
+ VERSION = "0.0.16"
4
4
  end
5
5
  end
@@ -23,6 +23,22 @@ describe BookingSync::API::Client::Rentals do
23
23
  end
24
24
  end
25
25
 
26
+ describe ".rentals_search", :vcr do
27
+ it "returns rentals" do
28
+ expect(client.rentals_search(start_at: "2014-06-20", end_at: "2014-06-25")).not_to be_empty
29
+ assert_requested :get, bs_url("rentals/search?start_at=2014-06-20&end_at=2014-06-25")
30
+ end
31
+
32
+ context "rentals ids given" do
33
+ it "makes a search within given rentals" do
34
+ rentals = client.rentals_search(ids: [323, 354], max_price: 400,
35
+ start_at: "2014-06-20", end_at: "2014-06-25")
36
+ expect(rentals.size).to eq(1)
37
+ assert_requested :get, bs_url("rentals/323,354/search?max_price=400&start_at=2014-06-20&end_at=2014-06-25")
38
+ end
39
+ end
40
+ end
41
+
26
42
  describe ".rental", :vcr do
27
43
  it "returns a single rental" do
28
44
  rental = client.rental(2)
@@ -0,0 +1,65 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.bookingsync.com/api/v3/rentals/323,354/search?end_at=2014-06-25&max_price=400&start_at=2014-06-20
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
+ X-Ratelimit-Limit:
26
+ - '1000'
27
+ X-Ratelimit-Reset:
28
+ - '1403028000'
29
+ X-Ratelimit-Remaining:
30
+ - '716'
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
+ - "*"
41
+ Content-Type:
42
+ - application/vnd.api+json; charset=utf-8
43
+ X-Ua-Compatible:
44
+ - IE=Edge
45
+ Etag:
46
+ - '"621224e07863a6f1e9608a835a0b976f"'
47
+ Cache-Control:
48
+ - max-age=0, private, must-revalidate
49
+ P3p:
50
+ - CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
51
+ OUR SAMi OTRo UNRo PUBi IND UNI STA"
52
+ X-Request-Id:
53
+ - 84607d0b92d57200601605f351b0dda8
54
+ X-Runtime:
55
+ - '0.063413'
56
+ Date:
57
+ - Tue, 17 Jun 2014 17:49:24 GMT
58
+ Connection:
59
+ - close
60
+ body:
61
+ encoding: UTF-8
62
+ string: '{"rentals":[{"id":323,"initial_price":342,"final_price":342,"updated_at":"2014-06-17T08:32:59Z"}]}'
63
+ http_version:
64
+ recorded_at: Tue, 17 Jun 2014 17:49:24 GMT
65
+ recorded_with: VCR 2.9.0
@@ -0,0 +1,65 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.bookingsync.com/api/v3/rentals/search?end_at=2014-06-25&start_at=2014-06-20
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
+ X-Ratelimit-Limit:
26
+ - '1000'
27
+ X-Ratelimit-Reset:
28
+ - '1403028000'
29
+ X-Ratelimit-Remaining:
30
+ - '717'
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
+ - "*"
41
+ Content-Type:
42
+ - application/vnd.api+json; charset=utf-8
43
+ X-Ua-Compatible:
44
+ - IE=Edge
45
+ Etag:
46
+ - '"6ed7d26a9782534dad8efc565fa7e1ee"'
47
+ Cache-Control:
48
+ - max-age=0, private, must-revalidate
49
+ P3p:
50
+ - CP="OTI DSP COR CUR ADMo DEVo TAI PSAi PSDi IVAi IVDi CONi HISi TELi OTPi
51
+ OUR SAMi OTRo UNRo PUBi IND UNI STA"
52
+ X-Request-Id:
53
+ - cb7f942c7834f550641d3323aed451f6
54
+ X-Runtime:
55
+ - '0.093222'
56
+ Date:
57
+ - Tue, 17 Jun 2014 17:49:24 GMT
58
+ Connection:
59
+ - close
60
+ body:
61
+ encoding: UTF-8
62
+ string: '{"rentals":[{"id":323,"initial_price":342,"final_price":342,"updated_at":"2014-06-17T08:32:59Z"},{"id":379,"initial_price":385,"final_price":385,"updated_at":"2014-06-17T08:33:00Z"},{"id":386,"initial_price":428,"final_price":428,"updated_at":"2014-06-17T08:33:00Z"},{"id":367,"initial_price":450,"final_price":450,"updated_at":"2014-06-17T08:33:00Z"},{"id":354,"initial_price":571,"final_price":571,"updated_at":"2014-06-17T08:33:00Z"}]}'
63
+ http_version:
64
+ recorded_at: Tue, 17 Jun 2014 17:49:24 GMT
65
+ recorded_with: VCR 2.9.0
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookingsync-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
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-06-12 00:00:00.000000000 Z
11
+ date: 2014-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.9'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.9'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: addressable
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: hashie
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.5'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.5'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: This gem allows to interact with the BookingSync API via Ruby objects
@@ -87,9 +87,9 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - ".gitignore"
91
- - ".rspec"
92
- - ".travis.yml"
90
+ - .gitignore
91
+ - .rspec
92
+ - .travis.yml
93
93
  - Gemfile
94
94
  - Guardfile
95
95
  - LICENSE.txt
@@ -206,6 +206,8 @@ files:
206
206
  - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals/returns_rentals_by_ids.yml
207
207
  - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_meta/returns_meta_information_about_all_rentals.yml
208
208
  - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_meta/returns_meta_information_about_requested_rentals.yml
209
+ - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/rentals_ids_given/makes_a_search_within_given_rentals.yml
210
+ - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/returns_rentals.yml
209
211
  - spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenities/links/returns_associated_amenity.yml
210
212
  - spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenities/links/returns_associated_rental.yml
211
213
  - spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenities/returns_rentals_amenities.yml
@@ -233,17 +235,17 @@ require_paths:
233
235
  - lib
234
236
  required_ruby_version: !ruby/object:Gem::Requirement
235
237
  requirements:
236
- - - ">="
238
+ - - '>='
237
239
  - !ruby/object:Gem::Version
238
240
  version: '0'
239
241
  required_rubygems_version: !ruby/object:Gem::Requirement
240
242
  requirements:
241
- - - ">="
243
+ - - '>='
242
244
  - !ruby/object:Gem::Version
243
245
  version: '0'
244
246
  requirements: []
245
247
  rubyforge_project:
246
- rubygems_version: 2.2.2
248
+ rubygems_version: 2.0.14
247
249
  signing_key:
248
250
  specification_version: 4
249
251
  summary: Ruby interface for accessing https://www.bookingsync.com
@@ -327,6 +329,8 @@ test_files:
327
329
  - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals/returns_rentals_by_ids.yml
328
330
  - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_meta/returns_meta_information_about_all_rentals.yml
329
331
  - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_meta/returns_meta_information_about_requested_rentals.yml
332
+ - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/rentals_ids_given/makes_a_search_within_given_rentals.yml
333
+ - spec/fixtures/cassettes/BookingSync_API_Client_Rentals/_rentals_search/returns_rentals.yml
330
334
  - spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenities/links/returns_associated_amenity.yml
331
335
  - spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenities/links/returns_associated_rental.yml
332
336
  - spec/fixtures/cassettes/BookingSync_API_Client_RentalsAmenities/_rentals_amenities/returns_rentals_amenities.yml