concordia-publishing-house/errbit

View on GitHub
lib/issue_trackers/apis/mingle.rb

Summary

Maintainability
A
0 mins
Test Coverage
require 'active_resource'

module Mingle
  class Card < ActiveResource::Base
    # site template ~> "https://username:password@mingle.example.com/api/v1/projects/:project_id/"
    self.format = :xml
  end
  def self.set_site(site)
    # ActiveResource seems to clone and freeze the @site variable
    # after the first use. It seems that the only way to change @site
    # is to drop the subclass, and then reload it.
    Mingle.send(:remove_const, :Card)
    load File.join(Rails.root,'lib','issue_trackers', 'apis','mingle.rb')
    Mingle::Card.site = site
  end
end