Class: CorreiosSigep::Models::SRO

Inherits:
Object
  • Object
show all
Defined in:
lib/correios_sigep/models/sro.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ SRO



6
7
8
9
# File 'lib/correios_sigep/models/sro.rb', line 6

def initialize(options={})
  @collect_number = options[:collect_number]
  @type           = options[:type]
end

Instance Attribute Details

#collect_numberObject

Returns the value of attribute collect_number.



4
5
6
# File 'lib/correios_sigep/models/sro.rb', line 4

def collect_number
  @collect_number
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/correios_sigep/models/sro.rb', line 4

def type
  @type
end

Instance Method Details

#to_xmlObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/correios_sigep/models/sro.rb', line 11

def to_xml
  builder = Nokogiri::XML::Builder.new do |xml|
    xml.root do
      xml.tipoBusca('H')
      xml.tipoSolicitacao(@type)
      xml.numeroPedido(@collect_number)
    end
  end
  builder.to_xml
end