Class: CyberSourceMergedSpec::TravelInformation9
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::TravelInformation9
- Defined in:
- lib/cyber_source_merged_spec/models/travel_information9.rb
Overview
TravelInformation9 Model.
Instance Attribute Summary collapse
-
#actual_final_destination ⇒ String
IATA Code for the actual final destination that the customer intends to travel to.
-
#complete_route ⇒ String
Concatenation of individual travel legs in the format ORIG1-DEST1, for example, SFO-JFK:JFK-LHR:LHR-CDG.
-
#departure_time ⇒ String
Departure date and time of the first leg of the trip.
-
#journey_type ⇒ String
Type of travel, for example one way or round trip.
-
#legs ⇒ Array[Leg5]
Type of travel, for example one way or round trip.
-
#number_of_passengers ⇒ Integer
Number of passengers for whom the ticket was issued.
-
#passengers ⇒ Array[Passenger3]
Number of passengers for whom the ticket was issued.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.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(actual_final_destination: SKIP, complete_route: SKIP, departure_time: SKIP, journey_type: SKIP, legs: SKIP, number_of_passengers: SKIP, passengers: SKIP, additional_properties: nil) ⇒ TravelInformation9
constructor
A new instance of TravelInformation9.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ 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(actual_final_destination: SKIP, complete_route: SKIP, departure_time: SKIP, journey_type: SKIP, legs: SKIP, number_of_passengers: SKIP, passengers: SKIP, additional_properties: nil) ⇒ TravelInformation9
Returns a new instance of TravelInformation9.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 106 def initialize(actual_final_destination: SKIP, complete_route: SKIP, departure_time: SKIP, journey_type: SKIP, legs: SKIP, number_of_passengers: SKIP, passengers: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @actual_final_destination = actual_final_destination unless actual_final_destination == SKIP @complete_route = complete_route unless complete_route == SKIP @departure_time = departure_time unless departure_time == SKIP @journey_type = journey_type unless journey_type == SKIP @legs = legs unless legs == SKIP @number_of_passengers = number_of_passengers unless number_of_passengers == SKIP @passengers = passengers unless passengers == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#actual_final_destination ⇒ String
IATA Code for the actual final destination that the customer intends to travel to. It should be a destination on the completeRoute.
16 17 18 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 16 def actual_final_destination @actual_final_destination end |
#complete_route ⇒ String
Concatenation of individual travel legs in the format ORIG1-DEST1, for example, SFO-JFK:JFK-LHR:LHR-CDG. For airport codes, see the IATA Airline and Airport Code Search. Note In your request, send either the complete route or the individual legs (_leg#_orig and _leg#_dest). If you send all the fields, the value of _complete_route takes precedence over that of the _leg# fields.
27 28 29 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 27 def complete_route @complete_route end |
#departure_time ⇒ String
Departure date and time of the first leg of the trip. Use one of the following formats:
- yyyy-MM-dd HH:mm z
- yyyy-MM-dd hh:mm a z
- yyyy-MM-dd hh:mma z
HH = hour in 24-hour format
hh = hour in 12-hour format
a = am or pm (case insensitive)
z = time zone of the departing flight, for example: If the
airline is based in city A, but the flight departs from city
B, z is the time zone of city B at the time of departure.
Important For travel information, use GMT instead of UTC, or use the local time zone. Examples 2011-03-20 11:30 PM PDT 2011-03-20 11:30pm GMT 2011-03-20 11:30pm GMT-05:00 Eastern Standard Time: GMT-05:00 or EST Note When specifying an offset from GMT, the format must be exactly as specified in the example. Insert no spaces between the time zone and the offset.
51 52 53 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 51 def departure_time @departure_time end |
#journey_type ⇒ String
Type of travel, for example one way or round trip.
55 56 57 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 55 def journey_type @journey_type end |
#legs ⇒ Array[Leg5]
Type of travel, for example one way or round trip.
59 60 61 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 59 def legs @legs end |
#number_of_passengers ⇒ Integer
Number of passengers for whom the ticket was issued. If you do not include this field in your request, CyberSource uses a default value of 1. Required for American Express SafeKey (U.S.) for travel-related requests.
66 67 68 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 66 def number_of_passengers @number_of_passengers end |
#passengers ⇒ Array[Passenger3]
Number of passengers for whom the ticket was issued. If you do not include this field in your request, CyberSource uses a default value of 1. Required for American Express SafeKey (U.S.) for travel-related requests.
73 74 75 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 73 def passengers @passengers end |
Class Method Details
.from_element(root) ⇒ Object
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 174 def self.from_element(root) actual_final_destination = XmlUtilities.from_element( root, 'actualFinalDestination', String ) complete_route = XmlUtilities.from_element(root, 'completeRoute', String) departure_time = XmlUtilities.from_element(root, 'departureTime', String) journey_type = XmlUtilities.from_element(root, 'journeyType', String) legs = XmlUtilities.from_element_to_array(root, 'Leg5', Leg5) number_of_passengers = XmlUtilities.from_element(root, 'numberOfPassengers', Integer) passengers = XmlUtilities.from_element_to_array(root, 'Passenger3', Passenger3) new(actual_final_destination: actual_final_destination, complete_route: complete_route, departure_time: departure_time, journey_type: journey_type, legs: legs, number_of_passengers: number_of_passengers, passengers: passengers, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 124 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. actual_final_destination = hash.key?('actualFinalDestination') ? hash['actualFinalDestination'] : SKIP complete_route = hash.key?('completeRoute') ? hash['completeRoute'] : SKIP departure_time = hash.key?('departureTime') ? hash['departureTime'] : SKIP journey_type = hash.key?('journeyType') ? hash['journeyType'] : SKIP # Parameter is an array, so we need to iterate through it legs = nil unless hash['legs'].nil? legs = [] hash['legs'].each do |structure| legs << (Leg5.from_hash(structure) if structure) end end legs = SKIP unless hash.key?('legs') number_of_passengers = hash.key?('numberOfPassengers') ? hash['numberOfPassengers'] : SKIP # Parameter is an array, so we need to iterate through it passengers = nil unless hash['passengers'].nil? passengers = [] hash['passengers'].each do |structure| passengers << (Passenger3.from_hash(structure) if structure) end end passengers = SKIP unless hash.key?('passengers') # 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. TravelInformation9.new(actual_final_destination: actual_final_destination, complete_route: complete_route, departure_time: departure_time, journey_type: journey_type, legs: legs, number_of_passengers: number_of_passengers, passengers: passengers, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 76 def self.names @_hash = {} if @_hash.nil? @_hash['actual_final_destination'] = 'actualFinalDestination' @_hash['complete_route'] = 'completeRoute' @_hash['departure_time'] = 'departureTime' @_hash['journey_type'] = 'journeyType' @_hash['legs'] = 'legs' @_hash['number_of_passengers'] = 'numberOfPassengers' @_hash['passengers'] = 'passengers' @_hash end |
.nullables ⇒ Object
An array for nullable fields
102 103 104 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 102 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 89 def self.optionals %w[ actual_final_destination complete_route departure_time journey_type legs number_of_passengers passengers ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
226 227 228 229 230 231 232 233 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 226 def inspect class_name = self.class.name.split('::').last "<#{class_name} actual_final_destination: #{@actual_final_destination.inspect},"\ " complete_route: #{@complete_route.inspect}, departure_time: #{@departure_time.inspect},"\ " journey_type: #{@journey_type.inspect}, legs: #{@legs.inspect}, number_of_passengers:"\ " #{@number_of_passengers.inspect}, passengers: #{@passengers.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
217 218 219 220 221 222 223 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 217 def to_s class_name = self.class.name.split('::').last "<#{class_name} actual_final_destination: #{@actual_final_destination}, complete_route:"\ " #{@complete_route}, departure_time: #{@departure_time}, journey_type: #{@journey_type},"\ " legs: #{@legs}, number_of_passengers: #{@number_of_passengers}, passengers:"\ " #{@passengers}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/cyber_source_merged_spec/models/travel_information9.rb', line 198 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'actualFinalDestination', actual_final_destination) XmlUtilities.add_as_subelement(doc, root, 'completeRoute', complete_route) XmlUtilities.add_as_subelement(doc, root, 'departureTime', departure_time) XmlUtilities.add_as_subelement(doc, root, 'journeyType', journey_type) XmlUtilities.add_array_as_subelement(doc, root, 'Leg5', legs) XmlUtilities.add_as_subelement(doc, root, 'numberOfPassengers', number_of_passengers) XmlUtilities.add_array_as_subelement(doc, root, 'Passenger3', passengers) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |