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, include_branches: true) ⇒ Object



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

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

.district_courts(superior_ids = nil) ⇒ Object



50
51
52
53
# File 'app/resources/egov_utils/organization.rb', line 50

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



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

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

.region_courts(branches = false) ⇒ Object



46
47
48
# File 'app/resources/egov_utils/organization.rb', line 46

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