Class: CyberSourceMergedSpec::MerchantInformation7

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

Overview

MerchantInformation7 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(category_code: SKIP, additional_properties: nil) ⇒ MerchantInformation7

Returns a new instance of MerchantInformation7.



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

def initialize(category_code: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @category_code = category_code unless category_code == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#category_codeString

The value for this field is a four-digit number that the payment card industry uses to classify merchants into market segments. A payment card company assigned one or more of these values to your business when you started accepting the payment card company's cards. When you do not include this field in your request, Cybersource uses the value in your Cybersource account. Use this field only for clearing with your acquirer.

Returns:

  • (String)


20
21
22
# File 'lib/cyber_source_merged_spec/models/merchant_information7.rb', line 20

def category_code
  @category_code
end

Class Method Details

.from_element(root) ⇒ Object



68
69
70
71
72
73
# File 'lib/cyber_source_merged_spec/models/merchant_information7.rb', line 68

def self.from_element(root)
  category_code = XmlUtilities.from_element(root, 'categoryCode', String)

  new(category_code: category_code,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/cyber_source_merged_spec/models/merchant_information7.rb', line 50

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  category_code = hash.key?('categoryCode') ? hash['categoryCode'] : 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.
  MerchantInformation7.new(category_code: category_code,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



23
24
25
26
27
# File 'lib/cyber_source_merged_spec/models/merchant_information7.rb', line 23

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['category_code'] = 'categoryCode'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



30
31
32
33
34
# File 'lib/cyber_source_merged_spec/models/merchant_information7.rb', line 30

def self.optionals
  %w[
    category_code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



93
94
95
96
97
# File 'lib/cyber_source_merged_spec/models/merchant_information7.rb', line 93

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

#to_sObject

Provides a human-readable string representation of the object.



86
87
88
89
90
# File 'lib/cyber_source_merged_spec/models/merchant_information7.rb', line 86

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

#to_xml_element(doc, root_name) ⇒ Object



75
76
77
78
79
80
81
82
83
# File 'lib/cyber_source_merged_spec/models/merchant_information7.rb', line 75

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

  XmlUtilities.add_as_subelement(doc, root, 'categoryCode', category_code)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end