Class: Vacuum::Response

Inherits:
SimpleDelegator
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/vacuum/response.rb

Overview

A wrapper around the Amazon Product Advertising API response.

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.parserObject

Returns the value of attribute parser.



12
13
14
# File 'lib/vacuum/response.rb', line 12

def parser
  @parser
end

Instance Attribute Details

#parserObject



19
20
21
# File 'lib/vacuum/response.rb', line 19

def parser
  @parser || self.class.parser
end

Instance Method Details

#bodyObject



31
32
33
# File 'lib/vacuum/response.rb', line 31

def body
  __getobj__.body.force_encoding('UTF-8')
end

#parseObject



23
24
25
# File 'lib/vacuum/response.rb', line 23

def parse
  parser ? parser.parse(body) : to_h
end

#to_hObject



27
28
29
# File 'lib/vacuum/response.rb', line 27

def to_h
  MultiXml.parse(body)
end