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(url, connection_options) ⇒ Directory

Returns a new instance of Directory.



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

def initialize(url, connection_options)
  @url, @connection_options = url, connection_options
end

Instance Method Details

#caa_identitiesObject



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

def caa_identities
  meta[DIRECTORY_META[:caa_identities]]
end

#endpoint_for(key) ⇒ Object



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

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



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

def 
  meta[DIRECTORY_META[:external_account_required]]
end

#metaObject



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

def meta
  directory[:meta]
end

#terms_of_serviceObject



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

def terms_of_service
  meta[DIRECTORY_META[:terms_of_service]]
end

#websiteObject



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

def website
  meta[DIRECTORY_META[:website]]
end