Class: RakutenProductApi::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/rakuten_product_api/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



7
8
9
10
11
12
# File 'lib/rakuten_product_api/response.rb', line 7

def initialize(response)
  @http_response = response
  @raw = Nokogiri::XML(response.body)

  @items = @raw.xpath("result/item").map { |d| Item.new(d) }
end

Instance Attribute Details

#datasObject (readonly)

Returns the value of attribute datas.



5
6
7
# File 'lib/rakuten_product_api/response.rb', line 5

def datas
  @datas
end

#docObject (readonly)

Returns the value of attribute doc.



5
6
7
# File 'lib/rakuten_product_api/response.rb', line 5

def doc
  @doc
end

#http_responseObject (readonly)

Returns the value of attribute http_response.



5
6
7
# File 'lib/rakuten_product_api/response.rb', line 5

def http_response
  @http_response
end

#itemsObject (readonly)

Returns the value of attribute items.



5
6
7
# File 'lib/rakuten_product_api/response.rb', line 5

def items
  @items
end

#rawObject (readonly)

Returns the value of attribute raw.



5
6
7
# File 'lib/rakuten_product_api/response.rb', line 5

def raw
  @raw
end

Instance Method Details

#bodyObject



14
15
16
# File 'lib/rakuten_product_api/response.rb', line 14

def body
  @raw.to_s
end