class Vacuum::Parser::ItemSearchResponse

Attributes

Document[RW]

Public Class Methods

new(document) click to toggle source
# File lib/vacuum/parser/itemsearch_response.rb, line 6
def initialize(document)
  raise ParserError.new('Not a XML::Document') unless document.is_a?(Nokogiri::XML::Document)
  @Document = document
  raise ParserError.new('Not a ItemSearchResponse') if document.root.name != 'ItemSearchResponse'
end

Public Instance Methods

error() click to toggle source
# File lib/vacuum/parser/itemsearch_response.rb, line 25
def error
  error = @Document.at('/xmlns:ItemSearchResponse/xmlns:Items/xmlns:Request/xmlns:Errors/xmlns:Error')
  error.content if error
end
isValid?() click to toggle source
# File lib/vacuum/parser/itemsearch_response.rb, line 16
def isValid?
  (n = @Document.at('/xmlns:ItemSearchResponse/xmlns:Items/xmlns:Request/xmlns:IsValid')) &&
  (n.content == 'True')
end
items() click to toggle source
# File lib/vacuum/parser/itemsearch_response.rb, line 30
def items
  return nil unless isValid?
  @Items ||= Items.new(@Document.at('/xmlns:ItemSearchResponse/xmlns:Items'))
end
operationRequest() click to toggle source
# File lib/vacuum/parser/itemsearch_response.rb, line 12
def operationRequest
  OperationRequest.new(@Document.at('/xmlns:ItemSearchResponse/xmlns:OperationRequest'))
end
request() click to toggle source
# File lib/vacuum/parser/itemsearch_response.rb, line 21
def request
  @Document.at('/xmlns:ItemSearchResponse/xmlns:Items/xmlns:Request/xmlns:ItemSearchRequest')
end