Class: Elibri::ONIX::Release_3_0::ProductIdentifier
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::ProductIdentifier
- Includes:
- HashId
- Defined in:
- lib/elibri_onix/onix_3_0/product_identifier.rb
Overview
product identifier, for example isbn
Constant Summary collapse
- ATTRIBUTES =
:nodoc:
[ :type, :type_name, :value, :identifier_type ]
- RELATIONS =
:nodoc:
[ :inspect_include_fields ]
Constants included from HashId
HashId::SKIPPED_2, HashId::SKIPPED_ATTRIBS
Instance Attribute Summary collapse
-
#to_xml ⇒ Object
xml representation of identifier.
-
#type ⇒ Object
onix code of type (see elibri_onix_dict, Elibri::ONIX::Dict::Release_3_0::ProductIDType).
-
#type_name ⇒ Object
if type is prioprietery (01) - then the name of type.
-
#value ⇒ Object
identifier value.
Instance Method Summary collapse
-
#identifier_type ⇒ Object
returs the string name of value type.
-
#initialize(data) ⇒ ProductIdentifier
constructor
A new instance of ProductIdentifier.
-
#inspect_include_fields ⇒ Object
:nodoc:.
Methods included from HashId
Constructor Details
#initialize(data) ⇒ ProductIdentifier
Returns a new instance of ProductIdentifier.
33 34 35 36 37 38 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 33 def initialize(data) @to_xml = data.to_s @type = data.at_xpath('xmlns:ProductIDType').try(:text) @type_name = data.at_xpath('xmlns:IDTypeName').try(:text) @value = data.at_xpath('xmlns:IDValue').try(:text) end |
Instance Attribute Details
#to_xml ⇒ Object
xml representation of identifier
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 21 def to_xml @to_xml end |
#type ⇒ Object
onix code of type (see elibri_onix_dict, Elibri::ONIX::Dict::Release_3_0::ProductIDType)
12 13 14 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 12 def type @type end |
#type_name ⇒ Object
if type is prioprietery (01) - then the name of type
15 16 17 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 15 def type_name @type_name end |
#value ⇒ Object
identifier value
18 19 20 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 18 def value @value end |
Instance Method Details
#identifier_type ⇒ Object
returs the string name of value type
41 42 43 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 41 def identifier_type Elibri::ONIX::Dict::Release_3_0::ProductIDType.find_by_onix_code(@type).const_name.downcase end |
#inspect_include_fields ⇒ Object
:nodoc:
46 47 48 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 46 def inspect_include_fields [:identifier_type] end |