Class: Acme::Client::Resources::Registration
- Inherits:
-
Object
- Object
- Acme::Client::Resources::Registration
- Defined in:
- lib/acme/client/resources/registration.rb
Instance Attribute Summary collapse
-
#contact ⇒ Object
readonly
Returns the value of attribute contact.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#next_uri ⇒ Object
readonly
Returns the value of attribute next_uri.
-
#recover_uri ⇒ Object
readonly
Returns the value of attribute recover_uri.
-
#term_of_service_uri ⇒ Object
readonly
Returns the value of attribute term_of_service_uri.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #agree_terms ⇒ Object
- #get_terms ⇒ Object
-
#initialize(client, response) ⇒ Registration
constructor
A new instance of Registration.
Constructor Details
#initialize(client, response) ⇒ Registration
Returns a new instance of Registration.
4 5 6 7 8 9 |
# File 'lib/acme/client/resources/registration.rb', line 4 def initialize(client, response) @client = client @uri = response.headers['location'] assign_links(response.headers['Link']) assign_attributes(response.body) end |
Instance Attribute Details
#contact ⇒ Object (readonly)
Returns the value of attribute contact.
2 3 4 |
# File 'lib/acme/client/resources/registration.rb', line 2 def contact @contact end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
2 3 4 |
# File 'lib/acme/client/resources/registration.rb', line 2 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
2 3 4 |
# File 'lib/acme/client/resources/registration.rb', line 2 def key @key end |
#next_uri ⇒ Object (readonly)
Returns the value of attribute next_uri.
2 3 4 |
# File 'lib/acme/client/resources/registration.rb', line 2 def next_uri @next_uri end |
#recover_uri ⇒ Object (readonly)
Returns the value of attribute recover_uri.
2 3 4 |
# File 'lib/acme/client/resources/registration.rb', line 2 def recover_uri @recover_uri end |
#term_of_service_uri ⇒ Object (readonly)
Returns the value of attribute term_of_service_uri.
2 3 4 |
# File 'lib/acme/client/resources/registration.rb', line 2 def term_of_service_uri @term_of_service_uri end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
2 3 4 |
# File 'lib/acme/client/resources/registration.rb', line 2 def uri @uri end |
Instance Method Details
#agree_terms ⇒ Object
17 18 19 20 21 22 |
# File 'lib/acme/client/resources/registration.rb', line 17 def agree_terms return true unless @term_of_service_uri response = @client.connection.post(@uri, resource: 'reg', agreement: @term_of_service_uri) response.success? end |
#get_terms ⇒ Object
11 12 13 14 15 |
# File 'lib/acme/client/resources/registration.rb', line 11 def get_terms return unless @term_of_service_uri @client.connection.get(@term_of_service_uri).body end |