Class: Acme::Client::Resources::Authorization

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, **arguments) ⇒ Authorization

Returns a new instance of Authorization.



6
7
8
9
# File 'lib/acme/client/resources/authorization.rb', line 6

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

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



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

def domain
  @domain
end

#expiresObject (readonly)

Returns the value of attribute expires.



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

def expires
  @expires
end

#identifierObject (readonly)

Returns the value of attribute identifier.



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

def identifier
  @identifier
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

#wildcardObject (readonly)

Returns the value of attribute wildcard.



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

def wildcard
  @wildcard
end

Instance Method Details

#challengesObject



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

def challenges
  @challenges.map do |challenge|
    initialize_challenge(challenge)
  end
end

#deactivateObject



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

def deactivate
  assign_attributes(**@client.deactivate_authorization(url: url).to_h)
  true
end

#dns01Object Also known as: dns



34
35
36
37
38
# File 'lib/acme/client/resources/authorization.rb', line 34

def dns01
  @dns01 ||= challenges.find { |challenge|
    challenge.is_a?(Acme::Client::Resources::Challenges::DNS01)
  }
end

#http01Object Also known as: http



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

def http01
  @http01 ||= challenges.find { |challenge|
    challenge.is_a?(Acme::Client::Resources::Challenges::HTTP01)
  }
end

#reloadObject



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

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

#to_hObject



41
42
43
44
45
46
47
48
49
50
# File 'lib/acme/client/resources/authorization.rb', line 41

def to_h
  {
    url: url,
    identifier: identifier,
    status: status,
    expires: expires,
    challenges: @challenges,
    wildcard: wildcard
  }
end