Class: VisaAcceptanceMergedSpec::AccountHistory
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- VisaAcceptanceMergedSpec::AccountHistory
- Defined in:
- lib/visa_acceptance_merged_spec/models/account_history.rb
Overview
AccountHistory Model.
Instance Attribute Summary collapse
-
#first_use_of_shipping_address ⇒ TrueClass | FalseClass
Applicable when this is not a guest account.
-
#shipping_address_usage_date ⇒ String
Date when the shipping address for this transaction was first used.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(first_use_of_shipping_address: SKIP, shipping_address_usage_date: SKIP, additional_properties: nil) ⇒ AccountHistory
constructor
A new instance of AccountHistory.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(first_use_of_shipping_address: SKIP, shipping_address_usage_date: SKIP, additional_properties: nil) ⇒ AccountHistory
Returns a new instance of AccountHistory.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/visa_acceptance_merged_spec/models/account_history.rb', line 44 def initialize(first_use_of_shipping_address: SKIP, shipping_address_usage_date: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? unless first_use_of_shipping_address == SKIP @first_use_of_shipping_address = first_use_of_shipping_address end unless shipping_address_usage_date == SKIP @shipping_address_usage_date = shipping_address_usage_date end @additional_properties = additional_properties end |
Instance Attribute Details
#first_use_of_shipping_address ⇒ TrueClass | FalseClass
Applicable when this is not a guest account.
14 15 16 |
# File 'lib/visa_acceptance_merged_spec/models/account_history.rb', line 14 def first_use_of_shipping_address @first_use_of_shipping_address end |
#shipping_address_usage_date ⇒ String
Date when the shipping address for this transaction was first used.
Recommended for Discover ProtectBuy.
If firstUseOfShippingAddress is false and not a guest account, then this
date is entered.
21 22 23 |
# File 'lib/visa_acceptance_merged_spec/models/account_history.rb', line 21 def shipping_address_usage_date @shipping_address_usage_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/visa_acceptance_merged_spec/models/account_history.rb', line 62 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. first_use_of_shipping_address = hash.key?('firstUseOfShippingAddress') ? hash['firstUseOfShippingAddress'] : SKIP shipping_address_usage_date = hash.key?('shippingAddressUsageDate') ? hash['shippingAddressUsageDate'] : 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. AccountHistory.new(first_use_of_shipping_address: first_use_of_shipping_address, shipping_address_usage_date: shipping_address_usage_date, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
24 25 26 27 28 29 |
# File 'lib/visa_acceptance_merged_spec/models/account_history.rb', line 24 def self.names @_hash = {} if @_hash.nil? @_hash['first_use_of_shipping_address'] = 'firstUseOfShippingAddress' @_hash['shipping_address_usage_date'] = 'shippingAddressUsageDate' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/visa_acceptance_merged_spec/models/account_history.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
32 33 34 35 36 37 |
# File 'lib/visa_acceptance_merged_spec/models/account_history.rb', line 32 def self.optionals %w[ first_use_of_shipping_address shipping_address_usage_date ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
93 94 95 96 97 98 |
# File 'lib/visa_acceptance_merged_spec/models/account_history.rb', line 93 def inspect class_name = self.class.name.split('::').last "<#{class_name} first_use_of_shipping_address: #{@first_use_of_shipping_address.inspect},"\ " shipping_address_usage_date: #{@shipping_address_usage_date.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
85 86 87 88 89 90 |
# File 'lib/visa_acceptance_merged_spec/models/account_history.rb', line 85 def to_s class_name = self.class.name.split('::').last "<#{class_name} first_use_of_shipping_address: #{@first_use_of_shipping_address},"\ " shipping_address_usage_date: #{@shipping_address_usage_date}, additional_properties:"\ " #{@additional_properties}>" end |