Class: Authentik::Api::TelegramAuthRequest

Inherits:
ApiModelBase show all
Defined in:
lib/authentik/api/models/telegram_auth_request.rb

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 = {}) ⇒ TelegramAuthRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



70
71
72
73
74
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
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 70

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Authentik::Api::TelegramAuthRequest` 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::TelegramAuthRequest`. 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
end

Instance Attribute Details

#auth_dateObject

Returns the value of attribute auth_date.



22
23
24
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 22

def auth_date
  @auth_date
end

#first_nameObject

Returns the value of attribute first_name.



14
15
16
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 14

def first_name
  @first_name
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



322
323
324
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 322

def hash
  @hash
end

#idObject

Returns the value of attribute id.



12
13
14
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 12

def id
  @id
end

#last_nameObject

Returns the value of attribute last_name.



16
17
18
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 16

def last_name
  @last_name
end

#photo_urlObject

Returns the value of attribute photo_url.



20
21
22
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 20

def photo_url
  @photo_url
end

#usernameObject

Returns the value of attribute username.



18
19
20
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 18

def username
  @username
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



40
41
42
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 40

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



45
46
47
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 45

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 27

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'
  }
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



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 329

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



63
64
65
66
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 63

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

.openapi_typesObject

Attribute type mapping.



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 50

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

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



302
303
304
305
306
307
308
309
310
311
312
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 302

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
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


316
317
318
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 316

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



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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 351

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



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/authentik/api/models/telegram_auth_request.rb', line 177

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
  true
end