Class: Nfe::Xml
- Inherits:
-
Object
- Object
- Nfe::Xml
- Defined in:
- lib/nfe/xml.rb
Instance Attribute Summary collapse
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#result ⇒ Object
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(xml_or_file) ⇒ Xml
constructor
A new instance of Xml.
- #valid? ⇒ Boolean
Constructor Details
#initialize(xml_or_file) ⇒ Xml
Returns a new instance of Xml.
8 9 10 11 |
# File 'lib/nfe/xml.rb', line 8 def initialize(xml_or_file) xml_or_file = File.read(xml_or_file) if File.exist?(xml_or_file) @xml_content = xml_or_file end |
Instance Attribute Details
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
6 7 8 |
# File 'lib/nfe/xml.rb', line 6 def open_timeout @open_timeout end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
6 7 8 |
# File 'lib/nfe/xml.rb', line 6 def read_timeout @read_timeout end |
#result ⇒ Object
Returns the value of attribute result.
6 7 8 |
# File 'lib/nfe/xml.rb', line 6 def result @result end |
Instance Method Details
#valid? ⇒ Boolean
13 14 15 16 17 18 19 20 21 |
# File 'lib/nfe/xml.rb', line 13 def valid? case request when Net::HTTPSuccess then self.result = WebService::SearchResult.new(request.body) !request.body.include?('../Imagens/erro.png') else false end end |