Class: Acme::Client::Resources::Order
- Inherits:
-
Object
- Object
- Acme::Client::Resources::Order
- Defined in:
- lib/acme/client/resources/order.rb
Instance Attribute Summary collapse
-
#authorization_urls ⇒ Object
readonly
Returns the value of attribute authorization_urls.
-
#certificate_url ⇒ Object
readonly
Returns the value of attribute certificate_url.
-
#contact ⇒ Object
readonly
Returns the value of attribute contact.
-
#expires ⇒ Object
readonly
Returns the value of attribute expires.
-
#finalize_url ⇒ Object
readonly
Returns the value of attribute finalize_url.
-
#identifiers ⇒ Object
readonly
Returns the value of attribute identifiers.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#replaces ⇒ Object
readonly
Returns the value of attribute replaces.
-
#retry_after ⇒ Object
readonly
Returns the value of attribute retry_after.
-
#retry_after_time ⇒ Object
readonly
Returns the value of attribute retry_after_time.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #authorizations ⇒ Object
- #certificate(force_chain: nil) ⇒ Object
- #finalize(csr:) ⇒ Object
-
#initialize(client, **arguments) ⇒ Order
constructor
A new instance of Order.
- #reload ⇒ Object
- #renew(replaces: nil, **arguments) ⇒ Object
- #renewal_info(certificate: nil, ari_id: nil) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(client, **arguments) ⇒ Order
Returns a new instance of Order.
6 7 8 9 |
# File 'lib/acme/client/resources/order.rb', line 6 def initialize(client, **arguments) @client = client assign_attributes(**arguments) end |
Instance Attribute Details
#authorization_urls ⇒ Object (readonly)
Returns the value of attribute authorization_urls.
4 5 6 |
# File 'lib/acme/client/resources/order.rb', line 4 def @authorization_urls end |
#certificate_url ⇒ Object (readonly)
Returns the value of attribute certificate_url.
4 5 6 |
# File 'lib/acme/client/resources/order.rb', line 4 def certificate_url @certificate_url end |
#contact ⇒ Object (readonly)
Returns the value of attribute contact.
4 5 6 |
# File 'lib/acme/client/resources/order.rb', line 4 def contact @contact end |
#expires ⇒ Object (readonly)
Returns the value of attribute expires.
4 5 6 |
# File 'lib/acme/client/resources/order.rb', line 4 def expires @expires end |
#finalize_url ⇒ Object (readonly)
Returns the value of attribute finalize_url.
4 5 6 |
# File 'lib/acme/client/resources/order.rb', line 4 def finalize_url @finalize_url end |
#identifiers ⇒ Object (readonly)
Returns the value of attribute identifiers.
4 5 6 |
# File 'lib/acme/client/resources/order.rb', line 4 def identifiers @identifiers end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
4 5 6 |
# File 'lib/acme/client/resources/order.rb', line 4 def profile @profile end |
#replaces ⇒ Object (readonly)
Returns the value of attribute replaces.
4 5 6 |
# File 'lib/acme/client/resources/order.rb', line 4 def replaces @replaces end |
#retry_after ⇒ Object (readonly)
Returns the value of attribute retry_after.
4 5 6 |
# File 'lib/acme/client/resources/order.rb', line 4 def retry_after @retry_after end |
#retry_after_time ⇒ Object (readonly)
Returns the value of attribute retry_after_time.
4 5 6 |
# File 'lib/acme/client/resources/order.rb', line 4 def retry_after_time @retry_after_time end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/acme/client/resources/order.rb', line 4 def status @status end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/acme/client/resources/order.rb', line 4 def url @url end |
Instance Method Details
#authorizations ⇒ Object
18 19 20 21 22 |
# File 'lib/acme/client/resources/order.rb', line 18 def @authorization_urls.map do || @client.(url: ) end end |
#certificate(force_chain: nil) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/acme/client/resources/order.rb', line 29 def certificate(force_chain: nil) if certificate_url @client.certificate(url: certificate_url, force_chain: force_chain) else raise Acme::Client::Error::CertificateNotReady, 'No certificate_url to collect the order' end end |
#finalize(csr:) ⇒ Object
24 25 26 27 |
# File 'lib/acme/client/resources/order.rb', line 24 def finalize(csr:) assign_attributes(**@client.finalize(url: finalize_url, csr: csr).to_h) true end |
#reload ⇒ Object
11 12 13 14 15 16 |
# File 'lib/acme/client/resources/order.rb', line 11 def reload raise Acme::Client::Error::OrderUrlNil, 'Cannot reload order with nil url.' if url.nil? assign_attributes(**@client.order(url: url).to_h) true end |
#renew(replaces: nil, **arguments) ⇒ Object
37 38 39 40 41 |
# File 'lib/acme/client/resources/order.rb', line 37 def renew(replaces: nil, **arguments) replaces ||= renewal_info.ari_id @client.new_order(replaces: replaces, **to_h.slice(:identifiers, :profile).merge(arguments)) end |
#renewal_info(certificate: nil, ari_id: nil) ⇒ Object
43 44 45 46 47 |
# File 'lib/acme/client/resources/order.rb', line 43 def renewal_info(certificate: nil, ari_id: nil) certificate ||= self.certificate if ari_id.nil? @client.renewal_info(certificate:, ari_id:) end |
#to_h ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/acme/client/resources/order.rb', line 49 def to_h { url: url, status: status, expires: expires, finalize_url: finalize_url, authorization_urls: , identifiers: identifiers, certificate_url: certificate_url, profile: profile, replaces: replaces, retry_after: retry_after } end |