Class: VisaAcceptanceMergedSpec::PurchaseOptions1

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

Overview

PurchaseOptions1 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(eligibility_indicator: SKIP, type: SKIP, benefit_amount: SKIP, benefit_type: SKIP, additional_properties: nil) ⇒ PurchaseOptions1

Returns a new instance of PurchaseOptions1.



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/visa_acceptance_merged_spec/models/purchase_options1.rb', line 73

def initialize(eligibility_indicator: SKIP, type: SKIP,
               benefit_amount: SKIP, benefit_type: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @eligibility_indicator = eligibility_indicator unless eligibility_indicator == SKIP
  @type = type unless type == SKIP
  @benefit_amount = benefit_amount unless benefit_amount == SKIP
  @benefit_type = benefit_type unless benefit_type == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#benefit_amountString

Workplace benefit amount.

Returns:

  • (String)


31
32
33
# File 'lib/visa_acceptance_merged_spec/models/purchase_options1.rb', line 31

def benefit_amount
  @benefit_amount
end

#benefit_typeString

Workplace benefit type. Possible values:

  • 70 = employee benefit
  • 4T = transportation / transit
  • 52 = general benefit
  • 53 = meal voucher
  • 54 = fuel
  • 55 = ecological / sustainability
  • 58 = philanthropy / patronage / consumption
  • 59 = gift
  • 5S = sport / culture
  • 5T = book / education

Returns:

  • (String)


46
47
48
# File 'lib/visa_acceptance_merged_spec/models/purchase_options1.rb', line 46

def benefit_type
  @benefit_type
end

#eligibility_indicatorString

This field contains installment data defined by MasterCard. Possible values:

- Y = eligible
- N = not eligile

Returns:

  • (String)


17
18
19
# File 'lib/visa_acceptance_merged_spec/models/purchase_options1.rb', line 17

def eligibility_indicator
  @eligibility_indicator
end

#typeString

Data mapped received in response from MasterCard. Possible values:

  • 01 = Meal Voucher - Employee Nutrition Program
  • 02 = Food Voucher - Employee Nutrition Program
  • 03 = Culture Voucher - Worker's Culture Program
  • 04 = Meal Voucher - Consolidation of Labor Laws
  • 05 = Food Voucher - Consolidation of Labor Laws

Returns:

  • (String)


27
28
29
# File 'lib/visa_acceptance_merged_spec/models/purchase_options1.rb', line 27

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/visa_acceptance_merged_spec/models/purchase_options1.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  eligibility_indicator =
    hash.key?('eligibilityIndicator') ? hash['eligibilityIndicator'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  benefit_amount = hash.key?('benefitAmount') ? hash['benefitAmount'] : SKIP
  benefit_type = hash.key?('benefitType') ? hash['benefitType'] : 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.
  PurchaseOptions1.new(eligibility_indicator: eligibility_indicator,
                       type: type,
                       benefit_amount: benefit_amount,
                       benefit_type: benefit_type,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
# File 'lib/visa_acceptance_merged_spec/models/purchase_options1.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['eligibility_indicator'] = 'eligibilityIndicator'
  @_hash['type'] = 'type'
  @_hash['benefit_amount'] = 'benefitAmount'
  @_hash['benefit_type'] = 'benefitType'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/visa_acceptance_merged_spec/models/purchase_options1.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
# File 'lib/visa_acceptance_merged_spec/models/purchase_options1.rb', line 59

def self.optionals
  %w[
    eligibility_indicator
    type
    benefit_amount
    benefit_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



121
122
123
124
125
126
# File 'lib/visa_acceptance_merged_spec/models/purchase_options1.rb', line 121

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

#to_sObject

Provides a human-readable string representation of the object.



113
114
115
116
117
118
# File 'lib/visa_acceptance_merged_spec/models/purchase_options1.rb', line 113

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