Class: OAS::AdXML::Response

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/oas/adxml.rb

Instance Attribute Summary collapse

Attributes included from Utils

#parser

Instance Method Summary collapse

Methods included from Utils

#to_hash, #to_s

Constructor Details

#initialize(doc) ⇒ Response

Returns a new instance of Response.



43
44
45
46
47
48
49
50
51
# File 'lib/oas/adxml.rb', line 43

def initialize(doc)
  @doc  = doc
  @error_code = @error_text = nil
  error = @doc.xpath('.//Exception').first rescue nil
  if error
    @error_code = error['errorCode'].to_i
    @error_text = error.text
  end
end

Instance Attribute Details

#error_codeObject (readonly)

Returns the value of attribute error_code.



40
41
42
# File 'lib/oas/adxml.rb', line 40

def error_code
  @error_code
end

#error_textObject (readonly)

Returns the value of attribute error_text.



41
42
43
# File 'lib/oas/adxml.rb', line 41

def error_text
  @error_text
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/oas/adxml.rb', line 53

def success?
  !error_code
end