Class: CyberSourceMergedSpec::TravelInformation

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/travel_information.rb

Overview

TravelInformation 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(duration: SKIP, agency: SKIP, auto_rental: SKIP, lodging: SKIP, transit: SKIP, vehicle_data: SKIP, additional_properties: nil) ⇒ TravelInformation

Returns a new instance of TravelInformation.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 95

def initialize(duration: SKIP, agency: SKIP, auto_rental: SKIP,
               lodging: SKIP, transit: SKIP, vehicle_data: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @duration = duration unless duration == SKIP
  @agency = agency unless agency == SKIP
  @auto_rental = auto_rental unless auto_rental == SKIP
  @lodging = lodging unless lodging == SKIP
  @transit = transit unless transit == SKIP
  @vehicle_data = vehicle_data unless vehicle_data == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#agencyAgency

Duration of the auto rental or lodging rental.

Auto rental

This field is supported for Visa, MasterCard, and American Express. Important If this field is not included when the processingInformation.industryDataType is auto rental, the transaction is declined.

Returns:



28
29
30
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 28

def agency
  @agency
end

#auto_rentalAutoRental

Duration of the auto rental or lodging rental.

Auto rental

This field is supported for Visa, MasterCard, and American Express. Important If this field is not included when the processingInformation.industryDataType is auto rental, the transaction is declined.

Returns:



37
38
39
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 37

def auto_rental
  @auto_rental
end

#durationString

Duration of the auto rental or lodging rental.

Auto rental

This field is supported for Visa, MasterCard, and American Express. Important If this field is not included when the processingInformation.industryDataType is auto rental, the transaction is declined.

Returns:

  • (String)


19
20
21
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 19

def duration
  @duration
end

#lodgingLodging

Duration of the auto rental or lodging rental.

Auto rental

This field is supported for Visa, MasterCard, and American Express. Important If this field is not included when the processingInformation.industryDataType is auto rental, the transaction is declined.

Returns:



46
47
48
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 46

def lodging
  @lodging
end

#transitTransit

Duration of the auto rental or lodging rental.

Auto rental

This field is supported for Visa, MasterCard, and American Express. Important If this field is not included when the processingInformation.industryDataType is auto rental, the transaction is declined.

Returns:



55
56
57
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 55

def transit
  @transit
end

#vehicle_dataVehicleData

Duration of the auto rental or lodging rental.

Auto rental

This field is supported for Visa, MasterCard, and American Express. Important If this field is not included when the processingInformation.industryDataType is auto rental, the transaction is declined.

Returns:



64
65
66
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 64

def vehicle_data
  @vehicle_data
end

Class Method Details

.from_element(root) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 139

def self.from_element(root)
  duration = XmlUtilities.from_element(root, 'duration', String)
  agency = XmlUtilities.from_element(root, 'Agency', Agency)
  auto_rental = XmlUtilities.from_element(root, 'AutoRental', AutoRental)
  lodging = XmlUtilities.from_element(root, 'Lodging', Lodging)
  transit = XmlUtilities.from_element(root, 'Transit', Transit)
  vehicle_data = XmlUtilities.from_element(root, 'VehicleData', VehicleData)

  new(duration: duration,
      agency: agency,
      auto_rental: auto_rental,
      lodging: lodging,
      transit: transit,
      vehicle_data: vehicle_data,
      additional_properties: additional_properties)
end

.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
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 111

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  duration = hash.key?('duration') ? hash['duration'] : SKIP
  agency = Agency.from_hash(hash['agency']) if hash['agency']
  auto_rental = AutoRental.from_hash(hash['autoRental']) if hash['autoRental']
  lodging = Lodging.from_hash(hash['lodging']) if hash['lodging']
  transit = Transit.from_hash(hash['transit']) if hash['transit']
  vehicle_data = VehicleData.from_hash(hash['vehicleData']) if hash['vehicleData']

  # 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.
  TravelInformation.new(duration: duration,
                        agency: agency,
                        auto_rental: auto_rental,
                        lodging: lodging,
                        transit: transit,
                        vehicle_data: vehicle_data,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



67
68
69
70
71
72
73
74
75
76
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 67

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['duration'] = 'duration'
  @_hash['agency'] = 'agency'
  @_hash['auto_rental'] = 'autoRental'
  @_hash['lodging'] = 'lodging'
  @_hash['transit'] = 'transit'
  @_hash['vehicle_data'] = 'vehicleData'
  @_hash
end

.nullablesObject

An array for nullable fields



91
92
93
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 91

def self.nullables
  []
end

.optionalsObject

An array for optional fields



79
80
81
82
83
84
85
86
87
88
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 79

def self.optionals
  %w[
    duration
    agency
    auto_rental
    lodging
    transit
    vehicle_data
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



180
181
182
183
184
185
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 180

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} duration: #{@duration.inspect}, agency: #{@agency.inspect}, auto_rental:"\
  " #{@auto_rental.inspect}, lodging: #{@lodging.inspect}, transit: #{@transit.inspect},"\
  " vehicle_data: #{@vehicle_data.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



172
173
174
175
176
177
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 172

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} duration: #{@duration}, agency: #{@agency}, auto_rental: #{@auto_rental},"\
  " lodging: #{@lodging}, transit: #{@transit}, vehicle_data: #{@vehicle_data},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/cyber_source_merged_spec/models/travel_information.rb', line 156

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'duration', duration)
  XmlUtilities.add_as_subelement(doc, root, 'Agency', agency)
  XmlUtilities.add_as_subelement(doc, root, 'AutoRental', auto_rental)
  XmlUtilities.add_as_subelement(doc, root, 'Lodging', lodging)
  XmlUtilities.add_as_subelement(doc, root, 'Transit', transit)
  XmlUtilities.add_as_subelement(doc, root, 'VehicleData', vehicle_data)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end