Sha256: 4f04cfa80cfa373b122117bb0156007e82c56cacdc84bfe180f43d656eb7a54e

Contents?: true

Size: 659 Bytes

Versions: 3

Compression:

Stored size: 659 Bytes

Contents

class Acme::Resources::Authorization
  SimpleHttp = Acme::Resources::Challenges::SimpleHttp

  attr_reader :domain, :status, :simple_http

  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 'simpleHttp' then @simple_http = SimpleHttp.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

3 entries across 3 versions & 1 rubygems

Version Path
acme-client-0.1.2 lib/acme/resources/authorization.rb
acme-client-0.1.1 lib/acme/resources/authorization.rb
acme-client-0.1.0 lib/acme/resources/authorization.rb