Sha256: 581c35f1b3908cdad61c00fa17c5e9709aa1d9b5f0506c58cbd968e814009fa0

Contents?: true

Size: 927 Bytes

Versions: 5

Compression:

Stored size: 927 Bytes

Contents

require 'sax-machine'

module Correios
  module SRO
    class Event
      include SAXMachine

      element :tipo,       :as => :type
      element :status,     :as => :status
      element :data,       :as => :date
      element :hora,       :as => :hour
      element :descricao,  :as => :description
      element :recebedor,  :as => :receiver
      element :documento,  :as => :document
      element :comentario, :as => :comment
      element :local,      :as => :place
      element :codigo,     :as => :code
      element :cidade,     :as => :city
      element :uf,         :as => :state
      element :sto,        :as => :sto
      element :destino,    :as => :destination, :class => Correios::SRO::Destination

      [:receiver, :document, :comment].each do |method|
        define_method "#{method}=" do |value|
          instance_variable_set("@#{method}", value.to_s.strip)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
correios-sro-xml-0.4.0 lib/correios/sro/event.rb
correios-sro-xml-0.3.1 lib/correios/sro/event.rb
correios-sro-xml-0.3.0 lib/correios/sro/event.rb
correios-sro-xml-0.2.1 lib/correios/sro/event.rb
correios-sro-xml-0.2.0 lib/correios/sro/event.rb