Class: TitlePage::ProductIdentifier

Inherits:
Response
  • Object
show all
Defined in:
lib/titlepage/utils.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#id_valueObject

Returns the value of attribute id_value.



17
18
19
# File 'lib/titlepage/utils.rb', line 17

def id_value
  @id_value
end

#product_id_typeObject

Returns the value of attribute product_id_type.



16
17
18
# File 'lib/titlepage/utils.rb', line 16

def product_id_type
  @product_id_type
end

Class Method Details

.from_xml(node) ⇒ Object

convert a nokogiri node to a TitlePage::ProductIdentifier object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/titlepage/utils.rb', line 21

def self.from_xml(node)
  return nil if node.nil?
  #<ProductIdentifiers xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:ProductIdentifier[1]">
  #  <item xsi:type="tns:ProductIdentifier">
  #    <ProductIDType xsi:type="xsd:string">15</ProductIDType>
  #    <IDValue xsi:type="xsd:string">9780091835132</IDValue>
  #  </item>
  #</ProductIdentifiers>
  id = self.new
  id.product_id_type = node.xpath("//item/ProductIDType/text()").to_s
  id.id_value = node.xpath("//item/IDValue/text()").to_s
  id
end

Instance Method Details

#normalise_encodings!(current_enc) ⇒ Object

ensure all string attributes are UTF-8 encoded



37
38
39
# File 'lib/titlepage/utils.rb', line 37

def normalise_encodings!(current_enc)
  attribs = [:product_id_type, :id_value]
end