Sha256: d4aacf8eb774df2a9b0c7712d49354db0e9b1ab53d69677281b9eb0325d324e0
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require 'uri' class Easytobookr class Config attr_accessor :env attr_accessor :endpoint, :username, :password, :campaignid DEFAULTS = { :test => { :endpoint => 'http://testnl.etbxml.com/webservice/server_v21.php', :username => 'affiliate', :password => 'affiliate', :campaignid => '1' }, :production => { :endpoint => 'https://www.etbxml.com/webservice/server_v21.php' } }.freeze def initialize self.env = :test end def env=(value) if (@env = value) == :production @endpoint = DEFAULTS[:production][:endpoint] @username = @password = @campaignid = nil else @endpoint = DEFAULTS[:test][:endpoint] @username ||= DEFAULTS[:test][:username] @password ||= DEFAULTS[:test][:password] @campaignid ||= DEFAULTS[:test][:campaignid] end end def uri URI.parse(endpoint) end end class << self def config @@config ||= Config.new end def setup(&block) block.call(config) if block_given? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
easytobookr-0.0.1 | lib/easytobookr/config.rb |