quicktravel_client 3.9.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +4 -5
- data/CHANGELOG.md +3 -0
- data/gemfiles/rails6.gemfile +8 -0
- data/lib/quick_travel.rb +1 -0
- data/lib/quick_travel/booking.rb +1 -1
- data/lib/quick_travel/cache.rb +8 -1
- data/lib/quick_travel/passenger_type.rb +1 -1
- data/lib/quick_travel/version.rb +1 -1
- data/quicktravel_client.gemspec +5 -5
- data/spec/discounts_spec.rb +21 -21
- data/spec/spec_helper.rb +5 -0
- metadata +22 -29
- data/gemfiles/rails4.gemfile +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5007469a12b06055c4cd7b9ae331a99ffc041952348ccad994ab11de51069e79
|
4
|
+
data.tar.gz: e57da3eb9ef8ff2f49283a9de910d5ffbb4c424f965f96fb8175d6ea452795e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24d5ba5f79aedf800a3fbd40c793a13dab2bfb48f91059460293aa757e5aea062f850b290e2b3b72e83c2269de5a675e9d5dfee761ef7555ba47aa3bc24f8928
|
7
|
+
data.tar.gz: ecb835442572758fe0b02d953bf978f2af920396396e7d9a6937917d5636fd8663e3ce0672fbcf39fed76652acdbb7dd4582f0c0bd19b3827123cb861df77081
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.1
|
data/.travis.yml
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.2
|
4
|
-
- 2.3
|
5
|
-
- 2.4
|
6
3
|
- 2.5
|
4
|
+
- 2.6
|
5
|
+
- 2.7
|
7
6
|
before_install:
|
8
|
-
- gem install bundler
|
7
|
+
- gem install bundler
|
9
8
|
script: bundle && bundle exec rake spec
|
10
9
|
gemfile:
|
11
|
-
- gemfiles/rails4.gemfile
|
12
10
|
- gemfiles/rails5.gemfile
|
11
|
+
- gemfiles/rails6.gemfile
|
13
12
|
notifications:
|
14
13
|
email:
|
15
14
|
- support@travellink.com.au
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
This changelog adheres to [Keep a CHANGELOG](http://keepachangelog.com/).
|
5
5
|
|
6
|
+
## [4.0.0]
|
7
|
+
- [TT-7385] Update Money dependency, test against Ruby 2.7 / Rails 6
|
8
|
+
|
6
9
|
## [3.9.0]
|
7
10
|
### Added
|
8
11
|
- [DC-3115] Add customer comments method in booking
|
data/lib/quick_travel.rb
CHANGED
data/lib/quick_travel/booking.rb
CHANGED
@@ -13,7 +13,7 @@ module QuickTravel
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.find_by_reference(reference)
|
16
|
-
find_all!("#{api_base}/reference/#{URI.
|
16
|
+
find_all!("#{api_base}/reference/#{URI.encode_www_form_component(reference)}.json").first
|
17
17
|
end
|
18
18
|
|
19
19
|
def documents(regenerate = false)
|
data/lib/quick_travel/cache.rb
CHANGED
@@ -11,13 +11,20 @@ module QuickTravel
|
|
11
11
|
cache_options ||= {}
|
12
12
|
key = "#{@@namespace}_#{key}" unless cache_options[:disable_namespacing]
|
13
13
|
cached_value = cache_store.read(key)
|
14
|
-
return cached_value unless cached_value
|
14
|
+
return cached_value unless cache_empty?(cached_value)
|
15
15
|
return nil unless block_given?
|
16
16
|
cache_options ||= {}
|
17
17
|
cache_options[:expires_in] = 1.day unless cache_options.key?(:expires_in)
|
18
18
|
yield.tap { |value| cache_store.write(key, value, cache_options) }
|
19
19
|
end
|
20
20
|
|
21
|
+
def self.cache_empty?(cached_value)
|
22
|
+
if cached_value.respond_to?(:body)
|
23
|
+
return cached_value.body.nil? || cached_value.body.empty?
|
24
|
+
end
|
25
|
+
cached_value.nil?
|
26
|
+
end
|
27
|
+
|
21
28
|
def self.delete(key, namespace = true)
|
22
29
|
key = "#{@@namespace}_#{key}" if namespace
|
23
30
|
cache_store.delete(key)
|
@@ -13,7 +13,7 @@ module QuickTravel
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.pluralize(count, singular, plural = nil)
|
16
|
-
"#{count || 0} " + ((count == 1
|
16
|
+
"#{count || 0} " + ((count == 1) ? singular : (plural || singular.pluralize))
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/quick_travel/version.rb
CHANGED
data/quicktravel_client.gemspec
CHANGED
@@ -16,14 +16,14 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
17
|
spec.require_paths = ['lib']
|
18
18
|
|
19
|
-
spec.add_dependency 'httparty'
|
20
|
-
spec.add_dependency '
|
21
|
-
spec.add_dependency 'activesupport', '>= 2.0.0'
|
19
|
+
spec.add_dependency 'httparty'
|
20
|
+
spec.add_dependency 'activesupport', '>= 5.0.0'
|
22
21
|
spec.add_dependency 'facets'
|
23
|
-
spec.add_dependency 'money', '>=
|
22
|
+
spec.add_dependency 'money', '>= 6.0'
|
23
|
+
spec.add_dependency 'money_extensions', '>= 1.0'
|
24
24
|
spec.add_dependency 'will_paginate'
|
25
25
|
|
26
|
-
spec.add_development_dependency 'bundler', '~>
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2'
|
27
27
|
spec.add_development_dependency 'rake'
|
28
28
|
spec.add_development_dependency 'rspec'
|
29
29
|
spec.add_development_dependency 'rspec-its'
|
data/spec/discounts_spec.rb
CHANGED
@@ -26,9 +26,9 @@ describe 'Booking price_changes' do
|
|
26
26
|
|
27
27
|
specify { expect(price_change.target.type).to eq 'Booking' }
|
28
28
|
specify { expect(price_change.target.id).to eq booking.id }
|
29
|
-
specify { expect(price_change.original_price).to eq 640.00 }
|
30
|
-
specify { expect(price_change.changed_price).to eq 380.00 }
|
31
|
-
specify { expect(price_change.price_change).to eq(-260.00) }
|
29
|
+
specify { expect(price_change.original_price).to eq 640.00.to_money }
|
30
|
+
specify { expect(price_change.changed_price).to eq 380.00.to_money }
|
31
|
+
specify { expect(price_change.price_change).to eq(-260.00.to_money) }
|
32
32
|
specify do
|
33
33
|
expect(price_change.reservation_price_changes.count).to(
|
34
34
|
eq booking.reservations.count)
|
@@ -43,9 +43,9 @@ describe 'Booking price_changes' do
|
|
43
43
|
|
44
44
|
specify { expect(price_change.target.type).to eq 'Reservation' }
|
45
45
|
specify { expect(price_change.target.id).to eq reservation.id }
|
46
|
-
specify { expect(price_change.original_price).to eq 400.00 }
|
47
|
-
specify { expect(price_change.changed_price).to eq 200.00 }
|
48
|
-
specify { expect(price_change.price_change).to eq(-200) }
|
46
|
+
specify { expect(price_change.original_price).to eq 400.00.to_money }
|
47
|
+
specify { expect(price_change.changed_price).to eq 200.00.to_money }
|
48
|
+
specify { expect(price_change.price_change).to eq(-200.to_money) }
|
49
49
|
end
|
50
50
|
|
51
51
|
context 'the total price_change applied on the top level reservation' do
|
@@ -57,9 +57,9 @@ describe 'Booking price_changes' do
|
|
57
57
|
|
58
58
|
specify { expect(price_change.target.type).to eq 'Reservation' }
|
59
59
|
specify { expect(price_change.target.id).to eq reservation.id }
|
60
|
-
specify { expect(price_change.original_price).to eq 640.00 }
|
61
|
-
specify { expect(price_change.changed_price).to eq 380.00 }
|
62
|
-
specify { expect(price_change.price_change).to eq(-260.00) }
|
60
|
+
specify { expect(price_change.original_price).to eq 640.00.to_money }
|
61
|
+
specify { expect(price_change.changed_price).to eq 380.00.to_money }
|
62
|
+
specify { expect(price_change.price_change).to eq(-260.00.to_money) }
|
63
63
|
end
|
64
64
|
|
65
65
|
context 'the price_change applied on the first extra pick' do
|
@@ -71,9 +71,9 @@ describe 'Booking price_changes' do
|
|
71
71
|
|
72
72
|
specify { expect(price_change.target.type).to eq 'Reservation' }
|
73
73
|
specify { expect(price_change.target.id).to eq extra_pick_without_price_change.id }
|
74
|
-
specify { expect(price_change.original_price).to eq 120 }
|
75
|
-
specify { expect(price_change.changed_price).to eq 120 }
|
76
|
-
specify { expect(price_change.price_change).to eq 0 }
|
74
|
+
specify { expect(price_change.original_price).to eq 120.to_money }
|
75
|
+
specify { expect(price_change.changed_price).to eq 120.to_money }
|
76
|
+
specify { expect(price_change.price_change).to eq 0.to_money }
|
77
77
|
end
|
78
78
|
|
79
79
|
context 'the total price_change applied on the first extra pick' do
|
@@ -85,9 +85,9 @@ describe 'Booking price_changes' do
|
|
85
85
|
|
86
86
|
specify { expect(price_change.target.type).to eq 'Reservation' }
|
87
87
|
specify { expect(price_change.target.id).to eq extra_pick_without_price_change.id }
|
88
|
-
specify { expect(price_change.original_price).to eq 120 }
|
89
|
-
specify { expect(price_change.changed_price).to eq 120 }
|
90
|
-
specify { expect(price_change.price_change).to eq 0 }
|
88
|
+
specify { expect(price_change.original_price).to eq 120.to_money }
|
89
|
+
specify { expect(price_change.changed_price).to eq 120.to_money }
|
90
|
+
specify { expect(price_change.price_change).to eq 0.to_money }
|
91
91
|
end
|
92
92
|
|
93
93
|
context 'the price_change applied on second extra pick' do
|
@@ -99,9 +99,9 @@ describe 'Booking price_changes' do
|
|
99
99
|
|
100
100
|
specify { expect(price_change.target.type).to eq 'Reservation' }
|
101
101
|
specify { expect(price_change.target.id).to eq extra_pick_with_price_change.id }
|
102
|
-
specify { expect(price_change.original_price).to eq 120.00 }
|
103
|
-
specify { expect(price_change.changed_price).to eq 60.00 }
|
104
|
-
specify { expect(price_change.price_change).to eq(-60.00) }
|
102
|
+
specify { expect(price_change.original_price).to eq 120.00.to_money }
|
103
|
+
specify { expect(price_change.changed_price).to eq 60.00.to_money }
|
104
|
+
specify { expect(price_change.price_change).to eq(-60.00.to_money) }
|
105
105
|
end
|
106
106
|
|
107
107
|
context 'the total price_change applied on second extra pick' do
|
@@ -113,9 +113,9 @@ describe 'Booking price_changes' do
|
|
113
113
|
|
114
114
|
specify { expect(price_change.target.type).to eq 'Reservation' }
|
115
115
|
specify { expect(price_change.target.id).to eq extra_pick_with_price_change.id }
|
116
|
-
specify { expect(price_change.original_price).to eq 120.00 }
|
117
|
-
specify { expect(price_change.changed_price).to eq 60.00 }
|
118
|
-
specify { expect(price_change.price_change).to eq(-60.00) }
|
116
|
+
specify { expect(price_change.original_price).to eq 120.00.to_money }
|
117
|
+
specify { expect(price_change.changed_price).to eq 60.00.to_money }
|
118
|
+
specify { expect(price_change.price_change).to eq(-60.00.to_money) }
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -27,6 +27,11 @@ end
|
|
27
27
|
require 'quick_travel/connection_error'
|
28
28
|
require 'quick_travel/cache'
|
29
29
|
|
30
|
+
Money.default_currency = Money::Currency.new("AUD")
|
31
|
+
Money.locale_backend = nil
|
32
|
+
Money.default_formatting_rules = { thousands_separator: "," }
|
33
|
+
Money.rounding_mode = BigDecimal::ROUND_HALF_UP
|
34
|
+
|
30
35
|
class HashCache
|
31
36
|
def initialize
|
32
37
|
@cache = {}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quicktravel_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Noack
|
@@ -10,24 +10,10 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-02
|
13
|
+
date: 2020-06-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
requirements:
|
19
|
-
- - "~>"
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0.17'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
requirements:
|
26
|
-
- - "~>"
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: '0.17'
|
29
|
-
- !ruby/object:Gem::Dependency
|
30
|
-
name: json
|
31
17
|
requirement: !ruby/object:Gem::Requirement
|
32
18
|
requirements:
|
33
19
|
- - ">="
|
@@ -46,14 +32,14 @@ dependencies:
|
|
46
32
|
requirements:
|
47
33
|
- - ">="
|
48
34
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
35
|
+
version: 5.0.0
|
50
36
|
type: :runtime
|
51
37
|
prerelease: false
|
52
38
|
version_requirements: !ruby/object:Gem::Requirement
|
53
39
|
requirements:
|
54
40
|
- - ">="
|
55
41
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
42
|
+
version: 5.0.0
|
57
43
|
- !ruby/object:Gem::Dependency
|
58
44
|
name: facets
|
59
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,9 +59,6 @@ dependencies:
|
|
73
59
|
requirement: !ruby/object:Gem::Requirement
|
74
60
|
requirements:
|
75
61
|
- - ">="
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '3.0'
|
78
|
-
- - "<"
|
79
62
|
- !ruby/object:Gem::Version
|
80
63
|
version: '6.0'
|
81
64
|
type: :runtime
|
@@ -83,11 +66,22 @@ dependencies:
|
|
83
66
|
version_requirements: !ruby/object:Gem::Requirement
|
84
67
|
requirements:
|
85
68
|
- - ">="
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: '3.0'
|
88
|
-
- - "<"
|
89
69
|
- !ruby/object:Gem::Version
|
90
70
|
version: '6.0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: money_extensions
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '1.0'
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '1.0'
|
91
85
|
- !ruby/object:Gem::Dependency
|
92
86
|
name: will_paginate
|
93
87
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,14 +102,14 @@ dependencies:
|
|
108
102
|
requirements:
|
109
103
|
- - "~>"
|
110
104
|
- !ruby/object:Gem::Version
|
111
|
-
version: '
|
105
|
+
version: '2'
|
112
106
|
type: :development
|
113
107
|
prerelease: false
|
114
108
|
version_requirements: !ruby/object:Gem::Requirement
|
115
109
|
requirements:
|
116
110
|
- - "~>"
|
117
111
|
- !ruby/object:Gem::Version
|
118
|
-
version: '
|
112
|
+
version: '2'
|
119
113
|
- !ruby/object:Gem::Dependency
|
120
114
|
name: rake
|
121
115
|
requirement: !ruby/object:Gem::Requirement
|
@@ -288,8 +282,8 @@ files:
|
|
288
282
|
- Rakefile
|
289
283
|
- examples/example_config.rb
|
290
284
|
- examples/login_example.rb
|
291
|
-
- gemfiles/rails4.gemfile
|
292
285
|
- gemfiles/rails5.gemfile
|
286
|
+
- gemfiles/rails6.gemfile
|
293
287
|
- lib/extensions.rb
|
294
288
|
- lib/quick_travel.rb
|
295
289
|
- lib/quick_travel/accommodation.rb
|
@@ -463,8 +457,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
463
457
|
- !ruby/object:Gem::Version
|
464
458
|
version: '0'
|
465
459
|
requirements: []
|
466
|
-
|
467
|
-
rubygems_version: 2.7.3
|
460
|
+
rubygems_version: 3.1.2
|
468
461
|
signing_key:
|
469
462
|
specification_version: 4
|
470
463
|
summary: Booking process using QuickTravel API
|