class Acme::Resources::Registration
def agree_terms
def agree_terms if @term_of_service_uri payload = { resource: "reg", agreement: @term_of_service_uri } response = @client.connection.post(@uri, { resource: 'reg', agreement: @term_of_service_uri }) response.success? else true end end
def assign_attributes(body)
def assign_attributes(body) @id = body['id'] @key = body['key'] @contact = body['contact'] end
def assign_links(links)
def assign_links(links) @next_uri = links['next'] @recover_uri = links['recover'] @term_of_service_uri = links['terms-of-service'] end
def get_terms
def get_terms if @term_of_service_uri @client.connection.get(@term_of_service_uri).body end end
def initialize(client, response)
def initialize(client, response) @client = client @uri = response.headers['location'] assign_links(response.headers['Link']) assign_attributes(response.body) end