Class: Elibri::ONIX::Release_3_0::Supplier
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::Supplier
- Defined in:
- lib/elibri_onix/onix_3_0/supplier.rb
Instance Attribute Summary collapse
-
#email_address ⇒ Object
Returns the value of attribute email_address.
-
#identifiers ⇒ Object
Returns the value of attribute identifiers.
-
#name ⇒ Object
Returns the value of attribute name.
-
#role ⇒ Object
Returns the value of attribute role.
-
#telephone_number ⇒ Object
Returns the value of attribute telephone_number.
-
#to_xml ⇒ Object
Returns the value of attribute to_xml.
-
#website ⇒ Object
Returns the value of attribute website.
Instance Method Summary collapse
-
#initialize(data) ⇒ Supplier
constructor
A new instance of Supplier.
- #nip ⇒ Object
Constructor Details
#initialize(data) ⇒ Supplier
Returns a new instance of Supplier.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/elibri_onix/onix_3_0/supplier.rb', line 8 def initialize(data) @to_xml = data.to_s @role = data.at_css('SupplierRole')&.text @identifiers = data.css('SupplierIdentifier').map { |identifier_data| SupplierIdentifier.new(identifier_data) } @name = data.at_css('SupplierName')&.text @telephone_number = data.at_css('TelephoneNumber')&.text @email_address = data.at_css('EmailAddress')&.text if data.at_css('Website') @website = data.at_css('Website').at_css('WebsiteLink')&.text end end |
Instance Attribute Details
#email_address ⇒ Object
Returns the value of attribute email_address.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supplier.rb', line 6 def email_address @email_address end |
#identifiers ⇒ Object
Returns the value of attribute identifiers.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supplier.rb', line 6 def identifiers @identifiers end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supplier.rb', line 6 def name @name end |
#role ⇒ Object
Returns the value of attribute role.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supplier.rb', line 6 def role @role end |
#telephone_number ⇒ Object
Returns the value of attribute telephone_number.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supplier.rb', line 6 def telephone_number @telephone_number end |
#to_xml ⇒ Object
Returns the value of attribute to_xml.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supplier.rb', line 6 def to_xml @to_xml end |
#website ⇒ Object
Returns the value of attribute website.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/supplier.rb', line 6 def website @website end |
Instance Method Details
#nip ⇒ Object
20 21 22 |
# File 'lib/elibri_onix/onix_3_0/supplier.rb', line 20 def nip @identifiers.find {|identifier| (identifier.type == '02') && (identifier.type_name == 'NIP')}&.value end |