Class: CyberSourceMergedSpec::Surcharge3
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::Surcharge3
- Defined in:
- lib/cyber_source_merged_spec/models/surcharge3.rb
Overview
Surcharge3 Model.
Instance Attribute Summary collapse
-
#amount ⇒ String
Surcharge amount that you are charging the customer for this subscription.
-
#description ⇒ String
Description of the surcharge.
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(amount: SKIP, description: SKIP, additional_properties: nil) ⇒ Surcharge3
constructor
A new instance of Surcharge3.
-
#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(amount: SKIP, description: SKIP, additional_properties: nil) ⇒ Surcharge3
Returns a new instance of Surcharge3.
46 47 48 49 50 51 52 53 |
# File 'lib/cyber_source_merged_spec/models/surcharge3.rb', line 46 def initialize(amount: SKIP, description: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @amount = amount unless amount == SKIP @description = description unless description == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ String
Surcharge amount that you are charging the customer for this subscription. The surcharge amount will be added to the billing amount. The issuer can provide information about the surcharge amount to the customer. NOTE: This field is supported only for CyberSource through VisaNet (CtV) for Payouts. For CtV, the maximum string length is 8.
19 20 21 |
# File 'lib/cyber_source_merged_spec/models/surcharge3.rb', line 19 def amount @amount end |
#description ⇒ String
Description of the surcharge.
23 24 25 |
# File 'lib/cyber_source_merged_spec/models/surcharge3.rb', line 23 def description @description end |
Class Method Details
.from_element(root) ⇒ Object
76 77 78 79 80 81 82 83 |
# File 'lib/cyber_source_merged_spec/models/surcharge3.rb', line 76 def self.from_element(root) amount = XmlUtilities.from_element(root, 'amount', String) description = XmlUtilities.from_element(root, 'description', String) new(amount: amount, description: description, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/cyber_source_merged_spec/models/surcharge3.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount = hash.key?('amount') ? hash['amount'] : SKIP description = hash.key?('description') ? hash['description'] : 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. Surcharge3.new(amount: amount, description: description, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 |
# File 'lib/cyber_source_merged_spec/models/surcharge3.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['description'] = 'description' @_hash end |
.nullables ⇒ Object
An array for nullable fields
42 43 44 |
# File 'lib/cyber_source_merged_spec/models/surcharge3.rb', line 42 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 |
# File 'lib/cyber_source_merged_spec/models/surcharge3.rb', line 34 def self.optionals %w[ amount description ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
104 105 106 107 108 |
# File 'lib/cyber_source_merged_spec/models/surcharge3.rb', line 104 def inspect class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount.inspect}, description: #{@description.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
97 98 99 100 101 |
# File 'lib/cyber_source_merged_spec/models/surcharge3.rb', line 97 def to_s class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount}, description: #{@description}, additional_properties:"\ " #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/cyber_source_merged_spec/models/surcharge3.rb', line 85 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'amount', amount) XmlUtilities.add_as_subelement(doc, root, 'description', description) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |