mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 05:26:17 +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
|
class ContactRequestsController < BaseController
|
||||||
before_action :authenticate_shared_key
|
before_action :authenticate_shared_key
|
||||||
|
|
||||||
# POST api/v1/contact_requests/
|
|
||||||
def create
|
def create
|
||||||
return head(:bad_request) if contact_request_params[:email].blank?
|
return head(:bad_request) if contact_request_params[:email].blank?
|
||||||
|
|
||||||
|
@ -19,6 +18,8 @@ module Api
|
||||||
process_id(params[:id])
|
process_id(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
def process_id(id)
|
def process_id(id)
|
||||||
record = ContactRequest.find_by(id: id)
|
record = ContactRequest.find_by(id: id)
|
||||||
return :not_found unless record
|
return :not_found unless record
|
||||||
|
|
|
@ -47,7 +47,7 @@ module Zone::WhoisQueryable
|
||||||
def registrant_vars
|
def registrant_vars
|
||||||
{ registrant: Setting.registry_juridical_name, registrant_reg_no: Setting.registry_reg_no,
|
{ registrant: Setting.registry_juridical_name, registrant_reg_no: Setting.registry_reg_no,
|
||||||
registrant_ident_country_code: Setting.registry_country_code, registrant_kind: 'org',
|
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
|
end
|
||||||
|
|
||||||
def contact_vars
|
def contact_vars
|
||||||
|
|
|
@ -15,15 +15,6 @@ class ContactRequest < ApplicationRecord
|
||||||
attr_readonly :secret,
|
attr_readonly :secret,
|
||||||
:valid_to
|
: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)
|
def update_record(params)
|
||||||
self.status = params['status'] if params['status']
|
self.status = params['status'] if params['status']
|
||||||
self.ip_address = params['ip'] if params['ip']
|
self.ip_address = params['ip'] if params['ip']
|
||||||
|
@ -31,11 +22,22 @@ class ContactRequest < ApplicationRecord
|
||||||
save!
|
save!
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_random_secret
|
class << self
|
||||||
SecureRandom.hex(64)
|
def save_record(params)
|
||||||
end
|
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
|
def create_random_secret
|
||||||
(Time.zone.now + 24.hours)
|
SecureRandom.hex(64)
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_valid_to_24_hours_from_now
|
||||||
|
(Time.zone.now + 24.hours)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,6 +51,7 @@ class WhoisRecord < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
h[:email] = registrant.email
|
h[:email] = registrant.email
|
||||||
|
h[:phone] = registrant.phone
|
||||||
h[:registrant_changed] = registrant.updated_at.try(:to_s, :iso8601)
|
h[:registrant_changed] = registrant.updated_at.try(:to_s, :iso8601)
|
||||||
h[:registrant_disclosed_attributes] = registrant.disclosed_attributes
|
h[:registrant_disclosed_attributes] = registrant.disclosed_attributes
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ Update contact.
|
||||||
| address[city] | false | String | | New city name |
|
| address[city] | false | String | | New city name |
|
||||||
| address[state] | false | String | | New state 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) |
|
| 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
|
#### Request
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue