Class: UnivapayClientSdk::CheckoutThemeColors

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/checkout_theme_colors.rb

Overview

Hex colors applied to the checkout widget. Always resolves to the platform defaults shown here when not customized — never null.

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(main_background: SKIP, secondary_background: SKIP, main_color: SKIP, main_text: SKIP, primary_text: SKIP, secondary_text: SKIP, base_text: SKIP, body_background: SKIP, additional_properties: nil) ⇒ CheckoutThemeColors

Returns a new instance of CheckoutThemeColors.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 78

def initialize(main_background: SKIP, secondary_background: SKIP,
               main_color: SKIP, main_text: SKIP, primary_text: SKIP,
               secondary_text: SKIP, base_text: SKIP, body_background: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @main_background = main_background unless main_background == SKIP
  @secondary_background = secondary_background unless secondary_background == SKIP
  @main_color = main_color unless main_color == SKIP
  @main_text = main_text unless main_text == SKIP
  @primary_text = primary_text unless primary_text == SKIP
  @secondary_text = secondary_text unless secondary_text == SKIP
  @base_text = base_text unless base_text == SKIP
  @body_background = body_background unless body_background == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#base_textString

Base text color.

Returns:

  • (String)


39
40
41
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 39

def base_text
  @base_text
end

#body_backgroundString

Body background color.

Returns:

  • (String)


43
44
45
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 43

def body_background
  @body_background
end

#main_backgroundString

Main background color.

Returns:

  • (String)


15
16
17
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 15

def main_background
  @main_background
end

#main_colorString

Main accent color.

Returns:

  • (String)


23
24
25
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 23

def main_color
  @main_color
end

#main_textString

Main text color.

Returns:

  • (String)


27
28
29
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 27

def main_text
  @main_text
end

#primary_textString

Primary text color.

Returns:

  • (String)


31
32
33
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 31

def primary_text
  @primary_text
end

#secondary_backgroundString

Secondary background color.

Returns:

  • (String)


19
20
21
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 19

def secondary_background
  @secondary_background
end

#secondary_textString

Secondary text color.

Returns:

  • (String)


35
36
37
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 35

def secondary_text
  @secondary_text
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
122
123
124
125
126
127
128
129
130
131
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 97

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  main_background =
    hash.key?('main_background') ? hash['main_background'] : SKIP
  secondary_background =
    hash.key?('secondary_background') ? hash['secondary_background'] : SKIP
  main_color = hash.key?('main_color') ? hash['main_color'] : SKIP
  main_text = hash.key?('main_text') ? hash['main_text'] : SKIP
  primary_text = hash.key?('primary_text') ? hash['primary_text'] : SKIP
  secondary_text =
    hash.key?('secondary_text') ? hash['secondary_text'] : SKIP
  base_text = hash.key?('base_text') ? hash['base_text'] : SKIP
  body_background =
    hash.key?('body_background') ? hash['body_background'] : 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.
  CheckoutThemeColors.new(main_background: main_background,
                          secondary_background: secondary_background,
                          main_color: main_color,
                          main_text: main_text,
                          primary_text: primary_text,
                          secondary_text: secondary_text,
                          base_text: base_text,
                          body_background: body_background,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['main_background'] = 'main_background'
  @_hash['secondary_background'] = 'secondary_background'
  @_hash['main_color'] = 'main_color'
  @_hash['main_text'] = 'main_text'
  @_hash['primary_text'] = 'primary_text'
  @_hash['secondary_text'] = 'secondary_text'
  @_hash['base_text'] = 'base_text'
  @_hash['body_background'] = 'body_background'
  @_hash
end

.nullablesObject

An array for nullable fields



74
75
76
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 74

def self.nullables
  []
end

.optionalsObject

An array for optional fields



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 60

def self.optionals
  %w[
    main_background
    secondary_background
    main_color
    main_text
    primary_text
    secondary_text
    base_text
    body_background
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



144
145
146
147
148
149
150
151
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 144

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} main_background: #{@main_background.inspect}, secondary_background:"\
  " #{@secondary_background.inspect}, main_color: #{@main_color.inspect}, main_text:"\
  " #{@main_text.inspect}, primary_text: #{@primary_text.inspect}, secondary_text:"\
  " #{@secondary_text.inspect}, base_text: #{@base_text.inspect}, body_background:"\
  " #{@body_background.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



134
135
136
137
138
139
140
141
# File 'lib/univapay_client_sdk/models/checkout_theme_colors.rb', line 134

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} main_background: #{@main_background}, secondary_background:"\
  " #{@secondary_background}, main_color: #{@main_color}, main_text: #{@main_text},"\
  " primary_text: #{@primary_text}, secondary_text: #{@secondary_text}, base_text:"\
  " #{@base_text}, body_background: #{@body_background}, additional_properties:"\
  " #{@additional_properties}>"
end