Class: Target::Voyager::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/nostos-target-voyager/record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_dateObject

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

#idObject

Returns the value of attribute id.



15
16
17
# File 'lib/nostos-target-voyager/record.rb', line 15

def id
  @id
end

#titleObject

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

Returns:

  • (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