lib/gotransverse-tract-api.rb in gotransverse-tract-api-0.3.3 vs lib/gotransverse-tract-api.rb in gotransverse-tract-api-0.3.4
- old
+ new
@@ -1,7 +1,9 @@
require "gotransverse-tract-api/version"
+
require "gotransverse-tract-api/configuration"
+require "gotransverse-tract-api/hash"
require "gotransverse-tract-api/billing_account/adjustment"
require "gotransverse-tract-api/billing_account/adjustment_application"
require "gotransverse-tract-api/billing_account/adjustment_reason"
require "gotransverse-tract-api/billing_account/billing_account"
@@ -215,12 +217,13 @@
end
xml_response = Nokogiri::XML(response.body.to_s)
klass = klass.to_s.split("::").last
- hsh = Hash.from_xml(xml_response.to_s)
+ hsh = Hash.from_xml(xml_response.to_s).recursive_symbolize_keys!
+
if method == :get
- hsh = hsh[klass.pluralize.camelize(:lower)][klass.camelize(:lower)] rescue Hash.from_xml(xml_response.to_s)[klass.camelize(:lower)]
+ hsh = hsh[klass.pluralize.camelize(:lower).to_sym][klass.camelize(:lower).to_sym] rescue Hash.from_xml(xml_response.to_s)[klass.camelize(:lower).to_sym]
end
return hsh
rescue
{}