Class: Acme::Client::Resources::Directory

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

Constant Summary collapse

DIRECTORY_RESOURCES =
{
  new_nonce: 'newNonce',
  new_account: 'newAccount',
  new_order: 'newOrder',
  new_authz: 'newAuthz',
  revoke_certificate: 'revokeCert',
  key_change: 'keyChange'
}
DIRECTORY_META =
{
  terms_of_service: 'termsOfService',
  website: 'website',
  caa_identities: 'caaIdentities',
  external_account_required: 'externalAccountRequired'
}

Instance Method Summary collapse

Constructor Details

#initialize(client, **arguments) ⇒ Directory

Returns a new instance of Directory.



20
21
22
23
# File 'lib/acme/client/resources/directory.rb', line 20

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

Instance Method Details

#caa_identitiesObject



40
41
42
# File 'lib/acme/client/resources/directory.rb', line 40

def caa_identities
  meta[DIRECTORY_META[:caa_identities]]
end

#endpoint_for(key) ⇒ Object



25
26
27
28
29
30
# File 'lib/acme/client/resources/directory.rb', line 25

def endpoint_for(key)
  @directory.fetch(key) do |missing_key|
    raise Acme::Client::Error::UnsupportedOperation,
      "Directory at #{@url} does not include `#{missing_key}`"
  end
end

#external_account_requiredObject



44
45
46
# File 'lib/acme/client/resources/directory.rb', line 44

def 
  meta[DIRECTORY_META[:external_account_required]]
end

#metaObject



48
49
50
# File 'lib/acme/client/resources/directory.rb', line 48

def meta
  @directory[:meta]
end

#terms_of_serviceObject



32
33
34
# File 'lib/acme/client/resources/directory.rb', line 32

def terms_of_service
  meta[DIRECTORY_META[:terms_of_service]]
end

#websiteObject



36
37
38
# File 'lib/acme/client/resources/directory.rb', line 36

def website
  meta[DIRECTORY_META[:website]]
end