module MessengerPigeon::Redmine::Init

Module mixin for redmine activeresource init

Public Class Methods

new(options) click to toggle source
# File lib/messenger_pigeon/modules/redmine.rb, line 10
def initialize(options)
  @options = options
  o = get_resource options[:resource]
  o.site = options[:site]
  o.user = options[:user]
  o.password = options[:password]
  o.include_root_in_json = true
  o.format = JsonFormatter.new
  @resource = o
end

Private Instance Methods

get_resource(name) click to toggle source
# File lib/messenger_pigeon/modules/redmine.rb, line 23
def get_resource(name)
  return @@known_instances[name] unless @@known_instances[name].nil?
  ar_cl = Class.new ActiveResource::Base
  @@known_instances[name] = Object.const_set(name, ar_cl)
end