usps-support 0.2.58 → 0.2.59.pre.1

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: 3ed60e1b9f3220f40864fd2cd0f534f51fd3910faf657a0d5b735e425f669b12
4
- data.tar.gz: a748625e90d6afa6b9320a7b0e26fdd1252059d9866ca54cc2ac842de5a8d0e0
3
+ metadata.gz: 806cef939766223cd49d93460bee3205c138998e763506d5f49db685b0ce40f1
4
+ data.tar.gz: 79cb098bc96df14d5f429b1bf6fa829d68240ec91e3c0d5d4e3f845012e67c39
5
5
  SHA512:
6
- metadata.gz: 529f767a03f44b84d850aa443a1a9a1208320c67084f2220ea88abe4abf9a9de404d64ab3896fb40c7c195c5a3a53c0a0790956654d564e0bcc90db9c5049ac7
7
- data.tar.gz: dd66212142fae87a11709751e3432db16f13e0cc63bd2993e1028bff15e51384a6e684e3de652f0656e12642603f67183ee714d9efc6a9d957eb2ea8cff4978a
6
+ metadata.gz: a7fb331df2513bcf2c7193f234e3411d06ce8e85897bbab581e2fbb47c11379862be4b59a5af0dc2ee7e8e41ec1c98b6b9c187cc23813bf55aa107bdd3929fae
7
+ data.tar.gz: c2f473b8f6f7f409396fac8b2ac65e08cd80e08aeae6c6239d24089236d30b4eb5118dac01e01a374de8f9dba927f4f3c33a508f1dbe0567c1edc63c6ae7d1f5
@@ -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 { where("Name REGEXP '^D?[0-9]{2}$'").where.not(account: nil) }
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 { where(account: 0).where('Name NOT REGEXP \'^[0-9]{2}\.$\'') }
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 { where.not("Name REGEXP '^D?[0-9]{2}$'").where.not(account: 0) }
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Support
5
- VERSION = '0.2.58'
5
+ VERSION = '0.2.59-1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.58
4
+ version: 0.2.59.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander