Class: NgrokAPI::Models::CertificateAuthority

Inherits:
Object
  • Object
show all
Defined in:
lib/ngrokapi/models/certificate_authority.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client: nil, attrs: {}) ⇒ CertificateAuthority

Returns a new instance of CertificateAuthority.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ngrokapi/models/certificate_authority.rb', line 24

def initialize(client: nil, attrs: {})
  @client = client
  @attrs = attrs
  @id = @attrs['id']
  unless @attrs['uri'].nil?
    @uri = URI(@attrs['uri'])
  end
  @created_at = @attrs['created_at']
  @description = @attrs['description']
  @metadata = @attrs['metadata']
  @ca_pem = @attrs['ca_pem']
  @subject_common_name = @attrs['subject_common_name']
  @not_before = @attrs['not_before']
  @not_after = @attrs['not_after']
  @key_usages = @attrs['key_usages']
  @extended_key_usages = @attrs['extended_key_usages']
end

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



10
11
12
# File 'lib/ngrokapi/models/certificate_authority.rb', line 10

def attrs
  @attrs
end

#ca_pemObject (readonly)

Returns the value of attribute ca_pem.



10
11
12
# File 'lib/ngrokapi/models/certificate_authority.rb', line 10

def ca_pem
  @ca_pem
end

#clientObject (readonly)

Returns the value of attribute client.



10
11
12
# File 'lib/ngrokapi/models/certificate_authority.rb', line 10

def client
  @client
end

#created_atObject (readonly)

Returns the value of attribute created_at.



10
11
12
# File 'lib/ngrokapi/models/certificate_authority.rb', line 10

def created_at
  @created_at
end

#descriptionObject (readonly)

Returns the value of attribute description.



10
11
12
# File 'lib/ngrokapi/models/certificate_authority.rb', line 10

def description
  @description
end

#extended_key_usagesObject (readonly)

Returns the value of attribute extended_key_usages.



10
11
12
# File 'lib/ngrokapi/models/certificate_authority.rb', line 10

def extended_key_usages
  @extended_key_usages
end

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/ngrokapi/models/certificate_authority.rb', line 10

def id
  @id
end

#key_usagesObject (readonly)

Returns the value of attribute key_usages.



10
11
12
# File 'lib/ngrokapi/models/certificate_authority.rb', line 10

def key_usages
  @key_usages
end

#metadataObject (readonly)

Returns the value of attribute metadata.



10
11
12
# File 'lib/ngrokapi/models/certificate_authority.rb', line 10

def 
  @metadata
end

#not_afterObject (readonly)

Returns the value of attribute not_after.



10
11
12
# File 'lib/ngrokapi/models/certificate_authority.rb', line 10

def not_after
  @not_after
end

#not_beforeObject (readonly)

Returns the value of attribute not_before.



10
11
12
# File 'lib/ngrokapi/models/certificate_authority.rb', line 10

def not_before
  @not_before
end

#subject_common_nameObject (readonly)

Returns the value of attribute subject_common_name.



10
11
12
# File 'lib/ngrokapi/models/certificate_authority.rb', line 10

def subject_common_name
  @subject_common_name
end

#uriObject (readonly)

Returns the value of attribute uri.



10
11
12
# File 'lib/ngrokapi/models/certificate_authority.rb', line 10

def uri
  @uri
end

Instance Method Details

#==(other) ⇒ Object



42
43
44
# File 'lib/ngrokapi/models/certificate_authority.rb', line 42

def ==(other)
  @attrs == other.attrs
end

#deleteObject



58
59
60
61
62
# File 'lib/ngrokapi/models/certificate_authority.rb', line 58

def delete
  @client.delete(
    id: @id
  )
end

#to_hObject



50
51
52
# File 'lib/ngrokapi/models/certificate_authority.rb', line 50

def to_h
  @attrs.to_h
end

#to_sObject



46
47
48
# File 'lib/ngrokapi/models/certificate_authority.rb', line 46

def to_s
  @attrs.to_s
end

#update(description: nil, metadata: nil) ⇒ Object

Update attributes of a Certificate Authority by ID

https://ngrok.com/docs/api#api-certificate-authorities-update



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/ngrokapi/models/certificate_authority.rb', line 68

def update(
  description: nil,
  metadata: nil
)
  @description = description if description
  @metadata =  if 
  @client.update(
    id: @id,
    description: description,
    metadata: 
  )
end