mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 21:16:12 +02:00
Add registrant phone to whois record json
This commit is contained in:
parent
3401a9fc47
commit
5c70e9f38b
5 changed files with 21 additions and 17 deletions
|
@ -3,7 +3,6 @@ module Api
|
|||
class ContactRequestsController < BaseController
|
||||
before_action :authenticate_shared_key
|
||||
|
||||
# POST api/v1/contact_requests/
|
||||
def create
|
||||
return head(:bad_request) if contact_request_params[:email].blank?
|
||||
|
||||
|
@ -19,6 +18,8 @@ module Api
|
|||
process_id(params[:id])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def process_id(id)
|
||||
record = ContactRequest.find_by(id: id)
|
||||
return :not_found unless record
|
||||
|
|
|
@ -47,7 +47,7 @@ module Zone::WhoisQueryable
|
|||
def registrant_vars
|
||||
{ registrant: Setting.registry_juridical_name, registrant_reg_no: Setting.registry_reg_no,
|
||||
registrant_ident_country_code: Setting.registry_country_code, registrant_kind: 'org',
|
||||
registrant_disclosed_attributes: %w[name email] }
|
||||
registrant_disclosed_attributes: %w[name email phone] }
|
||||
end
|
||||
|
||||
def contact_vars
|
||||
|
|
|
@ -15,15 +15,6 @@ class ContactRequest < ApplicationRecord
|
|||
attr_readonly :secret,
|
||||
:valid_to
|
||||
|
||||
def self.save_record(params)
|
||||
contact_request = new(params)
|
||||
contact_request.secret = create_random_secret
|
||||
contact_request.valid_to = set_valid_to_24_hours_from_now
|
||||
contact_request.status = STATUS_NEW
|
||||
contact_request.save!
|
||||
contact_request
|
||||
end
|
||||
|
||||
def update_record(params)
|
||||
self.status = params['status'] if params['status']
|
||||
self.ip_address = params['ip'] if params['ip']
|
||||
|
@ -31,11 +22,22 @@ class ContactRequest < ApplicationRecord
|
|||
save!
|
||||
end
|
||||
|
||||
def self.create_random_secret
|
||||
SecureRandom.hex(64)
|
||||
end
|
||||
class << self
|
||||
def save_record(params)
|
||||
contact_request = new(params)
|
||||
contact_request.secret = create_random_secret
|
||||
contact_request.valid_to = set_valid_to_24_hours_from_now
|
||||
contact_request.status = STATUS_NEW
|
||||
contact_request.save!
|
||||
contact_request
|
||||
end
|
||||
|
||||
def self.set_valid_to_24_hours_from_now
|
||||
(Time.zone.now + 24.hours)
|
||||
def create_random_secret
|
||||
SecureRandom.hex(64)
|
||||
end
|
||||
|
||||
def set_valid_to_24_hours_from_now
|
||||
(Time.zone.now + 24.hours)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -51,6 +51,7 @@ class WhoisRecord < ApplicationRecord
|
|||
end
|
||||
|
||||
h[:email] = registrant.email
|
||||
h[:phone] = registrant.phone
|
||||
h[:registrant_changed] = registrant.updated_at.try(:to_s, :iso8601)
|
||||
h[:registrant_disclosed_attributes] = registrant.disclosed_attributes
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ Update contact.
|
|||
| address[city] | false | String | | New city name |
|
||||
| address[state] | false | String | | New state name |
|
||||
| address[country_code] | false | String | | New country code in 2 letter format (ISO 3166-1 alpha-2) |
|
||||
| disclosed_attributes | false | Array | | Possible values: "name", "email"
|
||||
| disclosed_attributes | false | Array | | Possible values: "name", "email", "phone"
|
||||
|
||||
|
||||
#### Request
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue