Class: OCI::Waas::Models::Captcha

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/waas/models/captcha.rb

Overview

The settings of the CAPTCHA challenge. If a specific URL should be accessed only by a human, a CAPTCHA challenge can be placed at the URL to protect the web application from bots.

Warning: Oracle recommends that you avoid using any confidential information when you supply string values using the API.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Captcha

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :url (String)

    The value to assign to the #url property

  • :session_expiration_in_seconds (Integer)

    The value to assign to the #session_expiration_in_seconds property

  • :title (String)

    The value to assign to the #title property

  • :header_text (String)

    The value to assign to the #header_text property

  • :footer_text (String)

    The value to assign to the #footer_text property

  • :failure_message (String)

    The value to assign to the #failure_message property

  • :submit_label (String)

    The value to assign to the #submit_label property



83
84
85
86
87
88
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
122
# File 'lib/oci/waas/models/captcha.rb', line 83

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.url = attributes[:'url'] if attributes[:'url']

  self.session_expiration_in_seconds = attributes[:'sessionExpirationInSeconds'] if attributes[:'sessionExpirationInSeconds']

  raise 'You cannot provide both :sessionExpirationInSeconds and :session_expiration_in_seconds' if attributes.key?(:'sessionExpirationInSeconds') && attributes.key?(:'session_expiration_in_seconds')

  self.session_expiration_in_seconds = attributes[:'session_expiration_in_seconds'] if attributes[:'session_expiration_in_seconds']

  self.title = attributes[:'title'] if attributes[:'title']

  self.header_text = attributes[:'headerText'] if attributes[:'headerText']

  raise 'You cannot provide both :headerText and :header_text' if attributes.key?(:'headerText') && attributes.key?(:'header_text')

  self.header_text = attributes[:'header_text'] if attributes[:'header_text']

  self.footer_text = attributes[:'footerText'] if attributes[:'footerText']

  raise 'You cannot provide both :footerText and :footer_text' if attributes.key?(:'footerText') && attributes.key?(:'footer_text')

  self.footer_text = attributes[:'footer_text'] if attributes[:'footer_text']

  self.failure_message = attributes[:'failureMessage'] if attributes[:'failureMessage']

  raise 'You cannot provide both :failureMessage and :failure_message' if attributes.key?(:'failureMessage') && attributes.key?(:'failure_message')

  self.failure_message = attributes[:'failure_message'] if attributes[:'failure_message']

  self.submit_label = attributes[:'submitLabel'] if attributes[:'submitLabel']

  raise 'You cannot provide both :submitLabel and :submit_label' if attributes.key?(:'submitLabel') && attributes.key?(:'submit_label')

  self.submit_label = attributes[:'submit_label'] if attributes[:'submit_label']
end

Instance Attribute Details

#failure_messageString

[Required] The text to show when incorrect CAPTCHA text is entered. If unspecified, defaults to The CAPTCHA was incorrect. Try again.

Returns:

  • (String)


34
35
36
# File 'lib/oci/waas/models/captcha.rb', line 34

def failure_message
  @failure_message
end

The text to show in the footer when showing a CAPTCHA challenge. If unspecified, defaults to 'Enter the letters and numbers as they are shown in the image above.'

Returns:

  • (String)


30
31
32
# File 'lib/oci/waas/models/captcha.rb', line 30

def footer_text
  @footer_text
end

#header_textString

The text to show in the header when showing a CAPTCHA challenge. If unspecified, defaults to 'We have detected an increased number of attempts to access this website. To help us keep this site secure, please let us know that you are not a robot by entering the text from the image below.'

Returns:

  • (String)


26
27
28
# File 'lib/oci/waas/models/captcha.rb', line 26

def header_text
  @header_text
end

#session_expiration_in_secondsInteger

[Required] The amount of time before the CAPTCHA expires, in seconds. If unspecified, defaults to 300.

Returns:

  • (Integer)


18
19
20
# File 'lib/oci/waas/models/captcha.rb', line 18

def session_expiration_in_seconds
  @session_expiration_in_seconds
end

#submit_labelString

[Required] The text to show on the label of the CAPTCHA challenge submit button. If unspecified, defaults to Yes, I am human.

Returns:

  • (String)


38
39
40
# File 'lib/oci/waas/models/captcha.rb', line 38

def submit_label
  @submit_label
end

#titleString

[Required] The title used when displaying a CAPTCHA challenge. If unspecified, defaults to Are you human?

Returns:

  • (String)


22
23
24
# File 'lib/oci/waas/models/captcha.rb', line 22

def title
  @title
end

#urlString

[Required] The unique URL path at which to show the CAPTCHA challenge.

Returns:

  • (String)


14
15
16
# File 'lib/oci/waas/models/captcha.rb', line 14

def url
  @url
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/oci/waas/models/captcha.rb', line 41

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'url': :'url',
    'session_expiration_in_seconds': :'sessionExpirationInSeconds',
    'title': :'title',
    'header_text': :'headerText',
    'footer_text': :'footerText',
    'failure_message': :'failureMessage',
    'submit_label': :'submitLabel'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/oci/waas/models/captcha.rb', line 56

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'url': :'String',
    'session_expiration_in_seconds': :'Integer',
    'title': :'String',
    'header_text': :'String',
    'footer_text': :'String',
    'failure_message': :'String',
    'submit_label': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/oci/waas/models/captcha.rb', line 131

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    url == other.url &&
    session_expiration_in_seconds == other.session_expiration_in_seconds &&
    title == other.title &&
    header_text == other.header_text &&
    footer_text == other.footer_text &&
    failure_message == other.failure_message &&
    submit_label == other.submit_label
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/oci/waas/models/captcha.rb', line 167

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


147
148
149
# File 'lib/oci/waas/models/captcha.rb', line 147

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



156
157
158
# File 'lib/oci/waas/models/captcha.rb', line 156

def hash
  [url, session_expiration_in_seconds, title, header_text, footer_text, failure_message, submit_label].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



200
201
202
203
204
205
206
207
208
209
# File 'lib/oci/waas/models/captcha.rb', line 200

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



194
195
196
# File 'lib/oci/waas/models/captcha.rb', line 194

def to_s
  to_hash.to_s
end