Class: AdfBuilder::Timeframe
- Inherits:
-
Object
- Object
- AdfBuilder::Timeframe
- Defined in:
- lib/adf_builder/customer/timeframe.rb
Instance Method Summary collapse
-
#initialize(customer, description, earliest_date, latest_date) ⇒ Timeframe
constructor
A new instance of Timeframe.
- #update_description(description) ⇒ Object
- #update_earliest_date(date) ⇒ Object
- #update_latest_date(date) ⇒ Object
Constructor Details
#initialize(customer, description, earliest_date, latest_date) ⇒ Timeframe
Returns a new instance of Timeframe.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/adf_builder/customer/timeframe.rb', line 3 def initialize(customer, description, earliest_date, latest_date) begin earliest_date = earliest_date.strftime('%FT%T%:z') if earliest_date latest_date = latest_date.strftime('%FT%T%:z') if latest_date rescue => e return nil end @timeframe = Ox::Element.new('timeframe') @timeframe << (Ox::Element.new('description') << description) @timeframe << (Ox::Element.new('earliestdate') << earliest_date) if earliest_date @timeframe << (Ox::Element.new('latestdate') << latest_date) if latest_date customer << @timeframe end |
Instance Method Details
#update_description(description) ⇒ Object
21 22 23 |
# File 'lib/adf_builder/customer/timeframe.rb', line 21 def update_description(description) AdfBuilder::Builder.update_node(@timeframe, :description, description) end |
#update_earliest_date(date) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/adf_builder/customer/timeframe.rb', line 25 def update_earliest_date(date) begin date = date.strftime('%FT%T%:z') rescue return false end AdfBuilder::Builder.update_node(@timeframe, :earliestdate, date) end |
#update_latest_date(date) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/adf_builder/customer/timeframe.rb', line 34 def update_latest_date(date) begin date = date.strftime('%FT%T%:z') rescue return false end AdfBuilder::Builder.update_node(@timeframe, :latestdate, date) end |