Class: EgovUtils::Organization

Inherits:
Love
  • Object
show all
Defined in:
app/resources/egov_utils/organization.rb

Class Method Summary collapse

Methods inherited from Love

config, inherited, mock!, mock_subclass, mocked_classes, where

Class Method Details

.courts(organization_keys = nil) ⇒ Object



29
30
31
32
33
# File 'app/resources/egov_utils/organization.rb', line 29

def self.courts(organization_keys=nil)
  filters = {category_abbrev: ['OS','KS', 'MS']}
  filters.merge!(key: organization_keys) if organization_keys.present?
  all(params: {f: filters, sort: {'0' => {path: 'category_abbrev'} }})
end

.district_courts(superior_ids = nil) ⇒ Object



39
40
41
42
# File 'app/resources/egov_utils/organization.rb', line 39

def self.district_courts(superior_ids=nil)
  f = superior_ids ? {superior_id: superior_ids} : {}
  all(params: {f: f.merge({category_abbrev: '=|OS'}), sort: {'0' => {path: 'name'} }})
end

.find_by_key(key) ⇒ Object



25
26
27
# File 'app/resources/egov_utils/organization.rb', line 25

def self.find_by_key(key)
  where(key: key).first
end

.region_courts(branches = false) ⇒ Object



35
36
37
# File 'app/resources/egov_utils/organization.rb', line 35

def self.region_courts(branches=false)
  all(params: {f: {category_abbrev: ['KS','MS'], branch_of_id: [nil]}, sort: {'0' => {path: 'name'} }})
end