Class: AdfBuilder::Vendor
- Inherits:
-
Object
- Object
- AdfBuilder::Vendor
- Defined in:
- lib/adf_builder/vendor/vendor.rb
Instance Method Summary collapse
- #add(name, contact_name, opts = {}) ⇒ Object
- #add_id(index, value, source = nil, sequence = 1) ⇒ Object
- #add_url(url) ⇒ Object
- #contact ⇒ Object
-
#initialize(prospect) ⇒ Vendor
constructor
A new instance of Vendor.
Constructor Details
#initialize(prospect) ⇒ Vendor
Returns a new instance of Vendor.
3 4 5 6 7 |
# File 'lib/adf_builder/vendor/vendor.rb', line 3 def initialize(prospect) @vendor = Ox::Element.new('vendor') @contact = nil prospect << @vendor end |
Instance Method Details
#add(name, contact_name, opts = {}) ⇒ Object
13 14 15 16 |
# File 'lib/adf_builder/vendor/vendor.rb', line 13 def add(name, contact_name, opts={}) @vendor << (Ox::Element.new('vendorname') << name) @contact = Contact.new(@vendor, contact_name, opts) end |
#add_id(index, value, source = nil, sequence = 1) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/adf_builder/vendor/vendor.rb', line 25 def add_id(index, value, source=nil, sequence=1) if @prospect.locate("vendor").empty? false else Id.new.add(@prospect.vendor(index), value, source, sequence) end end |
#add_url(url) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/adf_builder/vendor/vendor.rb', line 18 def add_url(url) if @vendor.locate("url").size > 0 @vendor.remove_children(@vendor.url) end @vendor << (Ox::Element.new('url') << url) end |
#contact ⇒ Object
9 10 11 |
# File 'lib/adf_builder/vendor/vendor.rb', line 9 def contact @contact end |