Sha256: 68ffb47c076293072856d3d336a7926a9c865662e96551abca22841f1838bdaf

Contents?: true

Size: 571 Bytes

Versions: 5

Compression:

Stored size: 571 Bytes

Contents

require 'yaml'
require 'ostruct'
require 'active_resource'

module Medivo
  class Locator
    def self.find
      return @location if @location
      config_file = File.join(Rails.root.join('config', 'medivo_resource.yml'))
      config = YAML.load_file(config_file)
      @location = OpenStruct.new config[Rails.env]
    end
  end

  class Resource < ActiveResource::Base
    location = Locator.find
    self.include_root_in_json = false
    self.site = location.href
    self.user = location.user
    self.password = location.password
    self.format = :xml
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
medivo-0.0.12 app/models/medivo/resource.rb
medivo-0.0.11 app/models/medivo/resource.rb
medivo-0.0.9 app/models/medivo/resource.rb
medivo-0.0.8 app/models/medivo/resource.rb
medivo-0.0.7 app/models/medivo/resource.rb