Sha256: 9f70242381449079848397c7be4f7abdf422f73eff678fe1748680b20f86e5da

Contents?: true

Size: 545 Bytes

Versions: 2

Compression:

Stored size: 545 Bytes

Contents

module PagseguroCatcher
  module Transaction
    
    class Shipping < Transaction::Body
      
      def initialize(body)
        self.body = body[:shipping]
      end
      
      def zip
        self[:address][:postalCode]
      end
      
      def human_type
        SHIPPING_TYPES[self[:type].to_i]
      end
      
      def cost
        self[:cost].to_f
      end
      
      def method_missing(name, *args)
        return self[:address][name] if self.body[:address].has_key?(name.to_sym)
        super
      end

    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pagseguro_catcher-0.1.1 lib/pagseguro_catcher/transaction/shipping.rb
pagseguro_catcher-0.1.0 lib/pagseguro_catcher/transaction/shipping.rb