cats_core 1.2.17 → 1.2.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/cats/core/transport_bid.rb +22 -0
- data/lib/cats/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b93e9f178cac6984e2689146acb62925c8b1e5aae7ff52af44d1c66c61cbb1f
|
4
|
+
data.tar.gz: e86322ba7a49ed5d297d0ee908146c19cdc06379fa3e9378d2453299debe0a68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11740fca3ba58526553c0a5ac21d2092ec1119ff7cfa78e2883d48f4e3bc4cc2fdde53e9276e2369ed173a2c94f8662fdcb5479daf06346e44d13d420c57c099
|
7
|
+
data.tar.gz: a03e11f02681870cb1552d4c4a05d7f1de37d25da9a50e98b29bc1ae7c8e4ef2c54b11cb7cb41bbcdec529851ec309596bba5d864fa957dbcede26cd6c96eca2
|
@@ -6,6 +6,8 @@ module Cats
|
|
6
6
|
CLOSED = 'Closed'.freeze
|
7
7
|
STATUSES = [NEW, OPEN, CLOSED].freeze
|
8
8
|
|
9
|
+
has_many :transport_bid_items
|
10
|
+
|
9
11
|
validates :reference_no, presence: true, uniqueness: true
|
10
12
|
validates :start_date, :end_date, :status, presence: true
|
11
13
|
validates :status, inclusion: { in: STATUSES }
|
@@ -16,6 +18,26 @@ module Cats
|
|
16
18
|
|
17
19
|
errors.add(:start_date, 'should be before end date.') if start_date >= end_date
|
18
20
|
end
|
21
|
+
|
22
|
+
def open
|
23
|
+
raise(StandardError, 'Bid is already open.') if status == OPEN
|
24
|
+
|
25
|
+
raise(StandardError, 'Bid is empty.') if transport_bid_items.count.zero?
|
26
|
+
|
27
|
+
self.status = OPEN
|
28
|
+
save!
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
def close
|
33
|
+
raise(StandardError, 'Bid is already closed.') if status == CLOSED
|
34
|
+
|
35
|
+
raise(StandardError, 'Bid should first be open.') if status == NEW
|
36
|
+
|
37
|
+
self.status = CLOSED
|
38
|
+
save!
|
39
|
+
self
|
40
|
+
end
|
19
41
|
end
|
20
42
|
end
|
21
43
|
end
|
data/lib/cats/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cats_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|