Class: Target::Voyager::Record
- Inherits:
-
Object
- Object
- Target::Voyager::Record
- Defined in:
- lib/nostos-target-voyager/record.rb
Instance Attribute Summary collapse
-
#due_date ⇒ Object
readonly
Returns the value of attribute due_date.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #charged?(force = false) ⇒ Boolean
-
#initialize(attributes = {}) ⇒ Record
constructor
A new instance of Record.
Constructor Details
#initialize(attributes = {}) ⇒ Record
Returns a new instance of Record.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/nostos-target-voyager/record.rb', line 4 def initialize(attributes = {}) @id = attributes[:id] @title = attributes[:title] @charged = attributes[:charged] begin @due_date = DateTime.strptime(attributes[:due_date], '%Y%m%d %H%M%S') rescue @due_date = attributes[:due_date] end end |
Instance Attribute Details
#due_date ⇒ Object
Returns the value of attribute due_date.
15 16 17 |
# File 'lib/nostos-target-voyager/record.rb', line 15 def due_date @due_date end |
#id ⇒ Object
Returns the value of attribute id.
15 16 17 |
# File 'lib/nostos-target-voyager/record.rb', line 15 def id @id end |
#title ⇒ Object
Returns the value of attribute title.
15 16 17 |
# File 'lib/nostos-target-voyager/record.rb', line 15 def title @title end |
Instance Method Details
#charged?(force = false) ⇒ Boolean
17 18 19 20 21 22 23 24 25 |
# File 'lib/nostos-target-voyager/record.rb', line 17 def charged?(force = false) if force then r = Target::Voyager.find(@id) @charged = r.charged @due_date = r.due_date end @charged end |