Class: CyberSourceMergedSpec::ShipTo31
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::ShipTo31
- Defined in:
- lib/cyber_source_merged_spec/models/ship_to31.rb
Overview
ShipTo31 Model.
Instance Attribute Summary collapse
-
#country ⇒ String
Country of the shipping address.
-
#first_name ⇒ String
First name of the recipient.
-
#last_name ⇒ String
Last name of the recipient.
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(country: SKIP, first_name: SKIP, last_name: SKIP, additional_properties: nil) ⇒ ShipTo31
constructor
A new instance of ShipTo31.
-
#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(country: SKIP, first_name: SKIP, last_name: SKIP, additional_properties: nil) ⇒ ShipTo31
Returns a new instance of ShipTo31.
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/cyber_source_merged_spec/models/ship_to31.rb', line 67 def initialize(country: SKIP, first_name: SKIP, last_name: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @country = country unless country == SKIP @first_name = first_name unless first_name == SKIP @last_name = last_name unless last_name == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#country ⇒ String
Country of the shipping address. Use the two-character [ISO Standard Country Codes.](http://apps.cybersource.com/library/documentation/sbc/quickref/cou ntries_alpha_list.pdf) Required field for authorization if any shipping address information is included in the request; otherwise, optional.
Tax Calculation
Optional field for U.S., Canadian, international tax, and value added taxes. Billing address objects will be used to determine the cardholder’s location when shipTo objects are not present.
24 25 26 |
# File 'lib/cyber_source_merged_spec/models/ship_to31.rb', line 24 def country @country end |
#first_name ⇒ String
First name of the recipient.
Litle
Maximum length: 25
All other processors
Maximum length: 60 Optional field.
33 34 35 |
# File 'lib/cyber_source_merged_spec/models/ship_to31.rb', line 33 def first_name @first_name end |
#last_name ⇒ String
Last name of the recipient.
Litle
Maximum length: 25
All other processors
Maximum length: 60 Optional field.
42 43 44 |
# File 'lib/cyber_source_merged_spec/models/ship_to31.rb', line 42 def last_name @last_name end |
Class Method Details
.from_element(root) ⇒ Object
101 102 103 104 105 106 107 108 109 110 |
# File 'lib/cyber_source_merged_spec/models/ship_to31.rb', line 101 def self.from_element(root) country = XmlUtilities.from_element(root, 'country', String) first_name = XmlUtilities.from_element(root, 'firstName', String) last_name = XmlUtilities.from_element(root, 'lastName', String) new(country: country, first_name: first_name, last_name: last_name, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/cyber_source_merged_spec/models/ship_to31.rb', line 79 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. country = hash.key?('country') ? hash['country'] : SKIP first_name = hash.key?('firstName') ? hash['firstName'] : SKIP last_name = hash.key?('lastName') ? hash['lastName'] : 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. ShipTo31.new(country: country, first_name: first_name, last_name: last_name, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
45 46 47 48 49 50 51 |
# File 'lib/cyber_source_merged_spec/models/ship_to31.rb', line 45 def self.names @_hash = {} if @_hash.nil? @_hash['country'] = 'country' @_hash['first_name'] = 'firstName' @_hash['last_name'] = 'lastName' @_hash end |
.nullables ⇒ Object
An array for nullable fields
63 64 65 |
# File 'lib/cyber_source_merged_spec/models/ship_to31.rb', line 63 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 |
# File 'lib/cyber_source_merged_spec/models/ship_to31.rb', line 54 def self.optionals %w[ country first_name last_name ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
132 133 134 135 136 |
# File 'lib/cyber_source_merged_spec/models/ship_to31.rb', line 132 def inspect class_name = self.class.name.split('::').last "<#{class_name} country: #{@country.inspect}, first_name: #{@first_name.inspect},"\ " last_name: #{@last_name.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
125 126 127 128 129 |
# File 'lib/cyber_source_merged_spec/models/ship_to31.rb', line 125 def to_s class_name = self.class.name.split('::').last "<#{class_name} country: #{@country}, first_name: #{@first_name}, last_name: #{@last_name},"\ " additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/cyber_source_merged_spec/models/ship_to31.rb', line 112 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'country', country) XmlUtilities.add_as_subelement(doc, root, 'firstName', first_name) XmlUtilities.add_as_subelement(doc, root, 'lastName', last_name) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |