Class: CyberSourceMergedSpec::RequestDetail

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

Overview

Request Info Section

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, cybersource_merchant_id: SKIP, processor_merchant_id: SKIP, group_name: SKIP, transaction_reference_number: SKIP, merchant_reference_number: SKIP, additional_properties: nil) ⇒ RequestDetail

Returns a new instance of RequestDetail.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/cyber_source_merged_spec/models/request_detail.rb', line 66

def initialize(request_id: SKIP, cybersource_merchant_id: SKIP,
               processor_merchant_id: SKIP, group_name: SKIP,
               transaction_reference_number: SKIP,
               merchant_reference_number: 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
  @cybersource_merchant_id = cybersource_merchant_id unless cybersource_merchant_id == SKIP
  @processor_merchant_id = processor_merchant_id unless processor_merchant_id == SKIP
  @group_name = group_name unless group_name == SKIP
  unless transaction_reference_number == SKIP
    @transaction_reference_number =
      transaction_reference_number
  end
  unless merchant_reference_number == SKIP
    @merchant_reference_number =
      merchant_reference_number
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#cybersource_merchant_idString

Cybersource Merchant Id

Returns:

  • (String)


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

def cybersource_merchant_id
  @cybersource_merchant_id
end

#group_nameString

Group Name

Returns:

  • (String)


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

def group_name
  @group_name
end

#merchant_reference_numberString

Merchant Reference Number

Returns:

  • (String)


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

def merchant_reference_number
  @merchant_reference_number
end

#processor_merchant_idString

Cybersource Processor Merchant Id

Returns:

  • (String)


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

def processor_merchant_id
  @processor_merchant_id
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/request_detail.rb', line 15

def request_id
  @request_id
end

#transaction_reference_numberString

Transaction Reference Number

Returns:

  • (String)


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

def transaction_reference_number
  @transaction_reference_number
end

Class Method Details

.from_element(root) ⇒ Object



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/cyber_source_merged_spec/models/request_detail.rb', line 121

def self.from_element(root)
  request_id = XmlUtilities.from_element(root, 'requestId', String)
  cybersource_merchant_id = XmlUtilities.from_element(
    root, 'cybersourceMerchantId', String
  )
  processor_merchant_id = XmlUtilities.from_element(root,
                                                    'processorMerchantId',
                                                    String)
  group_name = XmlUtilities.from_element(root, 'groupName', String)
  transaction_reference_number = XmlUtilities.from_element(
    root, 'transactionReferenceNumber', String
  )
  merchant_reference_number = XmlUtilities.from_element(
    root, 'merchantReferenceNumber', String
  )

  new(request_id: request_id,
      cybersource_merchant_id: cybersource_merchant_id,
      processor_merchant_id: processor_merchant_id,
      group_name: group_name,
      transaction_reference_number: transaction_reference_number,
      merchant_reference_number: merchant_reference_number,
      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
118
119
# File 'lib/cyber_source_merged_spec/models/request_detail.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
  cybersource_merchant_id =
    hash.key?('cybersourceMerchantId') ? hash['cybersourceMerchantId'] : SKIP
  processor_merchant_id =
    hash.key?('processorMerchantId') ? hash['processorMerchantId'] : SKIP
  group_name = hash.key?('groupName') ? hash['groupName'] : SKIP
  transaction_reference_number =
    hash.key?('transactionReferenceNumber') ? hash['transactionReferenceNumber'] : SKIP
  merchant_reference_number =
    hash.key?('merchantReferenceNumber') ? hash['merchantReferenceNumber'] : 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.
  RequestDetail.new(request_id: request_id,
                    cybersource_merchant_id: cybersource_merchant_id,
                    processor_merchant_id: processor_merchant_id,
                    group_name: group_name,
                    transaction_reference_number: transaction_reference_number,
                    merchant_reference_number: merchant_reference_number,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/cyber_source_merged_spec/models/request_detail.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['request_id'] = 'requestId'
  @_hash['cybersource_merchant_id'] = 'cybersourceMerchantId'
  @_hash['processor_merchant_id'] = 'processorMerchantId'
  @_hash['group_name'] = 'groupName'
  @_hash['transaction_reference_number'] = 'transactionReferenceNumber'
  @_hash['merchant_reference_number'] = 'merchantReferenceNumber'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    request_id
    cybersource_merchant_id
    processor_merchant_id
    group_name
    transaction_reference_number
    merchant_reference_number
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



176
177
178
179
180
181
182
183
184
# File 'lib/cyber_source_merged_spec/models/request_detail.rb', line 176

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id.inspect}, cybersource_merchant_id:"\
  " #{@cybersource_merchant_id.inspect}, processor_merchant_id:"\
  " #{@processor_merchant_id.inspect}, group_name: #{@group_name.inspect},"\
  " transaction_reference_number: #{@transaction_reference_number.inspect},"\
  " merchant_reference_number: #{@merchant_reference_number.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



166
167
168
169
170
171
172
173
# File 'lib/cyber_source_merged_spec/models/request_detail.rb', line 166

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id}, cybersource_merchant_id:"\
  " #{@cybersource_merchant_id}, processor_merchant_id: #{@processor_merchant_id}, group_name:"\
  " #{@group_name}, transaction_reference_number: #{@transaction_reference_number},"\
  " merchant_reference_number: #{@merchant_reference_number}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/cyber_source_merged_spec/models/request_detail.rb', line 146

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, 'cybersourceMerchantId',
                                 cybersource_merchant_id)
  XmlUtilities.add_as_subelement(doc, root, 'processorMerchantId',
                                 processor_merchant_id)
  XmlUtilities.add_as_subelement(doc, root, 'groupName', group_name)
  XmlUtilities.add_as_subelement(doc, root, 'transactionReferenceNumber',
                                 transaction_reference_number)
  XmlUtilities.add_as_subelement(doc, root, 'merchantReferenceNumber',
                                 merchant_reference_number)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end