Class: CyberSourceMergedSpec::ReportPreferences
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::ReportPreferences
- Defined in:
- lib/cyber_source_merged_spec/models/report_preferences.rb
Overview
Report Preferences
Instance Attribute Summary collapse
-
#field_name_convention ⇒ String
Specify the field naming convention to be followed in reports (applicable to only csv report formats) Valid values: - SOAPI - SCMP.
-
#signed_amounts ⇒ TrueClass | FalseClass
Indicator to determine whether negative sign infront of amount for all refunded transaction.
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(signed_amounts: SKIP, field_name_convention: SKIP, additional_properties: nil) ⇒ ReportPreferences
constructor
A new instance of ReportPreferences.
-
#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(signed_amounts: SKIP, field_name_convention: SKIP, additional_properties: nil) ⇒ ReportPreferences
Returns a new instance of ReportPreferences.
46 47 48 49 50 51 52 53 54 |
# File 'lib/cyber_source_merged_spec/models/report_preferences.rb', line 46 def initialize(signed_amounts: SKIP, field_name_convention: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @signed_amounts = signed_amounts unless signed_amounts == SKIP @field_name_convention = field_name_convention unless field_name_convention == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#field_name_convention ⇒ String
Specify the field naming convention to be followed in reports (applicable to only csv report formats) Valid values:
- SOAPI
- SCMP
23 24 25 |
# File 'lib/cyber_source_merged_spec/models/report_preferences.rb', line 23 def field_name_convention @field_name_convention end |
#signed_amounts ⇒ TrueClass | FalseClass
Indicator to determine whether negative sign infront of amount for all refunded transaction
15 16 17 |
# File 'lib/cyber_source_merged_spec/models/report_preferences.rb', line 15 def signed_amounts @signed_amounts end |
Class Method Details
.from_element(root) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/cyber_source_merged_spec/models/report_preferences.rb', line 78 def self.from_element(root) signed_amounts = XmlUtilities.from_element(root, 'signedAmounts', TrueClass) field_name_convention = XmlUtilities.from_element(root, 'fieldNameConvention', String) new(signed_amounts: signed_amounts, field_name_convention: field_name_convention, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/cyber_source_merged_spec/models/report_preferences.rb', line 57 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. signed_amounts = hash.key?('signedAmounts') ? hash['signedAmounts'] : SKIP field_name_convention = hash.key?('fieldNameConvention') ? hash['fieldNameConvention'] : 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. ReportPreferences.new(signed_amounts: signed_amounts, field_name_convention: field_name_convention, 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/report_preferences.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['signed_amounts'] = 'signedAmounts' @_hash['field_name_convention'] = 'fieldNameConvention' @_hash end |
.nullables ⇒ Object
An array for nullable fields
42 43 44 |
# File 'lib/cyber_source_merged_spec/models/report_preferences.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/report_preferences.rb', line 34 def self.optionals %w[ signed_amounts field_name_convention ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
110 111 112 113 114 |
# File 'lib/cyber_source_merged_spec/models/report_preferences.rb', line 110 def inspect class_name = self.class.name.split('::').last "<#{class_name} signed_amounts: #{@signed_amounts.inspect}, field_name_convention:"\ " #{@field_name_convention.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
103 104 105 106 107 |
# File 'lib/cyber_source_merged_spec/models/report_preferences.rb', line 103 def to_s class_name = self.class.name.split('::').last "<#{class_name} signed_amounts: #{@signed_amounts}, field_name_convention:"\ " #{@field_name_convention}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/cyber_source_merged_spec/models/report_preferences.rb', line 90 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'signedAmounts', signed_amounts) XmlUtilities.add_as_subelement(doc, root, 'fieldNameConvention', field_name_convention) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |