Class: VisaAcceptanceMergedSpec::Passenger
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- VisaAcceptanceMergedSpec::Passenger
- Defined in:
- lib/visa_acceptance_merged_spec/models/passenger.rb
Overview
Contains travel-related passenger details used by DM service only.
Instance Attribute Summary collapse
-
#email ⇒ String
Passenger's email address, including the full domain name, such as [email protected].
-
#first_name ⇒ String
Passenger's first name.
-
#id ⇒ String
ID of the passenger to whom the ticket was issued.
-
#last_name ⇒ String
Passenger's last name.
-
#nationality ⇒ String
Passenger's nationality country.
-
#phone ⇒ String
Passenger's phone number.
-
#status ⇒ String
Your company's passenger classification, such as with a frequent flyer program.
-
#type ⇒ String
Passenger classification associated with the price of the ticket.
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(type: SKIP, status: SKIP, phone: SKIP, first_name: SKIP, last_name: SKIP, id: SKIP, email: SKIP, nationality: SKIP, additional_properties: nil) ⇒ Passenger
constructor
A new instance of Passenger.
-
#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(type: SKIP, status: SKIP, phone: SKIP, first_name: SKIP, last_name: SKIP, id: SKIP, email: SKIP, nationality: SKIP, additional_properties: nil) ⇒ Passenger
Returns a new instance of Passenger.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 93 def initialize(type: SKIP, status: SKIP, phone: SKIP, first_name: SKIP, last_name: SKIP, id: SKIP, email: SKIP, nationality: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @type = type unless type == SKIP @status = status unless status == SKIP @phone = phone unless phone == SKIP @first_name = first_name unless first_name == SKIP @last_name = last_name unless last_name == SKIP @id = id unless id == SKIP @email = email unless email == SKIP @nationality = nationality unless nationality == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#email ⇒ String
Passenger's email address, including the full domain name, such as [email protected].
53 54 55 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 53 def email @email end |
#first_name ⇒ String
Passenger's first name.
38 39 40 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 38 def first_name @first_name end |
#id ⇒ String
ID of the passenger to whom the ticket was issued. For example, you can use this field for the frequent flyer number.
48 49 50 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 48 def id @id end |
#last_name ⇒ String
Passenger's last name.
42 43 44 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 42 def last_name @last_name end |
#nationality ⇒ String
Passenger's nationality country. Use the two character [ISO Standard Country Codes](
58 59 60 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 58 def nationality @nationality end |
#phone ⇒ String
Passenger's phone number. If the order is from outside the U.S., Visa Acceptance recommends that you include the [ISO Standard Country Codes](
34 35 36 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 34 def phone @phone end |
#status ⇒ String
Your company's passenger classification, such as with a frequent flyer
program. In this case, you might use
values such as standard, gold, or platinum.
28 29 30 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 28 def status @status end |
#type ⇒ String
Passenger classification associated with the price of the ticket. You can use one of the following values:
ADT: AdultCNN: ChildINF: InfantYTH: YouthSTU: StudentSCR: Senior CitizenMIL: Military
22 23 24 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 22 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 111 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. type = hash.key?('type') ? hash['type'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP phone = hash.key?('phone') ? hash['phone'] : SKIP first_name = hash.key?('firstName') ? hash['firstName'] : SKIP last_name = hash.key?('lastName') ? hash['lastName'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP email = hash.key?('email') ? hash['email'] : SKIP nationality = hash.key?('nationality') ? hash['nationality'] : 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. Passenger.new(type: type, status: status, phone: phone, first_name: first_name, last_name: last_name, id: id, email: email, nationality: nationality, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 61 def self.names @_hash = {} if @_hash.nil? @_hash['type'] = 'type' @_hash['status'] = 'status' @_hash['phone'] = 'phone' @_hash['first_name'] = 'firstName' @_hash['last_name'] = 'lastName' @_hash['id'] = 'id' @_hash['email'] = 'email' @_hash['nationality'] = 'nationality' @_hash end |
.nullables ⇒ Object
An array for nullable fields
89 90 91 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 89 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 75 def self.optionals %w[ type status phone first_name last_name id email nationality ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
152 153 154 155 156 157 158 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 152 def inspect class_name = self.class.name.split('::').last "<#{class_name} type: #{@type.inspect}, status: #{@status.inspect}, phone:"\ " #{@phone.inspect}, first_name: #{@first_name.inspect}, last_name: #{@last_name.inspect},"\ " id: #{@id.inspect}, email: #{@email.inspect}, nationality: #{@nationality.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
144 145 146 147 148 149 |
# File 'lib/visa_acceptance_merged_spec/models/passenger.rb', line 144 def to_s class_name = self.class.name.split('::').last "<#{class_name} type: #{@type}, status: #{@status}, phone: #{@phone}, first_name:"\ " #{@first_name}, last_name: #{@last_name}, id: #{@id}, email: #{@email}, nationality:"\ " #{@nationality}, additional_properties: #{@additional_properties}>" end |