Class: Authentik::Api::TelegramChallengeResponseRequest

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/authentik/api/models/telegram_challenge_response_request.rb

Overview

Base class for all challenge responses

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ TelegramChallengeResponseRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



75
76
77
78
79
80
81
82
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
123
124
125
126
127
128
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 75

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Authentik::Api::TelegramChallengeResponseRequest` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Authentik::Api::TelegramChallengeResponseRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  else
    self.id = nil
  end

  if attributes.key?(:'first_name')
    self.first_name = attributes[:'first_name']
  end

  if attributes.key?(:'last_name')
    self.last_name = attributes[:'last_name']
  end

  if attributes.key?(:'username')
    self.username = attributes[:'username']
  end

  if attributes.key?(:'photo_url')
    self.photo_url = attributes[:'photo_url']
  end

  if attributes.key?(:'auth_date')
    self.auth_date = attributes[:'auth_date']
  else
    self.auth_date = nil
  end

  if attributes.key?(:'hash')
    self.hash = attributes[:'hash']
  else
    self.hash = nil
  end

  if attributes.key?(:'component')
    self.component = attributes[:'component']
  else
    self.component = 'ak-source-telegram'
  end
end

Instance Attribute Details

#auth_dateObject

Returns the value of attribute auth_date.



23
24
25
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 23

def auth_date
  @auth_date
end

#componentObject

Returns the value of attribute component.



27
28
29
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 27

def component
  @component
end

#first_nameObject

Returns the value of attribute first_name.



15
16
17
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 15

def first_name
  @first_name
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



353
354
355
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 353

def hash
  @hash
end

#idObject

Returns the value of attribute id.



13
14
15
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 13

def id
  @id
end

#last_nameObject

Returns the value of attribute last_name.



17
18
19
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 17

def last_name
  @last_name
end

#photo_urlObject

Returns the value of attribute photo_url.



21
22
23
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 21

def photo_url
  @photo_url
end

#usernameObject

Returns the value of attribute username.



19
20
21
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 19

def username
  @username
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



44
45
46
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 44

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



49
50
51
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 49

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 30

def self.attribute_map
  {
    :'id' => :'id',
    :'first_name' => :'first_name',
    :'last_name' => :'last_name',
    :'username' => :'username',
    :'photo_url' => :'photo_url',
    :'auth_date' => :'auth_date',
    :'hash' => :'hash',
    :'component' => :'component'
  }
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



360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 360

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



68
69
70
71
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 68

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 54

def self.openapi_types
  {
    :'id' => :'Integer',
    :'first_name' => :'String',
    :'last_name' => :'String',
    :'username' => :'String',
    :'photo_url' => :'String',
    :'auth_date' => :'Integer',
    :'hash' => :'String',
    :'component' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 332

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      first_name == o.first_name &&
      last_name == o.last_name &&
      username == o.username &&
      photo_url == o.photo_url &&
      auth_date == o.auth_date &&
      hash == o.hash &&
      component == o.component
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


347
348
349
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 347

def eql?(o)
  self == o
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 132

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if !@first_name.nil? && @first_name.to_s.length > 255
    invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 255.')
  end

  if !@first_name.nil? && @first_name.to_s.length < 1
    invalid_properties.push('invalid value for "first_name", the character length must be greater than or equal to 1.')
  end

  if !@last_name.nil? && @last_name.to_s.length > 255
    invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 255.')
  end

  if !@last_name.nil? && @last_name.to_s.length < 1
    invalid_properties.push('invalid value for "last_name", the character length must be greater than or equal to 1.')
  end

  if !@username.nil? && @username.to_s.length > 255
    invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 255.')
  end

  if !@username.nil? && @username.to_s.length < 1
    invalid_properties.push('invalid value for "username", the character length must be greater than or equal to 1.')
  end

  if !@photo_url.nil? && @photo_url.to_s.length < 1
    invalid_properties.push('invalid value for "photo_url", the character length must be greater than or equal to 1.')
  end

  if @auth_date.nil?
    invalid_properties.push('invalid value for "auth_date", auth_date cannot be nil.')
  end

  if @hash.nil?
    invalid_properties.push('invalid value for "hash", hash cannot be nil.')
  end

  if @hash.to_s.length > 64
    invalid_properties.push('invalid value for "hash", the character length must be smaller than or equal to 64.')
  end

  if @hash.to_s.length < 1
    invalid_properties.push('invalid value for "hash", the character length must be greater than or equal to 1.')
  end

  if !@component.nil? && @component.to_s.length < 1
    invalid_properties.push('invalid value for "component", the character length must be greater than or equal to 1.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 382

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

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

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/authentik/api/models/telegram_challenge_response_request.rb', line 192

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if !@first_name.nil? && @first_name.to_s.length > 255
  return false if !@first_name.nil? && @first_name.to_s.length < 1
  return false if !@last_name.nil? && @last_name.to_s.length > 255
  return false if !@last_name.nil? && @last_name.to_s.length < 1
  return false if !@username.nil? && @username.to_s.length > 255
  return false if !@username.nil? && @username.to_s.length < 1
  return false if !@photo_url.nil? && @photo_url.to_s.length < 1
  return false if @auth_date.nil?
  return false if @hash.nil?
  return false if @hash.to_s.length > 64
  return false if @hash.to_s.length < 1
  return false if !@component.nil? && @component.to_s.length < 1
  true
end