Class: EgovUtils::OrganizationMock
- Defined in:
- app/resources/egov_utils/organization.rb
Class Method Summary collapse
- .all(*attrs) ⇒ Object
- .courts(organization_keys = nil, include_branches: true) ⇒ Object
- .find_by_key(key) ⇒ Object
- .region_courts(branches = false) ⇒ Object
Instance Method Summary collapse
Methods inherited from LoveMock
Class Method Details
.all(*attrs) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/resources/egov_utils/organization.rb', line 3 def self.all(*attrs) [ new(id: 1, name: 'Městský soud 1', key: '104000', category_abbrev: 'MS' ), new(id: 2, name: 'Krajský soud 1', key: '204000', category_abbrev: 'KS' ), new(id: 3, name: 'Krajský soud 2', key: '205000', category_abbrev: 'KS' ), new(id: 13, name: 'Okresní soud 1', key: '204001', category_abbrev: 'OS' ), new(id: 14, name: 'Okresní soud v Chomutově', key: '205030', category_abbrev: 'OS' ) ] end |
.courts(organization_keys = nil, include_branches: true) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/resources/egov_utils/organization.rb', line 17 def self.courts(organization_keys=nil, include_branches: true) all.select do |o| %w{OS KS MS}.include?(o.category_abbrev) && (organization_keys.nil? || organization_keys.include?(o.key)) end.tap do |collection| collection.select { _1.branch_of_id.nil? } unless include_branches end end |
.find_by_key(key) ⇒ Object
13 14 15 |
# File 'app/resources/egov_utils/organization.rb', line 13 def self.find_by_key(key) all.detect{ |o| o.key == key } end |
.region_courts(branches = false) ⇒ Object
26 27 28 |
# File 'app/resources/egov_utils/organization.rb', line 26 def self.region_courts(branches=false) all.select{ |o| %w{KS MS}.include?(o.category_abbrev) } end |
Instance Method Details
#branch_of_id ⇒ Object
30 |
# File 'app/resources/egov_utils/organization.rb', line 30 def branch_of_id; end |