Class: Acme::Resources::Challenges::SimpleHttp
- Inherits:
-
Object
- Object
- Acme::Resources::Challenges::SimpleHttp
- Defined in:
- lib/acme/resources/challenges/simple_http.rb
Constant Summary collapse
- CONTENT_TYPE =
'application/jose+json'
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#tls ⇒ Object
Returns the value of attribute tls.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #content_type ⇒ Object
- #file_content ⇒ Object
- #filename ⇒ Object
-
#initialize(client, attributes) ⇒ SimpleHttp
constructor
A new instance of SimpleHttp.
- #request_verification ⇒ Object
- #verify_status ⇒ Object
Constructor Details
#initialize(client, attributes) ⇒ SimpleHttp
Returns a new instance of SimpleHttp.
7 8 9 10 |
# File 'lib/acme/resources/challenges/simple_http.rb', line 7 def initialize(client, attributes) @client = client assign_attributes(attributes) end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
4 5 6 |
# File 'lib/acme/resources/challenges/simple_http.rb', line 4 def error @error end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/acme/resources/challenges/simple_http.rb', line 4 def status @status end |
#tls ⇒ Object
Returns the value of attribute tls.
5 6 7 |
# File 'lib/acme/resources/challenges/simple_http.rb', line 5 def tls @tls end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
4 5 6 |
# File 'lib/acme/resources/challenges/simple_http.rb', line 4 def token @token end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
4 5 6 |
# File 'lib/acme/resources/challenges/simple_http.rb', line 4 def uri @uri end |
Instance Method Details
#content_type ⇒ Object
12 13 14 |
# File 'lib/acme/resources/challenges/simple_http.rb', line 12 def content_type CONTENT_TYPE end |
#file_content ⇒ Object
16 17 18 19 |
# File 'lib/acme/resources/challenges/simple_http.rb', line 16 def file_content = { 'type' => 'simpleHttp', 'token' => token, 'tls' => tls } crypto.generate_signed_jws(header: {}, payload: ) end |
#filename ⇒ Object
21 22 23 |
# File 'lib/acme/resources/challenges/simple_http.rb', line 21 def filename ".well-known/acme-challenge/#{token}" end |
#request_verification ⇒ Object
25 26 27 28 |
# File 'lib/acme/resources/challenges/simple_http.rb', line 25 def request_verification response = @client.connection.post(@uri, { resource: 'challenge', type: 'simpleHttp', tls: tls }) response.success? end |
#verify_status ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/acme/resources/challenges/simple_http.rb', line 30 def verify_status response = @client.connection.get(@uri) assign_attributes(response.body) @error = response.body['error'] status end |