Class: MistApi::ResponseCertificate

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/response_certificate.rb

Overview

If the current Org CA certificate is set to expire within 30 days, a pending certificate will be returned along with the expected auto-renewal timestamp.

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(cert = nil, pending_cert = SKIP, pending_cert_expiry = SKIP) ⇒ ResponseCertificate

Returns a new instance of ResponseCertificate.



47
48
49
50
51
# File 'lib/mist_api/models/response_certificate.rb', line 47

def initialize(cert = nil, pending_cert = SKIP, pending_cert_expiry = SKIP)
  @cert = cert
  @pending_cert = pending_cert unless pending_cert == SKIP
  @pending_cert_expiry = pending_cert_expiry unless pending_cert_expiry == SKIP
end

Instance Attribute Details

#certString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/mist_api/models/response_certificate.rb', line 15

def cert
  @cert
end

#pending_certString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/mist_api/models/response_certificate.rb', line 19

def pending_cert
  @pending_cert
end

#pending_cert_expiryInteger

TODO: Write general description for this method

Returns:

  • (Integer)


23
24
25
# File 'lib/mist_api/models/response_certificate.rb', line 23

def pending_cert_expiry
  @pending_cert_expiry
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/mist_api/models/response_certificate.rb', line 54

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  cert = hash.key?('cert') ? hash['cert'] : nil
  pending_cert = hash.key?('pending_cert') ? hash['pending_cert'] : SKIP
  pending_cert_expiry =
    hash.key?('pending_cert_expiry') ? hash['pending_cert_expiry'] : SKIP

  # Create object from extracted values.
  ResponseCertificate.new(cert,
                          pending_cert,
                          pending_cert_expiry)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/mist_api/models/response_certificate.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['cert'] = 'cert'
  @_hash['pending_cert'] = 'pending_cert'
  @_hash['pending_cert_expiry'] = 'pending_cert_expiry'
  @_hash
end

.nullablesObject

An array for nullable fields



43
44
45
# File 'lib/mist_api/models/response_certificate.rb', line 43

def self.nullables
  []
end

.optionalsObject

An array for optional fields



35
36
37
38
39
40
# File 'lib/mist_api/models/response_certificate.rb', line 35

def self.optionals
  %w[
    pending_cert
    pending_cert_expiry
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



77
78
79
80
81
# File 'lib/mist_api/models/response_certificate.rb', line 77

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} cert: #{@cert.inspect}, pending_cert: #{@pending_cert.inspect},"\
  " pending_cert_expiry: #{@pending_cert_expiry.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



70
71
72
73
74
# File 'lib/mist_api/models/response_certificate.rb', line 70

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} cert: #{@cert}, pending_cert: #{@pending_cert}, pending_cert_expiry:"\
  " #{@pending_cert_expiry}>"
end