usps-support 0.2.58 → 0.2.59
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 +4 -4
- data/lib/usps/support/models/hq/squadrons/district.rb +4 -1
- data/lib/usps/support/models/hq/squadrons/former_squadron.rb +4 -1
- data/lib/usps/support/models/hq/squadrons/squadron.rb +1 -1
- data/lib/usps/support/models/hq/squadrons/website.rb +3 -0
- data/lib/usps/support/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe464a3deaa4d74165c3ccb5444bb41525f140e201837640e74698cef34fdb51
|
|
4
|
+
data.tar.gz: 8136a910590fd5c554a34dba638a5511e79367ec2c08cf597b7781774a57884c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ae6dbb3d8162a830f0d2b974dcbef041c744b7f4c17d218c3ed4293dc0af0edd2dfc4cfd31d88366fbf4f776b7f2f120b0d8fe5bc1bfced16750722d26a06d6f
|
|
7
|
+
data.tar.gz: 33307ca69ef0cfa02be07c0ea7cf78e150281f6277de85fca849d935924b83763dc25b26c40bb42db5e624b26240b8cee562fafb53c825cdf7dd88bd7412613b
|
|
@@ -32,7 +32,10 @@ module Usps::Support::Models::Hq::Squadrons
|
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
# Squadrons and Districts are both stored in the same table, along with various historical entries
|
|
35
|
-
default_scope {
|
|
35
|
+
default_scope { org_type_district.district_style_name }
|
|
36
|
+
|
|
37
|
+
# There is at least one non-district with `type="D"`
|
|
38
|
+
scope :district_style_name, -> { where("Name REGEXP '^D?[0-9]{2}$'") }
|
|
36
39
|
|
|
37
40
|
# def self.lookup(number) = where("Name REGEXP '^D?0?#{number}$'").first
|
|
38
41
|
|
|
@@ -12,7 +12,10 @@ module Usps::Support::Models::Hq::Squadrons
|
|
|
12
12
|
)
|
|
13
13
|
|
|
14
14
|
# Former Squadrons stored in the same table as current Squadrons
|
|
15
|
-
default_scope {
|
|
15
|
+
default_scope { org_type_former.squadron_style_name }
|
|
16
|
+
|
|
17
|
+
# Former districts are also stored with `type="X"`
|
|
18
|
+
scope :squadron_style_name, -> { where.not("Name REGEXP '^[0-9]{2}[.]$'") }
|
|
16
19
|
|
|
17
20
|
# When a squadron becomes "former", its account is moved into the `plat` column
|
|
18
21
|
alias_attribute :account_number, :plat
|
|
@@ -25,7 +25,7 @@ module Usps::Support::Models::Hq::Squadrons
|
|
|
25
25
|
foreign_key: 'account', primary_key: 'account', inverse_of: :squadron
|
|
26
26
|
)
|
|
27
27
|
|
|
28
|
-
default_scope {
|
|
28
|
+
default_scope { org_type_squadron }
|
|
29
29
|
|
|
30
30
|
def name = self.Name.split(/ Sail (&|and)/)[0]
|
|
31
31
|
end
|
|
@@ -9,6 +9,9 @@ module Usps::Support::Models::Hq::Squadrons
|
|
|
9
9
|
self.primary_key = :id
|
|
10
10
|
ignore_type_column_sti!
|
|
11
11
|
|
|
12
|
+
# Non-Rails-style STI column
|
|
13
|
+
enum :type, { squadron: 'S', district: 'D', boc: 'B', former: 'X' }, prefix: :org_type
|
|
14
|
+
|
|
12
15
|
# This is a default behavior, that is overwritten by FormerSquadron
|
|
13
16
|
alias_attribute :account_number, :account
|
|
14
17
|
end
|
data/lib/usps/support/version.rb
CHANGED