Class: Fnsapi::Ticket

Inherits:
Object
  • Object
show all
Defined in:
lib/fnsapi/ticket.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Ticket

Returns a new instance of Ticket.



9
10
11
12
13
14
15
16
17
# File 'lib/fnsapi/ticket.rb', line 9

def initialize(object)
  %i[fn fd pfd amount_cents].each do |field_name|
    instance_variable_set("@#{field_name}", validated_field_value(object, field_name))
  end

  @purchase_date = validated_field_value(object, :purchase_date)
  @purchase_date = DateTime.parse(@purchase_date) if @purchase_date.is_a?(String)
  true
end

Instance Attribute Details

#amount_centsObject (readonly)

Returns the value of attribute amount_cents.



7
8
9
# File 'lib/fnsapi/ticket.rb', line 7

def amount_cents
  @amount_cents
end

#fdObject (readonly)

Returns the value of attribute fd.



7
8
9
# File 'lib/fnsapi/ticket.rb', line 7

def fd
  @fd
end

#fnObject (readonly)

Returns the value of attribute fn.



7
8
9
# File 'lib/fnsapi/ticket.rb', line 7

def fn
  @fn
end

#pfdObject (readonly)

Returns the value of attribute pfd.



7
8
9
# File 'lib/fnsapi/ticket.rb', line 7

def pfd
  @pfd
end

#purchase_dateObject (readonly)

Returns the value of attribute purchase_date.



7
8
9
# File 'lib/fnsapi/ticket.rb', line 7

def purchase_date
  @purchase_date
end