Module: DmtdVbmappData

Defined in:
lib/dmtd_vbmapp_data.rb,
lib/dmtd_vbmapp_data/guide.rb,
lib/dmtd_vbmapp_data/client.rb,
lib/dmtd_vbmapp_data/version.rb,
lib/dmtd_vbmapp_data/protocol.rb,
lib/dmtd_vbmapp_data/guide_chapter.rb,
lib/dmtd_vbmapp_data/protocol_area.rb,
lib/dmtd_vbmapp_data/request_helpers.rb,
lib/dmtd_vbmapp_data/assessment_report.rb,
lib/dmtd_vbmapp_data/protocol_area_group.rb,
lib/dmtd_vbmapp_data/protocol_area_skill.rb,
lib/dmtd_vbmapp_data/guide_chapter_section.rb,
lib/dmtd_vbmapp_data/protocol_area_question.rb,
lib/dmtd_vbmapp_data/protocol_area_response.rb

Defined Under Namespace

Classes: AssessmentReport, Client, Guide, GuideChapter, GuideChapterSection, Protocol, ProtocolArea, ProtocolAreaGroup, ProtocolAreaQuestion, ProtocolAreaResponse, ProtocolAreaSkill, RequestHelpers

Constant Summary collapse

AVAILABLE_LANGUAGES =
%w(en es fr)
GENDER_MALE =
1
GENDER_FEMALE =
2
VERSION =
'1.4.1'.freeze

Class Method Summary collapse

Class Method Details

.configObject



52
53
54
# File 'lib/dmtd_vbmapp_data.rb', line 52

def self.config
  @config
end

.configure(opts = {}) ⇒ Object



36
37
38
# File 'lib/dmtd_vbmapp_data.rb', line 36

def self.configure(opts = {})
  opts.each {|k,v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym}
end

.configure_with(path_to_yaml_file) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/dmtd_vbmapp_data.rb', line 40

def self.configure_with(path_to_yaml_file)
  begin
    config = Psych::load(IO.read(path_to_yaml_file))
  rescue Errno::ENOENT
    log(:warning, "YAML configuration file couldn't be found. Using defaults."); return
  rescue Psych::SyntaxError
    log(:warning, 'YAML configuration file contains invalid syntax. Using defaults.'); return
  end

  configure(config)
end