sorare-rewards 1.4.0 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +1 -1
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +23 -22
- data/lib/sorare/rewards/configuration.rb +1 -1
- data/lib/sorare/rewards/game_week.rb +4 -4
- data/lib/sorare/rewards/interactors/allocations/compute_for_league.rb +2 -2
- data/lib/sorare/rewards/interactors/allocations/compute_for_quality.rb +2 -2
- data/lib/sorare/rewards/interactors/prize_pools/compute_for_league.rb +2 -2
- data/lib/sorare/rewards/league.rb +1 -1
- data/lib/sorare/rewards/version.rb +1 -1
- data/lib/sorare/rewards.rb +0 -1
- data/sorare-rewards.gemspec +5 -6
- metadata +22 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64ce3ebddf119cf93cc3cb87a87576be330a1cea5673a91c4403c0be574ce484
|
4
|
+
data.tar.gz: 3d5aedfa9b6b3a5bfef3793d62900c17a4ede3bb86eeed164a305173d43146b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9255987966f248d9c46040efd606c2ed718953cd089d96692c982f6294fb16803b6d687c1e047f45c5142b50cf0a86cb51ca6d3dae1f4a6c072f8423bc22eb45
|
7
|
+
data.tar.gz: 9ba2bb81da433811b482e721994035b03d96534d299ee513f96d7768cd3649a5604428a2625480a795049d84027635edce480f5deb36e21e1e646be9dcc2cd98
|
data/.gitlab-ci.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -14,6 +14,7 @@ Metrics/BlockLength:
|
|
14
14
|
- "Rakefile"
|
15
15
|
- "**/*.rake"
|
16
16
|
- "spec/**/*.rb"
|
17
|
+
- "sorare-rewards.gemspec"
|
17
18
|
|
18
19
|
Metrics/ClassLength:
|
19
20
|
Max: 120
|
@@ -85,3 +86,6 @@ RSpec/StubbedMock:
|
|
85
86
|
Style/ExpandPathArguments:
|
86
87
|
Exclude:
|
87
88
|
- "*.gemspec"
|
89
|
+
|
90
|
+
Style/OpenStructUse:
|
91
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,44 +1,42 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sorare-rewards (1.4.
|
4
|
+
sorare-rewards (1.4.4)
|
5
5
|
activesupport (~> 6.1.4)
|
6
6
|
interactor (~> 3.1.2)
|
7
7
|
json (~> 2)
|
8
|
-
net-http (~> 0.1.1)
|
9
8
|
yaml (~> 0.2.0)
|
10
9
|
|
11
10
|
GEM
|
12
11
|
remote: https://rubygems.org/
|
13
12
|
specs:
|
14
|
-
activesupport (6.1.4.
|
13
|
+
activesupport (6.1.4.4)
|
15
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
15
|
i18n (>= 1.6, < 2)
|
17
16
|
minitest (>= 5.1)
|
18
17
|
tzinfo (~> 2.0)
|
19
18
|
zeitwerk (~> 2.3)
|
19
|
+
addressable (2.8.0)
|
20
|
+
public_suffix (>= 2.0.2, < 5.0)
|
20
21
|
ast (2.4.2)
|
21
22
|
concurrent-ruby (1.1.9)
|
23
|
+
crack (0.4.5)
|
24
|
+
rexml
|
22
25
|
diff-lcs (1.4.4)
|
23
|
-
|
26
|
+
hashdiff (1.0.1)
|
27
|
+
i18n (1.8.11)
|
24
28
|
concurrent-ruby (~> 1.0)
|
25
29
|
interactor (3.1.2)
|
26
|
-
|
27
|
-
|
28
|
-
minitest (5.14.4)
|
29
|
-
net-http (0.1.1)
|
30
|
-
net-protocol
|
31
|
-
uri
|
32
|
-
net-protocol (0.1.2)
|
33
|
-
io-wait
|
34
|
-
timeout
|
30
|
+
json (2.6.1)
|
31
|
+
minitest (5.15.0)
|
35
32
|
ostruct (0.4.0)
|
36
33
|
parallel (1.21.0)
|
37
|
-
parser (3.0.
|
34
|
+
parser (3.1.0.0)
|
38
35
|
ast (~> 2.4.1)
|
36
|
+
public_suffix (4.0.6)
|
39
37
|
rainbow (3.0.0)
|
40
38
|
rake (12.3.3)
|
41
|
-
regexp_parser (2.
|
39
|
+
regexp_parser (2.2.0)
|
42
40
|
rexml (3.2.5)
|
43
41
|
rspec (3.10.0)
|
44
42
|
rspec-core (~> 3.10.0)
|
@@ -53,29 +51,31 @@ GEM
|
|
53
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
54
52
|
rspec-support (~> 3.10.0)
|
55
53
|
rspec-support (3.10.2)
|
56
|
-
rubocop (1.
|
54
|
+
rubocop (1.24.1)
|
57
55
|
parallel (~> 1.10)
|
58
56
|
parser (>= 3.0.0.0)
|
59
57
|
rainbow (>= 2.2.2, < 4.0)
|
60
58
|
regexp_parser (>= 1.8, < 3.0)
|
61
59
|
rexml
|
62
|
-
rubocop-ast (>= 1.
|
60
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
63
61
|
ruby-progressbar (~> 1.7)
|
64
62
|
unicode-display_width (>= 1.4.0, < 3.0)
|
65
|
-
rubocop-ast (1.
|
63
|
+
rubocop-ast (1.15.1)
|
66
64
|
parser (>= 3.0.1.1)
|
67
65
|
rubocop-rake (0.6.0)
|
68
66
|
rubocop (~> 1.0)
|
69
67
|
rubocop-rspec (2.5.0)
|
70
68
|
rubocop (~> 1.19)
|
71
69
|
ruby-progressbar (1.11.0)
|
72
|
-
timeout (0.2.0)
|
73
70
|
tzinfo (2.0.4)
|
74
71
|
concurrent-ruby (~> 1.0)
|
75
72
|
unicode-display_width (2.1.0)
|
76
|
-
|
73
|
+
webmock (3.14.0)
|
74
|
+
addressable (>= 2.8.0)
|
75
|
+
crack (>= 0.3.2)
|
76
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
77
77
|
yaml (0.2.0)
|
78
|
-
zeitwerk (2.5.
|
78
|
+
zeitwerk (2.5.3)
|
79
79
|
|
80
80
|
PLATFORMS
|
81
81
|
ruby
|
@@ -84,10 +84,11 @@ DEPENDENCIES
|
|
84
84
|
ostruct (~> 0.4.0)
|
85
85
|
rake (~> 12.0)
|
86
86
|
rspec (~> 3.10)
|
87
|
-
rubocop (~> 1.
|
87
|
+
rubocop (~> 1.24.1)
|
88
88
|
rubocop-rake (~> 0.6.0)
|
89
89
|
rubocop-rspec (~> 2.5.0)
|
90
90
|
sorare-rewards!
|
91
|
+
webmock (~> 3.14.0)
|
91
92
|
|
92
93
|
BUNDLED WITH
|
93
94
|
2.2.30
|
@@ -19,7 +19,7 @@ module Sorare
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def load_yaml_configuration_file(filename)
|
22
|
-
YAML.safe_load(File.read("#{File.dirname(__FILE__)}/#{filename}"),
|
22
|
+
YAML.safe_load(File.read("#{File.dirname(__FILE__)}/#{filename}"), aliases: true)
|
23
23
|
.with_indifferent_access
|
24
24
|
end
|
25
25
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'json'
|
4
|
-
require 'net/http'
|
5
4
|
require 'active_support/core_ext/module/delegation'
|
5
|
+
require 'open-uri'
|
6
6
|
|
7
7
|
module Sorare
|
8
8
|
module Rewards
|
@@ -11,7 +11,7 @@ module Sorare
|
|
11
11
|
attr_reader :salt
|
12
12
|
|
13
13
|
def initialize(data: nil, hash: nil, salt: nil)
|
14
|
-
@uri = URI("#{Sorare::Rewards.configuration.gateway}#{hash}")
|
14
|
+
@uri = URI.parse("#{Sorare::Rewards.configuration.gateway}#{hash}")
|
15
15
|
@data = data
|
16
16
|
@salt = salt
|
17
17
|
end
|
@@ -23,11 +23,11 @@ module Sorare
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def data
|
26
|
-
@data ||= JSON.parse(
|
26
|
+
@data ||= JSON.parse(@uri.open.read)
|
27
27
|
end
|
28
28
|
|
29
29
|
def config
|
30
|
-
@config ||= GameWeekConfig.new(
|
30
|
+
@config ||= GameWeekConfig.new(data['config'])
|
31
31
|
end
|
32
32
|
|
33
33
|
def supply_for(league, rarity: nil, player: nil)
|
@@ -19,9 +19,9 @@ module Sorare
|
|
19
19
|
def allocate_and_format!
|
20
20
|
each_rarity_allocation do |rarity|
|
21
21
|
(allocations[rarity].first || {}).keys.index_with do |division|
|
22
|
-
allocations[rarity].each_with_index.
|
22
|
+
allocations[rarity].each_with_index.to_h do |qualified_allocations, tier|
|
23
23
|
[Sorare::Rewards.configuration.transform_tier.call(tier), qualified_allocations[division]]
|
24
|
-
end
|
24
|
+
end
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -20,9 +20,9 @@ module Sorare
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def allocations
|
23
|
-
config.length.times.
|
23
|
+
config.length.times.to_h do |division|
|
24
24
|
[Sorare::Rewards.configuration.transform_division.call(division + 1), allocated[division]]
|
25
|
-
end
|
25
|
+
end
|
26
26
|
end
|
27
27
|
|
28
28
|
def allocate!
|
@@ -16,13 +16,13 @@ module Sorare
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def prize_pools!
|
19
|
-
league.each_division_prize_pools.
|
19
|
+
league.each_division_prize_pools.to_h do |division, prize_pools|
|
20
20
|
[
|
21
21
|
Sorare::Rewards.configuration.transform_division.call(division),
|
22
22
|
ComputeForDivision.call!(playing_rate: league.playing_rate, available_prize_pools: prize_pools)
|
23
23
|
.division_prize_pools
|
24
24
|
]
|
25
|
-
end
|
25
|
+
end
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -31,7 +31,7 @@ module Sorare
|
|
31
31
|
|
32
32
|
def rewards_ratio_per_cards_in_circulation_for_rarity(rarity)
|
33
33
|
if game_week.config.rewards_ratio_per_cards_in_circulation.is_a?(Hash)
|
34
|
-
return game_week.config.rewards_ratio_per_cards_in_circulation
|
34
|
+
return game_week.config.rewards_ratio_per_cards_in_circulation[rarity]
|
35
35
|
end
|
36
36
|
|
37
37
|
game_week.config.rewards_ratio_per_cards_in_circulation
|
data/lib/sorare/rewards.rb
CHANGED
data/sorare-rewards.gemspec
CHANGED
@@ -2,12 +2,11 @@
|
|
2
2
|
|
3
3
|
require_relative 'lib/sorare/rewards/version'
|
4
4
|
|
5
|
-
# rubocop:disable Metrics/BlockLength
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = 'sorare-rewards'
|
8
7
|
spec.version = Sorare::Rewards::VERSION
|
9
|
-
spec.authors = ['
|
10
|
-
spec.email = ['
|
8
|
+
spec.authors = ['Sorare team']
|
9
|
+
spec.email = ['hello@sorare.com']
|
11
10
|
|
12
11
|
spec.summary = %w[Sorare reward allocation algorithm]
|
13
12
|
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
@@ -33,12 +32,12 @@ Gem::Specification.new do |spec|
|
|
33
32
|
spec.add_dependency 'activesupport', '~> 6.1.4'
|
34
33
|
spec.add_dependency 'interactor', '~> 3.1.2'
|
35
34
|
spec.add_dependency 'json', '~> 2'
|
36
|
-
spec.add_dependency 'net-http', '~> 0.1.1'
|
37
35
|
spec.add_dependency 'yaml', '~> 0.2.0'
|
38
36
|
spec.add_development_dependency 'ostruct', '~> 0.4.0'
|
39
37
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
40
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
38
|
+
spec.add_development_dependency 'rubocop', '~> 1.24.1'
|
41
39
|
spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
42
40
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.5.0'
|
41
|
+
spec.add_development_dependency 'webmock', '~> 3.14.0'
|
42
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
43
43
|
end
|
44
|
-
# rubocop:enable Metrics/BlockLength
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sorare-rewards
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Sorare team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: net-http
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.1.1
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.1.1
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: yaml
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +100,14 @@ dependencies:
|
|
114
100
|
requirements:
|
115
101
|
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
103
|
+
version: 1.24.1
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
108
|
- - "~>"
|
123
109
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
110
|
+
version: 1.24.1
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: rubocop-rake
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,9 +136,23 @@ dependencies:
|
|
150
136
|
- - "~>"
|
151
137
|
- !ruby/object:Gem::Version
|
152
138
|
version: 2.5.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: webmock
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 3.14.0
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 3.14.0
|
153
153
|
description:
|
154
154
|
email:
|
155
|
-
-
|
155
|
+
- hello@sorare.com
|
156
156
|
executables: []
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
@@ -211,6 +211,7 @@ licenses:
|
|
211
211
|
metadata:
|
212
212
|
homepage_uri: https://gitlab.com/sorare/sorare-rewards
|
213
213
|
source_code_uri: https://gitlab.com/sorare/sorare-rewards
|
214
|
+
rubygems_mfa_required: 'true'
|
214
215
|
post_install_message:
|
215
216
|
rdoc_options: []
|
216
217
|
require_paths:
|
@@ -226,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
227
|
- !ruby/object:Gem::Version
|
227
228
|
version: '0'
|
228
229
|
requirements: []
|
229
|
-
rubygems_version: 3.
|
230
|
+
rubygems_version: 3.3.3
|
230
231
|
signing_key:
|
231
232
|
specification_version: 4
|
232
233
|
summary: '["Sorare", "reward", "allocation", "algorithm"]'
|