Class: VisaAcceptanceMergedSpec::CustomerAccount

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

Overview

CustomerAccount 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(last_change_date: SKIP, creation_history: SKIP, modification_history: SKIP, password_history: SKIP, create_date: SKIP, password_change_date: SKIP, additional_properties: nil) ⇒ CustomerAccount

Returns a new instance of CustomerAccount.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/visa_acceptance_merged_spec/models/customer_account.rb', line 82

def initialize(last_change_date: SKIP, creation_history: SKIP,
               modification_history: SKIP, password_history: SKIP,
               create_date: SKIP, password_change_date: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @last_change_date = last_change_date unless last_change_date == SKIP
  @creation_history = creation_history unless creation_history == SKIP
  @modification_history = modification_history unless modification_history == SKIP
  @password_history = password_history unless password_history == SKIP
  @create_date = create_date unless create_date == SKIP
  @password_change_date = password_change_date unless password_change_date == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#create_dateString

Date the cardholder opened the account. Recommended for Discover ProtectBuy. This only applies for EXISTING_ACCOUNT in creationHistory.

Returns:

  • (String)


45
46
47
# File 'lib/visa_acceptance_merged_spec/models/customer_account.rb', line 45

def create_date
  @create_date
end

#creation_historyString

The values from the enum can be:

  • GUEST
  • NEW_ACCOUNT
  • EXISTING_ACCOUNT

Returns:

  • (String)


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

def creation_history
  @creation_history
end

#last_change_dateString

Date the cardholder’s account was last changed. This includes changes to the billing or shipping address, new payment accounts or new users added. Recommended for Discover ProtectBuy.

Returns:

  • (String)


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

def last_change_date
  @last_change_date
end

#modification_historyString

This field is applicable only in case of EXISTING_ACCOUNT in creationHistory. Possible values:

  • ACCOUNT_UPDATED_NOW
  • ACCOUNT_UPDATED_PAST

Returns:

  • (String)


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

def modification_history
  @modification_history
end

#password_change_dateString

Date the cardholder last changed or reset password on account. Recommended for Discover ProtectBuy. This only applies for PASSWORD_CHANGED_PAST in passwordHistory.

Returns:

  • (String)


51
52
53
# File 'lib/visa_acceptance_merged_spec/models/customer_account.rb', line 51

def password_change_date
  @password_change_date
end

#password_historyString

This only applies for EXISTING_ACCOUNT in creationHistory. The values from the enum can be:

  • PASSWORD_CHANGED_NOW
  • PASSWORD_CHANGED_PAST
  • PASSWORD_NEVER_CHANGED

Returns:

  • (String)


39
40
41
# File 'lib/visa_acceptance_merged_spec/models/customer_account.rb', line 39

def password_history
  @password_history
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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/customer_account.rb', line 99

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  last_change_date =
    hash.key?('lastChangeDate') ? hash['lastChangeDate'] : SKIP
  creation_history =
    hash.key?('creationHistory') ? hash['creationHistory'] : SKIP
  modification_history =
    hash.key?('modificationHistory') ? hash['modificationHistory'] : SKIP
  password_history =
    hash.key?('passwordHistory') ? hash['passwordHistory'] : SKIP
  create_date = hash.key?('createDate') ? hash['createDate'] : SKIP
  password_change_date =
    hash.key?('passwordChangeDate') ? hash['passwordChangeDate'] : 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.
  CustomerAccount.new(last_change_date: last_change_date,
                      creation_history: creation_history,
                      modification_history: modification_history,
                      password_history: password_history,
                      create_date: create_date,
                      password_change_date: password_change_date,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['last_change_date'] = 'lastChangeDate'
  @_hash['creation_history'] = 'creationHistory'
  @_hash['modification_history'] = 'modificationHistory'
  @_hash['password_history'] = 'passwordHistory'
  @_hash['create_date'] = 'createDate'
  @_hash['password_change_date'] = 'passwordChangeDate'
  @_hash
end

.nullablesObject

An array for nullable fields



78
79
80
# File 'lib/visa_acceptance_merged_spec/models/customer_account.rb', line 78

def self.nullables
  []
end

.optionalsObject

An array for optional fields



66
67
68
69
70
71
72
73
74
75
# File 'lib/visa_acceptance_merged_spec/models/customer_account.rb', line 66

def self.optionals
  %w[
    last_change_date
    creation_history
    modification_history
    password_history
    create_date
    password_change_date
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



142
143
144
145
146
147
148
149
# File 'lib/visa_acceptance_merged_spec/models/customer_account.rb', line 142

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} last_change_date: #{@last_change_date.inspect}, creation_history:"\
  " #{@creation_history.inspect}, modification_history: #{@modification_history.inspect},"\
  " password_history: #{@password_history.inspect}, create_date: #{@create_date.inspect},"\
  " password_change_date: #{@password_change_date.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} last_change_date: #{@last_change_date}, creation_history:"\
  " #{@creation_history}, modification_history: #{@modification_history}, password_history:"\
  " #{@password_history}, create_date: #{@create_date}, password_change_date:"\
  " #{@password_change_date}, additional_properties: #{@additional_properties}>"
end