Class: AdfBuilder::Customer
- Inherits:
-
Object
- Object
- AdfBuilder::Customer
- Defined in:
- lib/adf_builder/customer/customer.rb
Instance Method Summary collapse
- #add(name, opts = {}) ⇒ Object
- #add_id(index, value, source = nil, sequence = 1) ⇒ Object
-
#add_timeframe(description, earliest_date = nil, latest_date = nil) ⇒ Object
is present, it is required to specify earliestdate and/or latestdate is present, it is required to specify earliestdate and/or latestdate.
- #contact ⇒ Object
-
#initialize(prospect) ⇒ Customer
constructor
A new instance of Customer.
- #timeframe ⇒ Object
- #update_comments(comments) ⇒ Object
Constructor Details
#initialize(prospect) ⇒ Customer
Returns a new instance of Customer.
3 4 5 6 7 8 9 |
# File 'lib/adf_builder/customer/customer.rb', line 3 def initialize(prospect) @customer = Ox::Element.new('customer') @contact = nil @timeframe = nil prospect << @customer end |
Instance Method Details
#add(name, opts = {}) ⇒ Object
18 19 20 |
# File 'lib/adf_builder/customer/customer.rb', line 18 def add(name, opts={}) @contact = Contact.new(@customer, name, opts) end |
#add_id(index, value, source = nil, sequence = 1) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/adf_builder/customer/customer.rb', line 22 def add_id(index, value, source=nil, sequence=1) if @prospect.locate("customer").empty? false else Id.new.add(@prospect.customer(index), value, source, sequence) end end |
#add_timeframe(description, earliest_date = nil, latest_date = nil) ⇒ Object
is present, it is required to specify earliestdate and/or latestdate is present, it is required to specify earliestdate and/or latestdate
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/adf_builder/customer/customer.rb', line 37 def add_timeframe(description, earliest_date=nil, latest_date=nil) if earliest_date.nil? and latest_date.nil? return false end if earliest_date and earliest_date.class != DateTime return false end if latest_date and latest_date.class != DateTime return false end @timeframe = Timeframe.new(@customer, description, earliest_date, latest_date) if @timeframe.nil? end |
#contact ⇒ Object
11 12 13 |
# File 'lib/adf_builder/customer/customer.rb', line 11 def contact @contact end |
#timeframe ⇒ Object
15 16 17 |
# File 'lib/adf_builder/customer/customer.rb', line 15 def timeframe @timeframe end |
#update_comments(comments) ⇒ Object
53 54 55 56 |
# File 'lib/adf_builder/customer/customer.rb', line 53 def update_comments(comments) return false if comments.class != String AdfBuilder::Builder.update_node(@customer, :comments, comments) end |