Class: Brownie::Common
- Inherits:
-
Object
- Object
- Brownie::Common
- Defined in:
- lib/brownie/common.rb
Class Method Summary collapse
Class Method Details
.domain ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/brownie/common.rb', line 3 def self.domain env = Object.const_defined?(:Rails) ? Rails.env : nil staging = "wwwcie.ups.com" production = "onlinetools.ups.com" if !env.nil? if !env.to_s.eql?("production") return staging end end if ENV["ENV"].nil? return staging end return staging unless ENV["ENV"].eql?("production") return production end |
.template_to_hash(template, root = "ShipmentConfirmRequest") ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/brownie/common.rb', line 22 def self.template_to_hash(template,root="ShipmentConfirmRequest") xml_path = File.join(File.dirname(File.(__FILE__)), "../../xml/#{template}.xml") digest_xml_file = File.open(xml_path, "rb") xml = digest_xml_file.read hash = Hash.from_xml(xml) hash[root] end |