Class: VisaAcceptanceMergedSpec::RewardPointsDetails

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

Overview

RewardPointsDetails 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(points_before_redemption: SKIP, points_value_before_redemption: SKIP, points_redeemed: SKIP, points_value_redeemed: SKIP, points_after_redemption: SKIP, points_value_after_redemption: SKIP, additional_properties: nil) ⇒ RewardPointsDetails

Returns a new instance of RewardPointsDetails.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/visa_acceptance_merged_spec/models/reward_points_details.rb', line 74

def initialize(points_before_redemption: SKIP,
               points_value_before_redemption: SKIP, points_redeemed: SKIP,
               points_value_redeemed: SKIP, points_after_redemption: SKIP,
               points_value_after_redemption: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @points_before_redemption = points_before_redemption unless points_before_redemption == SKIP
  unless points_value_before_redemption == SKIP
    @points_value_before_redemption =
      points_value_before_redemption
  end
  @points_redeemed = points_redeemed unless points_redeemed == SKIP
  @points_value_redeemed = points_value_redeemed unless points_value_redeemed == SKIP
  @points_after_redemption = points_after_redemption unless points_after_redemption == SKIP
  unless points_value_after_redemption == SKIP
    @points_value_after_redemption =
      points_value_after_redemption
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#points_after_redemptionString

Loyalty Points remaining total balance after redemption. For Example: Points, such as 20.00

Returns:

  • (String)


37
38
39
# File 'lib/visa_acceptance_merged_spec/models/reward_points_details.rb', line 37

def points_after_redemption
  @points_after_redemption
end

#points_before_redemptionString

Loyalty points total balance before redemption. For Example: Points, such as 100

Returns:

  • (String)


15
16
17
# File 'lib/visa_acceptance_merged_spec/models/reward_points_details.rb', line 15

def points_before_redemption
  @points_before_redemption
end

#points_redeemedString

Number of loyalty points that were redeemed. For Example: Points, such as 100

Returns:

  • (String)


26
27
28
# File 'lib/visa_acceptance_merged_spec/models/reward_points_details.rb', line 26

def points_redeemed
  @points_redeemed
end

#points_value_after_redemptionString

The value of the remaining loyalty points after redumption in the default currency. Max characters is 12 excluding the "." symbol For Example: Points, such as 20.00

Returns:

  • (String)


43
44
45
# File 'lib/visa_acceptance_merged_spec/models/reward_points_details.rb', line 43

def points_value_after_redemption
  @points_value_after_redemption
end

#points_value_before_redemptionString

The total value of loyalty points before redemption in the default currency. Max characters is 12 excluding the "." symbol For Example: Points, such as 20.00

Returns:

  • (String)


21
22
23
# File 'lib/visa_acceptance_merged_spec/models/reward_points_details.rb', line 21

def points_value_before_redemption
  @points_value_before_redemption
end

#points_value_redeemedString

The value of the loyalty points that were redeemed in the default currency. Max characters is 12 excluding the "." symbol For Example: Points, such as 100.00

Returns:

  • (String)


32
33
34
# File 'lib/visa_acceptance_merged_spec/models/reward_points_details.rb', line 32

def points_value_redeemed
  @points_value_redeemed
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/visa_acceptance_merged_spec/models/reward_points_details.rb', line 98

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  points_before_redemption =
    hash.key?('pointsBeforeRedemption') ? hash['pointsBeforeRedemption'] : SKIP
  points_value_before_redemption =
    hash.key?('pointsValueBeforeRedemption') ? hash['pointsValueBeforeRedemption'] : SKIP
  points_redeemed =
    hash.key?('pointsRedeemed') ? hash['pointsRedeemed'] : SKIP
  points_value_redeemed =
    hash.key?('pointsValueRedeemed') ? hash['pointsValueRedeemed'] : SKIP
  points_after_redemption =
    hash.key?('pointsAfterRedemption') ? hash['pointsAfterRedemption'] : SKIP
  points_value_after_redemption =
    hash.key?('pointsValueAfterRedemption') ? hash['pointsValueAfterRedemption'] : 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.
  RewardPointsDetails.new(points_before_redemption: points_before_redemption,
                          points_value_before_redemption: points_value_before_redemption,
                          points_redeemed: points_redeemed,
                          points_value_redeemed: points_value_redeemed,
                          points_after_redemption: points_after_redemption,
                          points_value_after_redemption: points_value_after_redemption,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
52
53
54
55
# File 'lib/visa_acceptance_merged_spec/models/reward_points_details.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['points_before_redemption'] = 'pointsBeforeRedemption'
  @_hash['points_value_before_redemption'] = 'pointsValueBeforeRedemption'
  @_hash['points_redeemed'] = 'pointsRedeemed'
  @_hash['points_value_redeemed'] = 'pointsValueRedeemed'
  @_hash['points_after_redemption'] = 'pointsAfterRedemption'
  @_hash['points_value_after_redemption'] = 'pointsValueAfterRedemption'
  @_hash
end

.nullablesObject

An array for nullable fields



70
71
72
# File 'lib/visa_acceptance_merged_spec/models/reward_points_details.rb', line 70

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    points_before_redemption
    points_value_before_redemption
    points_redeemed
    points_value_redeemed
    points_after_redemption
    points_value_after_redemption
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



143
144
145
146
147
148
149
150
151
152
# File 'lib/visa_acceptance_merged_spec/models/reward_points_details.rb', line 143

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} points_before_redemption: #{@points_before_redemption.inspect},"\
  " points_value_before_redemption: #{@points_value_before_redemption.inspect},"\
  " points_redeemed: #{@points_redeemed.inspect}, points_value_redeemed:"\
  " #{@points_value_redeemed.inspect}, points_after_redemption:"\
  " #{@points_after_redemption.inspect}, points_value_after_redemption:"\
  " #{@points_value_after_redemption.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



133
134
135
136
137
138
139
140
# File 'lib/visa_acceptance_merged_spec/models/reward_points_details.rb', line 133

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} points_before_redemption: #{@points_before_redemption},"\
  " points_value_before_redemption: #{@points_value_before_redemption}, points_redeemed:"\
  " #{@points_redeemed}, points_value_redeemed: #{@points_value_redeemed},"\
  " points_after_redemption: #{@points_after_redemption}, points_value_after_redemption:"\
  " #{@points_value_after_redemption}, additional_properties: #{@additional_properties}>"
end