Sha256: 92bb7a3170ad71a2a2b6f08ad69800b003c1d4369d0e458f88b808b067e4deab

Contents?: true

Size: 923 Bytes

Versions: 1

Compression:

Stored size: 923 Bytes

Contents

class Acme::Client::Resources::Authorization
  HTTP01 = Acme::Client::Resources::Challenges::HTTP01
  DNS01 = Acme::Client::Resources::Challenges::DNS01
  TLSSNI01 = Acme::Client::Resources::Challenges::TLSSNI01

  attr_reader :domain, :status, :http01, :dns01, :tls_sni01

  def initialize(client, response)
    @client = client
    assign_challenges(response.body['challenges'])
    assign_attributes(response.body)
  end

  private

  def assign_challenges(challenges)
    challenges.each do |attributes|
      case attributes.fetch('type')
      when 'http-01' then @http01 = HTTP01.new(@client, attributes)
      when 'dns-01' then @dns01 = DNS01.new(@client, attributes)
      when 'tls-sni-01' then @tls_sni01 = TLSSNI01.new(@client, attributes)
      else
        # no supported
      end
    end
  end

  def assign_attributes(body)
    @domain = body['identifier']['value']
    @status = body['status']
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acme-client-0.2.4 lib/acme/client/resources/authorization.rb