Sha256: ac6312814380eefe2cf0266f605ab5fb80f9166f383cb510389ec7489547043a
Contents?: true
Size: 550 Bytes
Versions: 1
Compression:
Stored size: 550 Bytes
Contents
module ShippingScale class Response attr_accessor :raw class << self def parse(xml) response = self.new(xml) response.raw = xml response end end def initialize(xml) @xml = xml end attr_reader :xml def details details = {} xml.search("Package").children.each do |node| details[node.name.snakecase.to_sym] = node.text end return details end def price xml.search("Package").children.search("Postage").text.to_f end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shipping-scale-0.1.0 | lib/shipping_scale/response.rb |