Class: Elibri::ONIX::Release_3_0::ProductIdentifier
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::ProductIdentifier
- Defined in:
- lib/elibri_onix/onix_3_0/product_identifier.rb
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:.
Constructor Details
#initialize(data) ⇒ ProductIdentifier
Returns a new instance of ProductIdentifier.
18 19 20 21 22 23 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 18 def initialize(data) @to_xml = data.to_s @type = data.at_css('ProductIDType')&.text @type_name = data.at_css('IDTypeName')&.text @value = data.at_css('IDValue')&.text end |
Instance Attribute Details
#to_xml ⇒ Object
xml representation of identifier
16 17 18 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 16 def to_xml @to_xml end |
#type ⇒ Object
onix code of type (see elibri_onix_dict, Elibri::ONIX::Dict::Release_3_0::ProductIDType)
7 8 9 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 7 def type @type end |
#type_name ⇒ Object
if type is prioprietery (01) - then the name of type
10 11 12 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 10 def type_name @type_name end |
#value ⇒ Object
identifier value
13 14 15 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 13 def value @value end |
Instance Method Details
#identifier_type ⇒ Object
returs the string name of value type
26 27 28 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 26 def identifier_type Elibri::ONIX::Dict::Release_3_0::ProductIDType.find_by_onix_code(@type)&.const_name&.downcase end |
#inspect_include_fields ⇒ Object
:nodoc:
31 32 33 |
# File 'lib/elibri_onix/onix_3_0/product_identifier.rb', line 31 def inspect_include_fields [:identifier_type] end |