summaryrefslogtreecommitdiff
path: root/app/models/service_level.rb
blob: 31a713bfcf050c129c25e9f6444f9265e7a519f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class ServiceLevel

  def initialize(attributes = {})
    @id = attributes[:id] || APP_CONFIG[:default_service_level]
  end

  def self.authenticated_select_options
    APP_CONFIG[:service_levels].map { |id,config_hash| [config_hash[:description], id] if config_hash[:name] != 'anonymous'}.compact
  end

  def id
    @id
  end

  def config_hash
    APP_CONFIG[:service_levels][@id]
  end

  delegate :to_json, to: :config_hash
end