Sha256: a81c88ef109690b3d16cf08183f9b30d71e15d9ea8acb625ed9f26e7c5f694e4

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

#lib_dir = File.expand_path("..", __FILE__)
#$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)

require "kaui/engine"

module Kaui
  mattr_accessor :killbill_finder
  mattr_accessor :account_home_path
  mattr_accessor :bundle_home_path
  mattr_accessor :invoice_home_path
  mattr_accessor :bundle_key_display_string
  mattr_accessor :creditcard_plugin_name
  mattr_accessor :layout
  mattr_accessor :killbill_url

  self.killbill_finder = lambda { self.config[:killbill_url] }
  self.account_home_path = lambda {|account_id| Kaui::Engine.routes.url_helpers.account_path(account_id) }
  self.bundle_home_path = lambda {|bundle_id| Kaui::Engine.routes.url_helpers.bundle_path(:id => bundle_id) }
  self.invoice_home_path = lambda {|invoice_id| Kaui::Engine.routes.url_helpers.invoice_path(:id => invoice_id) }
  self.bundle_key_display_string =  lambda {|bundle_key| bundle_key }
  self.creditcard_plugin_name =  lambda { '__EXTERNAL_PAYMENT__' }

  def self.config(&block)
    # TODO
    {
      :layout => layout || 'kaui/layouts/kaui_application',
      :killbill_url => killbill_url || ENV['KILLBILL_URL'] || 'http://127.0.0.1:8080'
    }
  end

  KillBillClient.url = Kaui.killbill_finder.call
end

# ruby-1.8 compatibility
module Kernel
  def define_singleton_method(*args, &block)
    class << self
      self
    end.send(:define_method, *args, &block)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kaui-0.7.1 lib/kaui.rb
kaui-0.7.0 lib/kaui.rb