level_travel 0.2.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: 130213408e85057cbe6f3d37751fa02729c24b9b2b6ec29d3370d32bc910d2cb
4
- data.tar.gz: 8c70e07d8b93a2b72095c5f3c6563d714f5d80f2d620da2ec7b8b3a32e74470a
3
+ metadata.gz: 5955c3217ef6975f8e6aef4df6e15fe6c2d9d4dc59f34aeaea60a171a47c8e87
4
+ data.tar.gz: 9d384e0fba3208744e7d47ec7a75dd06db429b3aa40a25e556ad54815ea1f61e
5
5
  SHA512:
6
- metadata.gz: 8609b7c56d0ea5dffe9a26349a27863678ef1aa7a2d62c023462b41ac730b2b225f6e6f9a0ea186201d1617bf10be576e4bc88fa6a4fa9e3eba1cde853e53419
7
- data.tar.gz: 2a077800dc672071ad254f57410ea4722cf4e801f24dea32b9cbe13bac36288842e5329f7b94263dc40e469b9caca29b7ff2df27e9eba1ffb6713a20cfbb1c96
6
+ metadata.gz: 9a44dbe6fdc88844c84fcfec3de7a8a1d004e79aa0a9ef142def3aca5114ffa1936411d3a0b2424d064b6fbb692d4c8d0ec2271ae4d53299eefbc277d649d2f0
7
+ data.tar.gz: 53ca507a50692163cb0afd98c58ca295378f832d80cf7ea3e92ad8abd9cc25e3b96ad3d050c8b2300053cad0dc5d7275fbc0e63d110b7e33d8b478350a863f9e
@@ -10,8 +10,40 @@ module LevelTravel
10
10
 
11
11
  # @param request_id [String] Request ID from the `enqueue` request
12
12
  def self.status(request_id)
13
+ # TODO: return an object like { succeeded: [], failed: [] }
13
14
  ::LevelTravel::Request.get('/search/status', request_id: request_id)
14
15
  end
16
+
17
+ # @param request_id [String] Request ID from the `enqueue` request
18
+ # @param operator_ids [Array<Integer>] Operators' IDs. Succeeded IDs from the result of status request.
19
+ def self.get_grouped_hotels(request_id, operator_ids: [])
20
+ params = prepare_params(operator_ids: operator_ids)
21
+
22
+ ::LevelTravel::Request.get('/search/get_grouped_hotels', request_id: request_id, **params)
23
+ end
24
+
25
+ # :reek:BooleanParameter
26
+ # :reek:LongParameterList
27
+ # @param request_id [String] Request ID from the `enqueue` request
28
+ # @param hotel_id [String] Hotel ID from the `get_grouped_hotels` request
29
+ # @param operator_ids [Array<Integer>] Operators' IDs. Succeeded IDs from the result of status request.
30
+ # @param compact [Boolean] Return tours without additional information if it's true.
31
+ def self.get_hotel_offers(request_id, hotel_id:, operator_ids: [], compact: false)
32
+ params = prepare_params(operator_ids: operator_ids, compact: compact)
33
+
34
+ ::LevelTravel::Request.get('/search/get_hotel_offers', request_id: request_id, hotel_id: hotel_id, **params)
35
+ end
36
+
37
+ # @param operator_ids [Array<Integer>] Operators' IDs. Succeeded IDs from the result of status request.
38
+ # @param other_params [Hash]
39
+ def self.prepare_params(operator_ids:, **other_params)
40
+ params = other_params
41
+ params = params.merge(operator_ids: operator_ids.join(',')) if operator_ids.any?
42
+
43
+ params
44
+ end
45
+
46
+ private_class_method :prepare_params
15
47
  end
16
48
  end
17
49
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LevelTravel
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: level_travel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Rodionov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-17 00:00:00.000000000 Z
11
+ date: 2020-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct