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.



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

def parser
  @parser
end

Instance Attribute Details

#parserObject



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

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

Instance Method Details

#bodyObject



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

def body
  (+__getobj__.body).force_encoding(Encoding::UTF_8)
end

#parseObject



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

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

#to_hObject



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

def to_h
  MultiXml.parse(body)
end