Class: ONIX::SimpleProduct

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/onix/simple_product.rb

Overview

super class for some simplified ONIX::Product wrappers

Direct Known Subclasses

APAProduct

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(product = nil) ⇒ SimpleProduct

Returns a new instance of SimpleProduct.



7
8
9
# File 'lib/onix/simple_product.rb', line 7

def initialize(product = nil)
  @product = product || ::ONIX::Product.new
end

Class Method Details

.parse(xml) ⇒ Object



19
20
21
# File 'lib/onix/simple_product.rb', line 19

def parse(xml)
  self.new(::ONIX::Product.parse(xml))
end

.parse_file(filename) ⇒ Object



15
16
17
# File 'lib/onix/simple_product.rb', line 15

def parse_file(filename)
  self.new(::ONIX::Product.parse(File.read(filename)))
end

Instance Method Details

#productObject



30
31
32
# File 'lib/onix/simple_product.rb', line 30

def product
  @product
end

#to_xmlObject



34
35
36
# File 'lib/onix/simple_product.rb', line 34

def to_xml
  product.to_xml
end