Class: Vacuum::Response

Inherits:
SimpleDelegator
  • Object
show all
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.



8
9
10
# File 'lib/vacuum/response.rb', line 8

def parser
  @parser
end

Instance Attribute Details

#parserObject



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

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

Instance Method Details

#bodyObject



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

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

#parseObject



17
18
19
# File 'lib/vacuum/response.rb', line 17

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

#to_hObject



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

def to_h
  MultiXml.parse(body)
end