Class: VisaAcceptanceMergedSpec::ElectronicBenefitsTransfer

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/electronic_benefits_transfer.rb

Overview

ElectronicBenefitsTransfer Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(category: SKIP, voucher_serial_number: SKIP, additional_properties: nil) ⇒ ElectronicBenefitsTransfer

Returns a new instance of ElectronicBenefitsTransfer.



53
54
55
56
57
58
59
60
61
# File 'lib/visa_acceptance_merged_spec/models/electronic_benefits_transfer.rb', line 53

def initialize(category: SKIP, voucher_serial_number: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @category = category unless category == SKIP
  @voucher_serial_number = voucher_serial_number unless voucher_serial_number == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#categoryString

Flag that specifies the category for the EBT transaction. Possible values:

  • CASH: Cash benefits, which can be used to purchase any item at a participating retailer, as well as to obtain cash-back or make a cash withdrawal from a participating ATM.
  • FOOD: Food stamp benefits, which can be used only to purchase food items authorized by the USDA SNAP program.

PIN debit

Required field for EBT transactions that use PIN debit credit or PIN debit purchase; otherwise, not used.

Returns:

  • (String)


23
24
25
# File 'lib/visa_acceptance_merged_spec/models/electronic_benefits_transfer.rb', line 23

def category
  @category
end

#voucher_serial_numberString

The serial number printed on the EBT voucher.

PIN debit

Required field for EBT voucher transactions that use PIN debit purchase; otherwise, not used.

Returns:

  • (String)


30
31
32
# File 'lib/visa_acceptance_merged_spec/models/electronic_benefits_transfer.rb', line 30

def voucher_serial_number
  @voucher_serial_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/visa_acceptance_merged_spec/models/electronic_benefits_transfer.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  category = hash.key?('category') ? hash['category'] : SKIP
  voucher_serial_number =
    hash.key?('voucherSerialNumber') ? hash['voucherSerialNumber'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  ElectronicBenefitsTransfer.new(category: category,
                                 voucher_serial_number: voucher_serial_number,
                                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
# File 'lib/visa_acceptance_merged_spec/models/electronic_benefits_transfer.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['category'] = 'category'
  @_hash['voucher_serial_number'] = 'voucherSerialNumber'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/visa_acceptance_merged_spec/models/electronic_benefits_transfer.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



41
42
43
44
45
46
# File 'lib/visa_acceptance_merged_spec/models/electronic_benefits_transfer.rb', line 41

def self.optionals
  %w[
    category
    voucher_serial_number
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



93
94
95
96
97
# File 'lib/visa_acceptance_merged_spec/models/electronic_benefits_transfer.rb', line 93

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} category: #{@category.inspect}, voucher_serial_number:"\
  " #{@voucher_serial_number.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



86
87
88
89
90
# File 'lib/visa_acceptance_merged_spec/models/electronic_benefits_transfer.rb', line 86

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} category: #{@category}, voucher_serial_number: #{@voucher_serial_number},"\
  " additional_properties: #{@additional_properties}>"
end