Class: CyberSourceMergedSpec::Other

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

Overview

Other Merchant Details Values.

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(request_id: SKIP, merchant_data1: SKIP, merchant_data2: SKIP, merchant_data3: SKIP, merchant_data4: SKIP, first_name: SKIP, last_name: SKIP, additional_properties: nil) ⇒ Other

Returns a new instance of Other.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/cyber_source_merged_spec/models/other.rb', line 72

def initialize(request_id: SKIP, merchant_data1: SKIP, merchant_data2: SKIP,
               merchant_data3: SKIP, merchant_data4: SKIP, first_name: SKIP,
               last_name: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @request_id = request_id unless request_id == SKIP
  @merchant_data1 = merchant_data1 unless merchant_data1 == SKIP
  @merchant_data2 = merchant_data2 unless merchant_data2 == SKIP
  @merchant_data3 = merchant_data3 unless merchant_data3 == SKIP
  @merchant_data4 = merchant_data4 unless merchant_data4 == 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

#first_nameString

First Name

Returns:

  • (String)


35
36
37
# File 'lib/cyber_source_merged_spec/models/other.rb', line 35

def first_name
  @first_name
end

#last_nameString

Last Name

Returns:

  • (String)


39
40
41
# File 'lib/cyber_source_merged_spec/models/other.rb', line 39

def last_name
  @last_name
end

#merchant_data1String

Merchant Defined Data

Returns:

  • (String)


19
20
21
# File 'lib/cyber_source_merged_spec/models/other.rb', line 19

def merchant_data1
  @merchant_data1
end

#merchant_data2String

Merchant Defined Data

Returns:

  • (String)


23
24
25
# File 'lib/cyber_source_merged_spec/models/other.rb', line 23

def merchant_data2
  @merchant_data2
end

#merchant_data3String

Merchant Defined Data

Returns:

  • (String)


27
28
29
# File 'lib/cyber_source_merged_spec/models/other.rb', line 27

def merchant_data3
  @merchant_data3
end

#merchant_data4String

Merchant Defined Data

Returns:

  • (String)


31
32
33
# File 'lib/cyber_source_merged_spec/models/other.rb', line 31

def merchant_data4
  @merchant_data4
end

#request_idString

An unique identification number assigned by CyberSource to identify the submitted request.

Returns:

  • (String)


15
16
17
# File 'lib/cyber_source_merged_spec/models/other.rb', line 15

def request_id
  @request_id
end

Class Method Details

.from_element(root) ⇒ Object



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/cyber_source_merged_spec/models/other.rb', line 119

def self.from_element(root)
  request_id = XmlUtilities.from_element(root, 'requestId', String)
  merchant_data1 = XmlUtilities.from_element(root, 'merchantData1', String)
  merchant_data2 = XmlUtilities.from_element(root, 'merchantData2', String)
  merchant_data3 = XmlUtilities.from_element(root, 'merchantData3', String)
  merchant_data4 = XmlUtilities.from_element(root, 'merchantData4', String)
  first_name = XmlUtilities.from_element(root, 'firstName', String)
  last_name = XmlUtilities.from_element(root, 'lastName', String)

  new(request_id: request_id,
      merchant_data1: merchant_data1,
      merchant_data2: merchant_data2,
      merchant_data3: merchant_data3,
      merchant_data4: merchant_data4,
      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.



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
115
116
117
# File 'lib/cyber_source_merged_spec/models/other.rb', line 89

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  request_id = hash.key?('requestId') ? hash['requestId'] : SKIP
  merchant_data1 = hash.key?('merchantData1') ? hash['merchantData1'] : SKIP
  merchant_data2 = hash.key?('merchantData2') ? hash['merchantData2'] : SKIP
  merchant_data3 = hash.key?('merchantData3') ? hash['merchantData3'] : SKIP
  merchant_data4 = hash.key?('merchantData4') ? hash['merchantData4'] : 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.
  Other.new(request_id: request_id,
            merchant_data1: merchant_data1,
            merchant_data2: merchant_data2,
            merchant_data3: merchant_data3,
            merchant_data4: merchant_data4,
            first_name: first_name,
            last_name: last_name,
            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/cyber_source_merged_spec/models/other.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['request_id'] = 'requestId'
  @_hash['merchant_data1'] = 'merchantData1'
  @_hash['merchant_data2'] = 'merchantData2'
  @_hash['merchant_data3'] = 'merchantData3'
  @_hash['merchant_data4'] = 'merchantData4'
  @_hash['first_name'] = 'firstName'
  @_hash['last_name'] = 'lastName'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
# File 'lib/cyber_source_merged_spec/models/other.rb', line 68

def self.nullables
  []
end

.optionalsObject

An array for optional fields



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/cyber_source_merged_spec/models/other.rb', line 55

def self.optionals
  %w[
    request_id
    merchant_data1
    merchant_data2
    merchant_data3
    merchant_data4
    first_name
    last_name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



164
165
166
167
168
169
170
171
# File 'lib/cyber_source_merged_spec/models/other.rb', line 164

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id.inspect}, merchant_data1:"\
  " #{@merchant_data1.inspect}, merchant_data2: #{@merchant_data2.inspect}, merchant_data3:"\
  " #{@merchant_data3.inspect}, merchant_data4: #{@merchant_data4.inspect}, first_name:"\
  " #{@first_name.inspect}, last_name: #{@last_name.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id}, merchant_data1: #{@merchant_data1},"\
  " merchant_data2: #{@merchant_data2}, merchant_data3: #{@merchant_data3}, merchant_data4:"\
  " #{@merchant_data4}, first_name: #{@first_name}, last_name: #{@last_name},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/cyber_source_merged_spec/models/other.rb', line 138

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

  XmlUtilities.add_as_subelement(doc, root, 'requestId', request_id)
  XmlUtilities.add_as_subelement(doc, root, 'merchantData1', merchant_data1)
  XmlUtilities.add_as_subelement(doc, root, 'merchantData2', merchant_data2)
  XmlUtilities.add_as_subelement(doc, root, 'merchantData3', merchant_data3)
  XmlUtilities.add_as_subelement(doc, root, 'merchantData4', merchant_data4)
  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