Class: Easybill::Document
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Easybill::Document
- Defined in:
- lib/easybill/document.rb
Defined Under Namespace
Classes: ParseError
Instance Method Summary collapse
Instance Method Details
#cancellation? ⇒ Boolean
26 27 28 |
# File 'lib/easybill/document.rb', line 26 def cancellation? document_type == 'STORNO' end |
#service_period ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/easybill/document.rb', line 8 def service_period parsed = parse_service_date return '' if parsed.nil? if parsed.key?('serviceDateFrom') "#{parse_date(parsed['serviceDateFrom'])} - #{parse_date(parsed['serviceDateThru'])}" else parsed['serviceDateString'] end rescue TypeError => e raise ParseError, e end |
#service_period_end ⇒ Object
21 22 23 24 |
# File 'lib/easybill/document.rb', line 21 def service_period_end service_period_dates = service_period.split(' - ') service_period_dates.length == 2 ? Date.parse(service_period_dates[1]) : nil end |