Class: VisaAcceptanceMergedSpec::BuyerInformation7

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

Overview

BuyerInformation7 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(date_of_birth: SKIP, gender: SKIP, language: SKIP, additional_properties: nil) ⇒ BuyerInformation7

Returns a new instance of BuyerInformation7.



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

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

  @date_of_birth = date_of_birth unless date_of_birth == SKIP
  @gender = gender unless gender == SKIP
  @language = language unless language == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#date_of_birthString

Recipient’s date of birth. Format: YYYYMMDD. This field is a pass-through, which means that Visa Acceptance ensures that the value is eight numeric characters but otherwise does not verify the value or modify it in any way before sending it to the processor. If the field is not required for the transaction, Visa Acceptance does not forward it to the processor.

Returns:

  • (String)


20
21
22
# File 'lib/visa_acceptance_merged_spec/models/buyer_information7.rb', line 20

def date_of_birth
  @date_of_birth
end

#genderString

Customer's gender. Possible values are F (female), M (male), O (other).

Returns:

  • (String)


24
25
26
# File 'lib/visa_acceptance_merged_spec/models/buyer_information7.rb', line 24

def gender
  @gender
end

#languageString

language setting of the user

Returns:

  • (String)


28
29
30
# File 'lib/visa_acceptance_merged_spec/models/buyer_information7.rb', line 28

def language
  @language
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  date_of_birth = hash.key?('dateOfBirth') ? hash['dateOfBirth'] : SKIP
  gender = hash.key?('gender') ? hash['gender'] : SKIP
  language = hash.key?('language') ? hash['language'] : 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.
  BuyerInformation7.new(date_of_birth: date_of_birth,
                        gender: gender,
                        language: language,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
# File 'lib/visa_acceptance_merged_spec/models/buyer_information7.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['date_of_birth'] = 'dateOfBirth'
  @_hash['gender'] = 'gender'
  @_hash['language'] = 'language'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    date_of_birth
    gender
    language
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



95
96
97
98
99
# File 'lib/visa_acceptance_merged_spec/models/buyer_information7.rb', line 95

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

#to_sObject

Provides a human-readable string representation of the object.



88
89
90
91
92
# File 'lib/visa_acceptance_merged_spec/models/buyer_information7.rb', line 88

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