Class: VisaAcceptanceMergedSpec::AutoRental5

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

Overview

AutoRental5 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(company_name: SKIP, affiliate_name: SKIP, rental_address: SKIP, return_address: SKIP, return_date_time: SKIP, rental_date_time: SKIP, customer_name: SKIP, additional_properties: nil) ⇒ AutoRental5

Returns a new instance of AutoRental5.



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

def initialize(company_name: SKIP, affiliate_name: SKIP,
               rental_address: SKIP, return_address: SKIP,
               return_date_time: SKIP, rental_date_time: SKIP,
               customer_name: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @company_name = company_name unless company_name == SKIP
  @affiliate_name = affiliate_name unless affiliate_name == SKIP
  @rental_address = rental_address unless rental_address == SKIP
  @return_address = return_address unless return_address == SKIP
  @return_date_time = return_date_time unless return_date_time == SKIP
  @rental_date_time = rental_date_time unless rental_date_time == SKIP
  @customer_name = customer_name unless customer_name == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#affiliate_nameString

When merchant wants to send the affiliate name.

Returns:

  • (String)


18
19
20
# File 'lib/visa_acceptance_merged_spec/models/auto_rental5.rb', line 18

def affiliate_name
  @affiliate_name
end

#company_nameString

Merchant to send their auto rental company name

Returns:

  • (String)


14
15
16
# File 'lib/visa_acceptance_merged_spec/models/auto_rental5.rb', line 14

def company_name
  @company_name
end

#customer_nameString

Name of the individual making the rental agreement. Valid data lengths by card:

Card Specific Validation VISA MasterCard Discover AMEX
Filed Length 40 40 29 26
Field Type AN ANS AN AN
M/O/C O M M M

Returns:

  • (String)


48
49
50
# File 'lib/visa_acceptance_merged_spec/models/auto_rental5.rb', line 48

def customer_name
  @customer_name
end

#rental_addressRentalAddress

When merchant wants to send the affiliate name.

Returns:



22
23
24
# File 'lib/visa_acceptance_merged_spec/models/auto_rental5.rb', line 22

def rental_address
  @rental_address
end

#rental_date_timeString

Date/time the auto was picked up from the rental agency. Format: yyyy-MM-dd HH-mm-ss z This field is supported for Visa, MasterCard, and American Express.

Returns:

  • (String)


38
39
40
# File 'lib/visa_acceptance_merged_spec/models/auto_rental5.rb', line 38

def rental_date_time
  @rental_date_time
end

#return_addressReturnAddress

When merchant wants to send the affiliate name.

Returns:



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

def return_address
  @return_address
end

#return_date_timeString

Date/time the auto was returned to the rental agency. Format: yyyy-MM-dd HH-mm-ss z This field is supported for Visa, MasterCard, and American Express.

Returns:

  • (String)


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

def return_date_time
  @return_date_time
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
# File 'lib/visa_acceptance_merged_spec/models/auto_rental5.rb', line 99

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  company_name = hash.key?('companyName') ? hash['companyName'] : SKIP
  affiliate_name = hash.key?('affiliateName') ? hash['affiliateName'] : SKIP
  rental_address = RentalAddress.from_hash(hash['rentalAddress']) if hash['rentalAddress']
  return_address = ReturnAddress.from_hash(hash['returnAddress']) if hash['returnAddress']
  return_date_time =
    hash.key?('returnDateTime') ? hash['returnDateTime'] : SKIP
  rental_date_time =
    hash.key?('rentalDateTime') ? hash['rentalDateTime'] : SKIP
  customer_name = hash.key?('customerName') ? hash['customerName'] : 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.
  AutoRental5.new(company_name: company_name,
                  affiliate_name: affiliate_name,
                  rental_address: rental_address,
                  return_address: return_address,
                  return_date_time: return_date_time,
                  rental_date_time: rental_date_time,
                  customer_name: customer_name,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['company_name'] = 'companyName'
  @_hash['affiliate_name'] = 'affiliateName'
  @_hash['rental_address'] = 'rentalAddress'
  @_hash['return_address'] = 'returnAddress'
  @_hash['return_date_time'] = 'returnDateTime'
  @_hash['rental_date_time'] = 'rentalDateTime'
  @_hash['customer_name'] = 'customerName'
  @_hash
end

.nullablesObject

An array for nullable fields



77
78
79
# File 'lib/visa_acceptance_merged_spec/models/auto_rental5.rb', line 77

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    company_name
    affiliate_name
    rental_address
    return_address
    return_date_time
    rental_date_time
    customer_name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} company_name: #{@company_name.inspect}, affiliate_name:"\
  " #{@affiliate_name.inspect}, rental_address: #{@rental_address.inspect}, return_address:"\
  " #{@return_address.inspect}, return_date_time: #{@return_date_time.inspect},"\
  " rental_date_time: #{@rental_date_time.inspect}, customer_name: #{@customer_name.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} company_name: #{@company_name}, affiliate_name: #{@affiliate_name},"\
  " rental_address: #{@rental_address}, return_address: #{@return_address}, return_date_time:"\
  " #{@return_date_time}, rental_date_time: #{@rental_date_time}, customer_name:"\
  " #{@customer_name}, additional_properties: #{@additional_properties}>"
end