Class: Authentik::Api::GrantRequest

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

Overview

Mixin to validate that a valid enterprise license exists before allowing to save the object

Defined Under Namespace

Classes: EnumAttributeValidator

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



114
115
116
117
118
119
120
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/authentik/api/models/grant_request.rb', line 114

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

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

  if attributes.key?(:'requester_data')
    if (value = attributes[:'requester_data']).is_a?(Hash)
      self.requester_data = value
    end
  end

  if attributes.key?(:'fulfiller_data')
    if (value = attributes[:'fulfiller_data']).is_a?(Hash)
      self.fulfiller_data = value
    end
  end

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

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

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

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

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

  if attributes.key?(:'targets')
    if (value = attributes[:'targets']).is_a?(Array)
      self.targets = value
    end
  else
    self.targets = nil
  end

  if attributes.key?(:'target_objs')
    if (value = attributes[:'target_objs']).is_a?(Array)
      self.target_objs = value
    end
  else
    self.target_objs = nil
  end

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

Instance Attribute Details

#agent_ownerObject

Returns the value of attribute agent_owner.



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

def agent_owner
  @agent_owner
end

#createdObject

Returns the value of attribute created.



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

def created
  @created
end

#created_byObject

Returns the value of attribute created_by.



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

def created_by
  @created_by
end

#expiresObject

Returns the value of attribute expires.



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

def expires
  @expires
end

#fulfiller_dataObject

Returns the value of attribute fulfiller_data.



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

def fulfiller_data
  @fulfiller_data
end

#is_activeObject

Returns the value of attribute is_active.



25
26
27
# File 'lib/authentik/api/models/grant_request.rb', line 25

def is_active
  @is_active
end

#requester_dataObject

Returns the value of attribute requester_data.



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

def requester_data
  @requester_data
end

#revoked_byObject

Returns the value of attribute revoked_by.



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

def revoked_by
  @revoked_by
end

#statusObject

Returns the value of attribute status.



29
30
31
# File 'lib/authentik/api/models/grant_request.rb', line 29

def status
  @status
end

#target_objsObject

Returns the value of attribute target_objs.



33
34
35
# File 'lib/authentik/api/models/grant_request.rb', line 33

def target_objs
  @target_objs
end

#targetsObject

Returns the value of attribute targets.



31
32
33
# File 'lib/authentik/api/models/grant_request.rb', line 31

def targets
  @targets
end

#uuidObject

Returns the value of attribute uuid.



35
36
37
# File 'lib/authentik/api/models/grant_request.rb', line 35

def uuid
  @uuid
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



78
79
80
# File 'lib/authentik/api/models/grant_request.rb', line 78

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



83
84
85
# File 'lib/authentik/api/models/grant_request.rb', line 83

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/authentik/api/models/grant_request.rb', line 60

def self.attribute_map
  {
    :'created' => :'created',
    :'created_by' => :'created_by',
    :'requester_data' => :'requester_data',
    :'fulfiller_data' => :'fulfiller_data',
    :'revoked_by' => :'revoked_by',
    :'agent_owner' => :'agent_owner',
    :'is_active' => :'is_active',
    :'expires' => :'expires',
    :'status' => :'status',
    :'targets' => :'targets',
    :'target_objs' => :'target_objs',
    :'uuid' => :'uuid'
  }
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



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/authentik/api/models/grant_request.rb', line 370

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



106
107
108
109
110
# File 'lib/authentik/api/models/grant_request.rb', line 106

def self.openapi_nullable
  Set.new([
    :'expires',
  ])
end

.openapi_typesObject

Attribute type mapping.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/authentik/api/models/grant_request.rb', line 88

def self.openapi_types
  {
    :'created' => :'Time',
    :'created_by' => :'PartialUser',
    :'requester_data' => :'Hash<String, Object>',
    :'fulfiller_data' => :'Hash<String, Object>',
    :'revoked_by' => :'PartialUser',
    :'agent_owner' => :'PartialUser',
    :'is_active' => :'Boolean',
    :'expires' => :'Time',
    :'status' => :'RequestStatus',
    :'targets' => :'Array<String>',
    :'target_objs' => :'Array<RequestableTarget>',
    :'uuid' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/authentik/api/models/grant_request.rb', line 338

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      created == o.created &&
      created_by == o.created_by &&
      requester_data == o.requester_data &&
      fulfiller_data == o.fulfiller_data &&
      revoked_by == o.revoked_by &&
      agent_owner == o.agent_owner &&
      is_active == o.is_active &&
      expires == o.expires &&
      status == o.status &&
      targets == o.targets &&
      target_objs == o.target_objs &&
      uuid == o.uuid
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


357
358
359
# File 'lib/authentik/api/models/grant_request.rb', line 357

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



363
364
365
# File 'lib/authentik/api/models/grant_request.rb', line 363

def hash
  [created, created_by, requester_data, fulfiller_data, revoked_by, agent_owner, is_active, expires, status, targets, target_objs, uuid].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/authentik/api/models/grant_request.rb', line 203

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

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

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

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

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

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

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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



392
393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/authentik/api/models/grant_request.rb', line 392

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



243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/authentik/api/models/grant_request.rb', line 243

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @created.nil?
  return false if @created_by.nil?
  return false if @revoked_by.nil?
  return false if @agent_owner.nil?
  return false if @is_active.nil?
  return false if @status.nil?
  return false if @targets.nil?
  return false if @target_objs.nil?
  true
end