Class: Acme::Client::Resources::Order

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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_urlsObject (readonly)

Returns the value of attribute authorization_urls.



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

def authorization_urls
  @authorization_urls
end

#certificate_urlObject (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

#contactObject (readonly)

Returns the value of attribute contact.



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

def contact
  @contact
end

#expiresObject (readonly)

Returns the value of attribute expires.



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

def expires
  @expires
end

#finalize_urlObject (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

#identifiersObject (readonly)

Returns the value of attribute identifiers.



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

def identifiers
  @identifiers
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#urlObject (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

#authorizationsObject



16
17
18
19
20
# File 'lib/acme/client/resources/order.rb', line 16

def authorizations
  @authorization_urls.map do |authorization_url|
    @client.authorization(url: authorization_url)
  end
end

#certificate(force_chain: nil) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/acme/client/resources/order.rb', line 27

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



22
23
24
25
# File 'lib/acme/client/resources/order.rb', line 22

def finalize(csr:)
  assign_attributes(**@client.finalize(url: finalize_url, csr: csr).to_h)
  true
end

#reloadObject



11
12
13
14
# File 'lib/acme/client/resources/order.rb', line 11

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

#to_hObject



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/acme/client/resources/order.rb', line 35

def to_h
  {
    url: url,
    status: status,
    expires: expires,
    finalize_url: finalize_url,
    authorization_urls: authorization_urls,
    identifiers: identifiers,
    certificate_url: certificate_url
  }
end