Class: CyberSourceMergedSpec::TmsCardArt

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

Overview

Card art associated with the tokenized card.

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(foreground_color: SKIP, background_color: SKIP, label_color: SKIP, combined_asset: SKIP, brand_logo_asset: SKIP, issuer_logo_asset: SKIP, icon_asset: SKIP, additional_properties: nil) ⇒ TmsCardArt

Returns a new instance of TmsCardArt.



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

def initialize(foreground_color: SKIP, background_color: SKIP,
               label_color: SKIP, combined_asset: SKIP,
               brand_logo_asset: SKIP, issuer_logo_asset: SKIP,
               icon_asset: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @foreground_color = foreground_color unless foreground_color == SKIP
  @background_color = background_color unless background_color == SKIP
  @label_color = label_color unless label_color == SKIP
  @combined_asset = combined_asset unless combined_asset == SKIP
  @brand_logo_asset = brand_logo_asset unless brand_logo_asset == SKIP
  @issuer_logo_asset = issuer_logo_asset unless issuer_logo_asset == SKIP
  @icon_asset = icon_asset unless icon_asset == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#background_colorString

Card background color.

Returns:

  • (String)


18
19
20
# File 'lib/cyber_source_merged_spec/models/tms_card_art.rb', line 18

def background_color
  @background_color
end

#brand_logo_assetBrandLogoAsset

Brand logo card art asset associated with the tokenized card.

Returns:



30
31
32
# File 'lib/cyber_source_merged_spec/models/tms_card_art.rb', line 30

def brand_logo_asset
  @brand_logo_asset
end

#combined_assetCombinedAsset

Combined card art asset associated with the tokenized card.

Returns:



26
27
28
# File 'lib/cyber_source_merged_spec/models/tms_card_art.rb', line 26

def combined_asset
  @combined_asset
end

#foreground_colorString

Card foreground color.

Returns:

  • (String)


14
15
16
# File 'lib/cyber_source_merged_spec/models/tms_card_art.rb', line 14

def foreground_color
  @foreground_color
end

#icon_assetIconAsset

Icon card art asset associated with the tokenized card.

Returns:



38
39
40
# File 'lib/cyber_source_merged_spec/models/tms_card_art.rb', line 38

def icon_asset
  @icon_asset
end

#issuer_logo_assetIssuerLogoAsset

Issuer logo card art asset associated with the tokenized card.

Returns:



34
35
36
# File 'lib/cyber_source_merged_spec/models/tms_card_art.rb', line 34

def issuer_logo_asset
  @issuer_logo_asset
end

#label_colorString

Card label color.

Returns:

  • (String)


22
23
24
# File 'lib/cyber_source_merged_spec/models/tms_card_art.rb', line 22

def label_color
  @label_color
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  foreground_color = XmlUtilities.from_element(root, 'foregroundColor',
                                               String)
  background_color = XmlUtilities.from_element(root, 'backgroundColor',
                                               String)
  label_color = XmlUtilities.from_element(root, 'labelColor', String)
  combined_asset = XmlUtilities.from_element(root, 'CombinedAsset',
                                             CombinedAsset)
  brand_logo_asset = XmlUtilities.from_element(root, 'BrandLogoAsset',
                                               BrandLogoAsset)
  issuer_logo_asset = XmlUtilities.from_element(root, 'IssuerLogoAsset',
                                                IssuerLogoAsset)
  icon_asset = XmlUtilities.from_element(root, 'IconAsset', IconAsset)

  new(foreground_color: foreground_color,
      background_color: background_color,
      label_color: label_color,
      combined_asset: combined_asset,
      brand_logo_asset: brand_logo_asset,
      issuer_logo_asset: issuer_logo_asset,
      icon_asset: icon_asset,
      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
120
121
# File 'lib/cyber_source_merged_spec/models/tms_card_art.rb', line 89

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  foreground_color =
    hash.key?('foregroundColor') ? hash['foregroundColor'] : SKIP
  background_color =
    hash.key?('backgroundColor') ? hash['backgroundColor'] : SKIP
  label_color = hash.key?('labelColor') ? hash['labelColor'] : SKIP
  combined_asset = CombinedAsset.from_hash(hash['combinedAsset']) if hash['combinedAsset']
  brand_logo_asset = BrandLogoAsset.from_hash(hash['brandLogoAsset']) if
    hash['brandLogoAsset']
  issuer_logo_asset = IssuerLogoAsset.from_hash(hash['issuerLogoAsset']) if
    hash['issuerLogoAsset']
  icon_asset = IconAsset.from_hash(hash['iconAsset']) if hash['iconAsset']

  # 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.
  TmsCardArt.new(foreground_color: foreground_color,
                 background_color: background_color,
                 label_color: label_color,
                 combined_asset: combined_asset,
                 brand_logo_asset: brand_logo_asset,
                 issuer_logo_asset: issuer_logo_asset,
                 icon_asset: icon_asset,
                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['foreground_color'] = 'foregroundColor'
  @_hash['background_color'] = 'backgroundColor'
  @_hash['label_color'] = 'labelColor'
  @_hash['combined_asset'] = 'combinedAsset'
  @_hash['brand_logo_asset'] = 'brandLogoAsset'
  @_hash['issuer_logo_asset'] = 'issuerLogoAsset'
  @_hash['icon_asset'] = 'iconAsset'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/cyber_source_merged_spec/models/tms_card_art.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    foreground_color
    background_color
    label_color
    combined_asset
    brand_logo_asset
    issuer_logo_asset
    icon_asset
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} foreground_color: #{@foreground_color.inspect}, background_color:"\
  " #{@background_color.inspect}, label_color: #{@label_color.inspect}, combined_asset:"\
  " #{@combined_asset.inspect}, brand_logo_asset: #{@brand_logo_asset.inspect},"\
  " issuer_logo_asset: #{@issuer_logo_asset.inspect}, icon_asset: #{@icon_asset.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



168
169
170
171
172
173
174
# File 'lib/cyber_source_merged_spec/models/tms_card_art.rb', line 168

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} foreground_color: #{@foreground_color}, background_color:"\
  " #{@background_color}, label_color: #{@label_color}, combined_asset: #{@combined_asset},"\
  " brand_logo_asset: #{@brand_logo_asset}, issuer_logo_asset: #{@issuer_logo_asset},"\
  " icon_asset: #{@icon_asset}, additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



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

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

  XmlUtilities.add_as_subelement(doc, root, 'foregroundColor',
                                 foreground_color)
  XmlUtilities.add_as_subelement(doc, root, 'backgroundColor',
                                 background_color)
  XmlUtilities.add_as_subelement(doc, root, 'labelColor', label_color)
  XmlUtilities.add_as_subelement(doc, root, 'CombinedAsset', combined_asset)
  XmlUtilities.add_as_subelement(doc, root, 'BrandLogoAsset',
                                 brand_logo_asset)
  XmlUtilities.add_as_subelement(doc, root, 'IssuerLogoAsset',
                                 issuer_logo_asset)
  XmlUtilities.add_as_subelement(doc, root, 'IconAsset', icon_asset)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end