Class: CyberSourceMergedSpec::ApplicationInformation1

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

Overview

ApplicationInformation1 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(reason_code: SKIP, r_code: SKIP, r_flag: SKIP, applications: SKIP, return_code: SKIP, additional_properties: nil) ⇒ ApplicationInformation1

Returns a new instance of ApplicationInformation1.



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

def initialize(reason_code: SKIP, r_code: SKIP, r_flag: SKIP,
               applications: SKIP, return_code: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @reason_code = reason_code unless reason_code == SKIP
  @r_code = r_code unless r_code == SKIP
  @r_flag = r_flag unless r_flag == SKIP
  @applications = applications unless applications == SKIP
  @return_code = return_code unless return_code == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#applicationsArray[Application1]

One-word description of the result of the application.

Returns:



33
34
35
# File 'lib/cyber_source_merged_spec/models/application_information1.rb', line 33

def applications
  @applications
end

#r_codeString

Indicates whether the service request was successful. Possible values:

  • -1: An error occurred.
  • 0: The request was declined.
  • 1: The request was successful.

Returns:

  • (String)


25
26
27
# File 'lib/cyber_source_merged_spec/models/application_information1.rb', line 25

def r_code
  @r_code
end

#r_flagString

One-word description of the result of the application.

Returns:

  • (String)


29
30
31
# File 'lib/cyber_source_merged_spec/models/application_information1.rb', line 29

def r_flag
  @r_flag
end

#reason_codeString

Indicates the reason why a request succeeded or failed and possible action to take if a request fails. For details, see the appendix of reason codes in the documentation for the relevant payment method.

Returns:

  • (String)


17
18
19
# File 'lib/cyber_source_merged_spec/models/application_information1.rb', line 17

def reason_code
  @reason_code
end

#return_codeInteger

The description for this field is not available.

Returns:

  • (Integer)


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

def return_code
  @return_code
end

Class Method Details

.from_element(root) ⇒ Object



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/cyber_source_merged_spec/models/application_information1.rb', line 116

def self.from_element(root)
  reason_code = XmlUtilities.from_element(root, 'reasonCode', String)
  r_code = XmlUtilities.from_element(root, 'rCode', String)
  r_flag = XmlUtilities.from_element(root, 'rFlag', String)
  applications = XmlUtilities.from_element_to_array(root, 'Application1',
                                                    Application1)
  return_code = XmlUtilities.from_element(root, 'returnCode', Integer)

  new(reason_code: reason_code,
      r_code: r_code,
      r_flag: r_flag,
      applications: applications,
      return_code: return_code,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/cyber_source_merged_spec/models/application_information1.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  reason_code = hash.key?('reasonCode') ? hash['reasonCode'] : SKIP
  r_code = hash.key?('rCode') ? hash['rCode'] : SKIP
  r_flag = hash.key?('rFlag') ? hash['rFlag'] : SKIP
  # Parameter is an array, so we need to iterate through it
  applications = nil
  unless hash['applications'].nil?
    applications = []
    hash['applications'].each do |structure|
      applications << (Application1.from_hash(structure) if structure)
    end
  end

  applications = SKIP unless hash.key?('applications')
  return_code = hash.key?('returnCode') ? hash['returnCode'] : 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.
  ApplicationInformation1.new(reason_code: reason_code,
                              r_code: r_code,
                              r_flag: r_flag,
                              applications: applications,
                              return_code: return_code,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
# File 'lib/cyber_source_merged_spec/models/application_information1.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['reason_code'] = 'reasonCode'
  @_hash['r_code'] = 'rCode'
  @_hash['r_flag'] = 'rFlag'
  @_hash['applications'] = 'applications'
  @_hash['return_code'] = 'returnCode'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/cyber_source_merged_spec/models/application_information1.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
58
59
# File 'lib/cyber_source_merged_spec/models/application_information1.rb', line 51

def self.optionals
  %w[
    reason_code
    r_code
    r_flag
    applications
    return_code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



156
157
158
159
160
161
# File 'lib/cyber_source_merged_spec/models/application_information1.rb', line 156

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} reason_code: #{@reason_code.inspect}, r_code: #{@r_code.inspect}, r_flag:"\
  " #{@r_flag.inspect}, applications: #{@applications.inspect}, return_code:"\
  " #{@return_code.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



148
149
150
151
152
153
# File 'lib/cyber_source_merged_spec/models/application_information1.rb', line 148

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} reason_code: #{@reason_code}, r_code: #{@r_code}, r_flag: #{@r_flag},"\
  " applications: #{@applications}, return_code: #{@return_code}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/cyber_source_merged_spec/models/application_information1.rb', line 132

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

  XmlUtilities.add_as_subelement(doc, root, 'reasonCode', reason_code)
  XmlUtilities.add_as_subelement(doc, root, 'rCode', r_code)
  XmlUtilities.add_as_subelement(doc, root, 'rFlag', r_flag)
  XmlUtilities.add_array_as_subelement(doc, root, 'Application1',
                                       applications)
  XmlUtilities.add_as_subelement(doc, root, 'returnCode', return_code)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end