Class: Cacofonix::SimpleProduct

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

Overview

super class for some simplified Cacofonix::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.



9
10
11
# File 'lib/cacofonix/wrappers/simple_product.rb', line 9

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

Class Method Details

.from_xml(xml) ⇒ Object



17
18
19
# File 'lib/cacofonix/wrappers/simple_product.rb', line 17

def from_xml(xml)
  self.new(::Cacofonix::Product.from_xml(xml))
end

.parse(xml) ⇒ Object



25
26
27
# File 'lib/cacofonix/wrappers/simple_product.rb', line 25

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

.parse_file(filename) ⇒ Object



21
22
23
# File 'lib/cacofonix/wrappers/simple_product.rb', line 21

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

Instance Method Details

#productObject



36
37
38
# File 'lib/cacofonix/wrappers/simple_product.rb', line 36

def product
  @product
end

#to_xmlObject



40
41
42
# File 'lib/cacofonix/wrappers/simple_product.rb', line 40

def to_xml
  product.to_xml
end