Class: Acme::Client::Resources::Challenges::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/acme/client/resources/challenges/base.rb

Direct Known Subclasses

DNS01, HTTP01, Unsupported

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, **arguments) ⇒ Base

Returns a new instance of Base.



6
7
8
9
# File 'lib/acme/client/resources/challenges/base.rb', line 6

def initialize(client, **arguments)
  @client = client
  assign_attributes(**arguments)
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



4
5
6
# File 'lib/acme/client/resources/challenges/base.rb', line 4

def error
  @error
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/acme/client/resources/challenges/base.rb', line 4

def status
  @status
end

#tokenObject (readonly)

Returns the value of attribute token.



4
5
6
# File 'lib/acme/client/resources/challenges/base.rb', line 4

def token
  @token
end

#urlObject (readonly)

Returns the value of attribute url.



4
5
6
# File 'lib/acme/client/resources/challenges/base.rb', line 4

def url
  @url
end

Instance Method Details

#challenge_typeObject



11
12
13
# File 'lib/acme/client/resources/challenges/base.rb', line 11

def challenge_type
  self.class::CHALLENGE_TYPE
end

#key_authorizationObject



15
16
17
# File 'lib/acme/client/resources/challenges/base.rb', line 15

def key_authorization
  "#{token}.#{@client.jwk.thumbprint}"
end

#reloadObject



19
20
21
22
# File 'lib/acme/client/resources/challenges/base.rb', line 19

def reload
  assign_attributes(**@client.challenge(url: url).to_h)
  true
end

#request_validationObject



24
25
26
27
28
29
# File 'lib/acme/client/resources/challenges/base.rb', line 24

def request_validation
  assign_attributes(**send_challenge_validation(
    url: url
  ))
  true
end

#to_hObject



31
32
33
# File 'lib/acme/client/resources/challenges/base.rb', line 31

def to_h
  { status: status, url: url, token: token, error: error }
end