class Elibri::ONIX::Release_3_0::Supplier

Constants

ATTRIBUTES

from ONIX documentation: A group of data elements which together define a supplier. Mandatory in each occurrence of the <SupplyDetail> composite, and not repeatable.

RELATIONS

Attributes

email_address[RW]
identifiers[RW]
name[RW]
role[RW]
telephone_number[RW]
to_xml[RW]
website[RW]

Public Class Methods

new(data) click to toggle source
# File lib/elibri_onix/onix_3_0/supplier.rb, line 25
def initialize(data)
  @to_xml = data.to_s
  @role = data.at_css('SupplierRole').try(:text)
  @identifiers = data.css('SupplierIdentifier').map { |identifier_data| SupplierIdentifier.new(identifier_data) }
  @name = data.at_css('SupplierName').try(:text)
  @telephone_number = data.at_css('TelephoneNumber').try(:text)
  @email_address = data.at_css('EmailAddress').try(:text)
  if data.at_css('Website')
    @website = data.at_css('Website').at_css('WebsiteLink').try(:text) 
  end
end

Public Instance Methods

nip() click to toggle source
# File lib/elibri_onix/onix_3_0/supplier.rb, line 37
def nip
  @identifiers.find {|identifier| (identifier.type == '02') && (identifier.type_name == 'NIP')}.try(:value)
end