Class: CyberSourceMergedSpec::ReturnAddress
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::ReturnAddress
- Defined in:
- lib/cyber_source_merged_spec/models/return_address.rb
Overview
ReturnAddress Model.
Instance Attribute Summary collapse
-
#address1 ⇒ String
When merchant wants to send the rental address's street address.
-
#city ⇒ String
City where the auto was returned to the rental agency.
-
#country ⇒ String
Country where the auto was returned to the rental agency.
-
#location ⇒ String
This field contains the location where the taxi passenger was dropped off or where the auto rental vehicle was returned.
-
#location_id ⇒ String
Code, address, phone number, etc.
-
#postal_code ⇒ String
When merchant wants to send the return address's postal code.
-
#state ⇒ String
State in which the auto was returned to the rental agency.
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(city: SKIP, state: SKIP, country: SKIP, location_id: SKIP, address1: SKIP, postal_code: SKIP, location: SKIP, additional_properties: nil) ⇒ ReturnAddress
constructor
A new instance of ReturnAddress.
-
#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(city: SKIP, state: SKIP, country: SKIP, location_id: SKIP, address1: SKIP, postal_code: SKIP, location: SKIP, additional_properties: nil) ⇒ ReturnAddress
Returns a new instance of ReturnAddress.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 84 def initialize(city: SKIP, state: SKIP, country: SKIP, location_id: SKIP, address1: SKIP, postal_code: SKIP, location: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @city = city unless city == SKIP @state = state unless state == SKIP @country = country unless country == SKIP @location_id = location_id unless location_id == SKIP @address1 = address1 unless address1 == SKIP @postal_code = postal_code unless postal_code == SKIP @location = location unless location == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#address1 ⇒ String
When merchant wants to send the rental address's street address.
42 43 44 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 42 def address1 @address1 end |
#city ⇒ String
City where the auto was returned to the rental agency.
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 14 def city @city end |
#country ⇒ String
Country where the auto was returned to the rental agency. Use the [ISO Standard Country Codes](https://developer.cybersource.com/library/documentation/sbc/quickre f/countries_alpha_list.pdf).
32 33 34 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 32 def country @country end |
#location ⇒ String
This field contains the location where the taxi passenger was dropped off or where the auto rental vehicle was returned.
51 52 53 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 51 def location @location end |
#location_id ⇒ String
Code, address, phone number, etc. used to identify the location of the auto rental return. This field is supported only for MasterCard and American Express.
38 39 40 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 38 def location_id @location_id end |
#postal_code ⇒ String
When merchant wants to send the return address's postal code.
46 47 48 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 46 def postal_code @postal_code end |
#state ⇒ String
State in which the auto was returned to the rental agency. Use the [State, Province, and Territory Codes for the United States and Canada](https://developer.cybersource.com/library/documentation/sbc/quickr ef/states_and_provinces.pdf). For authorizations, this field is supported for Visa, MasterCard, and American Express. For captures, this field is supported only for MasterCard and American Express.
25 26 27 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 25 def state @state end |
Class Method Details
.from_element(root) ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 131 def self.from_element(root) city = XmlUtilities.from_element(root, 'city', String) state = XmlUtilities.from_element(root, 'state', String) country = XmlUtilities.from_element(root, 'country', String) location_id = XmlUtilities.from_element(root, 'locationId', String) address1 = XmlUtilities.from_element(root, 'address1', String) postal_code = XmlUtilities.from_element(root, 'postalCode', String) location = XmlUtilities.from_element(root, 'location', String) new(city: city, state: state, country: country, location_id: location_id, address1: address1, postal_code: postal_code, location: location, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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/cyber_source_merged_spec/models/return_address.rb', line 101 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. city = hash.key?('city') ? hash['city'] : SKIP state = hash.key?('state') ? hash['state'] : SKIP country = hash.key?('country') ? hash['country'] : SKIP location_id = hash.key?('locationId') ? hash['locationId'] : SKIP address1 = hash.key?('address1') ? hash['address1'] : SKIP postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP location = hash.key?('location') ? hash['location'] : 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. ReturnAddress.new(city: city, state: state, country: country, location_id: location_id, address1: address1, postal_code: postal_code, location: location, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 54 def self.names @_hash = {} if @_hash.nil? @_hash['city'] = 'city' @_hash['state'] = 'state' @_hash['country'] = 'country' @_hash['location_id'] = 'locationId' @_hash['address1'] = 'address1' @_hash['postal_code'] = 'postalCode' @_hash['location'] = 'location' @_hash end |
.nullables ⇒ Object
An array for nullable fields
80 81 82 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 80 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 67 def self.optionals %w[ city state country location_id address1 postal_code location ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
175 176 177 178 179 180 181 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 175 def inspect class_name = self.class.name.split('::').last "<#{class_name} city: #{@city.inspect}, state: #{@state.inspect}, country:"\ " #{@country.inspect}, location_id: #{@location_id.inspect}, address1: #{@address1.inspect},"\ " postal_code: #{@postal_code.inspect}, location: #{@location.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
167 168 169 170 171 172 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 167 def to_s class_name = self.class.name.split('::').last "<#{class_name} city: #{@city}, state: #{@state}, country: #{@country}, location_id:"\ " #{@location_id}, address1: #{@address1}, postal_code: #{@postal_code}, location:"\ " #{@location}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/cyber_source_merged_spec/models/return_address.rb', line 150 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'city', city) XmlUtilities.add_as_subelement(doc, root, 'state', state) XmlUtilities.add_as_subelement(doc, root, 'country', country) XmlUtilities.add_as_subelement(doc, root, 'locationId', location_id) XmlUtilities.add_as_subelement(doc, root, 'address1', address1) XmlUtilities.add_as_subelement(doc, root, 'postalCode', postal_code) XmlUtilities.add_as_subelement(doc, root, 'location', location) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |