basketball 0.0.16 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5be10590a625ef061cb6f7a80379710013ec3625fe215fa65bfddeda35bb1f5
4
- data.tar.gz: 5eff4fd535bddae0bf080f2fd0be83b4cdc8da7cc28c04667a1ec7cfd84f1f55
3
+ metadata.gz: 7f2c7326c8bfa26bcedb1ccbedec191db4681bed0831d5f37bb7691782a12ae4
4
+ data.tar.gz: c22558bd6733383f7926ee33506b86eb9bb8f4fa0807d8eb246d8a8b2912041b
5
5
  SHA512:
6
- metadata.gz: 41e8aac1b7270794a5557b9e94b3b23bd0f5f7169c5c38f87401eaf12e6865efd4a1b8293a8cf6b6a41813ecc476750f538abc511ae4554e94c3cc732c6a5872
7
- data.tar.gz: fd0fcc3117888b9c475efce63e5947de6f66950b3af98af9f4c551403749ab34fc6f989d3b48964bc29180be19c3af55931e5bb4ef67377f05dd83994ab82284
6
+ metadata.gz: f04c5f0691974ae8750d3e66eaf2be925b792b771201ee727313e3f678ca7712f2f5e22878486a682cf17c0a31cac3f38428e5a1eae7337a5b0b7929596cbc22
7
+ data.tar.gz: 1b6a61df353c5c4ec77935cd4a406839be050eed15ccd5f3f6c79aca701b2ed5ad09cb66efb4fda4f098e2e3fd75c76596170ed8359c2f5b6abbdc4b7ac8c194
@@ -66,6 +66,7 @@ module Basketball
66
66
 
67
67
  def serialize_pick(event)
68
68
  {
69
+ id: event.id || event.pick,
69
70
  type: PICK_EVENT,
70
71
  front_office: event.front_office.id,
71
72
  pick: event.pick,
@@ -78,6 +79,7 @@ module Basketball
78
79
 
79
80
  def serialize_skip(event)
80
81
  {
82
+ id: event.id || event.pick,
81
83
  type: SKIP_EVENT,
82
84
  front_office: event.front_office.id,
83
85
  pick: event.pick,
@@ -141,11 +143,16 @@ module Basketball
141
143
  front_office_id = hash[:front_office]
142
144
  front_office = front_offices.find { |fo| fo.id == front_office_id }
143
145
 
144
- case hash[:type]
145
- when PICK_EVENT
146
- deserialize_pick(hash, players:, front_office:)
147
- when SKIP_EVENT
148
- deserialize_skip(hash, front_office:)
146
+ event =
147
+ case hash[:type]
148
+ when PICK_EVENT
149
+ deserialize_pick(hash, players:, front_office:)
150
+ when SKIP_EVENT
151
+ deserialize_skip(hash, front_office:)
152
+ end
153
+
154
+ event.tap do |e|
155
+ e.send('id=', hash[:id])
149
156
  end
150
157
  end
151
158
  end
@@ -3,8 +3,8 @@
3
3
  module Basketball
4
4
  module Draft
5
5
  # Describes what all Room events have to have to be considered an "event".
6
- class Event < ValueObject
7
- value_reader :pick, :round, :round_pick, :front_office
6
+ class Event < Entity
7
+ attr_reader :pick, :round, :round_pick, :front_office
8
8
 
9
9
  def initialize(front_office:, pick:, round:, round_pick:)
10
10
  super()
@@ -18,7 +18,7 @@ module Basketball
18
18
  end
19
19
 
20
20
  def to_s
21
- "[##{pick} R:#{round} P:#{round_pick}] #{front_office}"
21
+ "[#{id}] ##{pick} R:#{round} P:#{round_pick} - #{front_office}"
22
22
  end
23
23
  end
24
24
  end
@@ -4,7 +4,7 @@ module Basketball
4
4
  module Draft
5
5
  # Room event where a player is selected.
6
6
  class Pick < Event
7
- value_reader :player, :auto
7
+ attr_reader :player, :auto
8
8
 
9
9
  def initialize(front_office:, player:, pick:, round:, round_pick:, auto: false)
10
10
  super(front_office:, pick:, round:, round_pick:)
@@ -13,8 +13,6 @@ module Basketball
13
13
 
14
14
  @player = player
15
15
  @auto = auto
16
-
17
- freeze
18
16
  end
19
17
 
20
18
  def to_s
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Basketball
4
- VERSION = '0.0.16'
4
+ VERSION = '0.0.17'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: basketball
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio