Class: VisaAcceptanceMergedSpec::Color

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/color.rb

Overview

Color 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(border: SKIP, border_selected: SKIP, button: SKIP, button_text: SKIP, checkbox: SKIP, checkbox_check_mark: SKIP, header: SKIP, link: SKIP, text: SKIP, additional_properties: nil) ⇒ Color

Returns a new instance of Color.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 83

def initialize(border: SKIP, border_selected: SKIP, button: SKIP,
               button_text: SKIP, checkbox: SKIP, checkbox_check_mark: SKIP,
               header: SKIP, link: SKIP, text: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @border = border unless border == SKIP
  @border_selected = border_selected unless border_selected == SKIP
  @button = button unless button == SKIP
  @button_text = button_text unless button_text == SKIP
  @checkbox = checkbox unless checkbox == SKIP
  @checkbox_check_mark = checkbox_check_mark unless checkbox_check_mark == SKIP
  @header = header unless header == SKIP
  @link = link unless link == SKIP
  @text = text unless text == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#borderString

Border Color

Returns:

  • (String)


14
15
16
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 14

def border
  @border
end

#border_selectedString

Selected Border Color

Returns:

  • (String)


18
19
20
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 18

def border_selected
  @border_selected
end

#buttonString

Button Color

Returns:

  • (String)


22
23
24
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 22

def button
  @button
end

#button_textString

Button Text Color

Returns:

  • (String)


26
27
28
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 26

def button_text
  @button_text
end

#checkboxString

Checkbox Color

Returns:

  • (String)


30
31
32
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 30

def checkbox
  @checkbox
end

#checkbox_check_markString

Checkbox Checkmark Color

Returns:

  • (String)


34
35
36
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 34

def checkbox_check_mark
  @checkbox_check_mark
end

#headerString

Header Color

Returns:

  • (String)


38
39
40
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 38

def header
  @header
end

Link Color

Returns:

  • (String)


42
43
44
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 42

def link
  @link
end

#textString

Text Color

Returns:

  • (String)


46
47
48
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 46

def text
  @text
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
132
133
134
135
136
137
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 103

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  border = hash.key?('border') ? hash['border'] : SKIP
  border_selected =
    hash.key?('borderSelected') ? hash['borderSelected'] : SKIP
  button = hash.key?('button') ? hash['button'] : SKIP
  button_text = hash.key?('buttonText') ? hash['buttonText'] : SKIP
  checkbox = hash.key?('checkbox') ? hash['checkbox'] : SKIP
  checkbox_check_mark =
    hash.key?('checkboxCheckMark') ? hash['checkboxCheckMark'] : SKIP
  header = hash.key?('header') ? hash['header'] : SKIP
  link = hash.key?('link') ? hash['link'] : SKIP
  text = hash.key?('text') ? hash['text'] : 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.
  Color.new(border: border,
            border_selected: border_selected,
            button: button,
            button_text: button_text,
            checkbox: checkbox,
            checkbox_check_mark: checkbox_check_mark,
            header: header,
            link: link,
            text: text,
            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['border'] = 'border'
  @_hash['border_selected'] = 'borderSelected'
  @_hash['button'] = 'button'
  @_hash['button_text'] = 'buttonText'
  @_hash['checkbox'] = 'checkbox'
  @_hash['checkbox_check_mark'] = 'checkboxCheckMark'
  @_hash['header'] = 'header'
  @_hash['link'] = 'link'
  @_hash['text'] = 'text'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 79

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 64

def self.optionals
  %w[
    border
    border_selected
    button
    button_text
    checkbox
    checkbox_check_mark
    header
    link
    text
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



149
150
151
152
153
154
155
156
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 149

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} border: #{@border.inspect}, border_selected: #{@border_selected.inspect},"\
  " button: #{@button.inspect}, button_text: #{@button_text.inspect}, checkbox:"\
  " #{@checkbox.inspect}, checkbox_check_mark: #{@checkbox_check_mark.inspect}, header:"\
  " #{@header.inspect}, link: #{@link.inspect}, text: #{@text.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



140
141
142
143
144
145
146
# File 'lib/visa_acceptance_merged_spec/models/color.rb', line 140

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} border: #{@border}, border_selected: #{@border_selected}, button:"\
  " #{@button}, button_text: #{@button_text}, checkbox: #{@checkbox}, checkbox_check_mark:"\
  " #{@checkbox_check_mark}, header: #{@header}, link: #{@link}, text: #{@text},"\
  " additional_properties: #{@additional_properties}>"
end