lib/securetrading/connection.rb in securetrading-0.3.2 vs lib/securetrading/connection.rb in securetrading-0.4.0

- old
+ new

@@ -17,12 +17,23 @@ Ox.dump(ox_xml) end private + attr_reader :config_options + + def config + @config ||= configuration + end + + def configuration + return Securetrading.config unless config_options.present? + Configuration.new(config_options) + end + def doc - @doc ||= XmlDoc.new(request_type, @account_type).doc + @doc ||= XmlDoc.new(request_type, @account_type, config.user).doc end def request_type fail NotImplementedError, 'Implement :request_type method in sub-class!' end @@ -37,10 +48,10 @@ ) Securetrading::Response.new(party) end def dynamic_headers - { 'Authorization' => "Basic #{Securetrading.config.auth}" } + { 'Authorization' => "Basic #{config.auth}" } end def prepare_doc return doc if xml_prepared? yield