Sha256: 29944e7f3eb893dd06b1a251b9aea94294566e2323f7ffe1e14ec39c2395335a

Contents?: true

Size: 945 Bytes

Versions: 2

Compression:

Stored size: 945 Bytes

Contents

# encoding: UTF-8
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

2 entries across 2 versions & 1 rubygems

Version Path
correios-sro-xml-0.1.1 lib/correios/sro/event.rb
correios-sro-xml-0.1.0 lib/correios/sro/event.rb