mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 13:15:40 +02:00
Fix some CC issues
This commit is contained in:
parent
db50a89d85
commit
7edf48c885
4 changed files with 24 additions and 28 deletions
|
@ -15,7 +15,8 @@ module Repp
|
||||||
|
|
||||||
## GET /repp/v1/contacts/1
|
## GET /repp/v1/contacts/1
|
||||||
def show
|
def show
|
||||||
serializer = ::Serializers::Repp::Contact.new(@contact, show_address: Contact.address_processing?)
|
serializer = ::Serializers::Repp::Contact.new(@contact,
|
||||||
|
show_address: Contact.address_processing?)
|
||||||
render_success(data: serializer.to_json)
|
render_success(data: serializer.to_json)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -82,7 +83,8 @@ module Repp
|
||||||
return contacts.pluck(:code) unless details
|
return contacts.pluck(:code) unless details
|
||||||
|
|
||||||
contacts = contacts.map do |contact|
|
contacts = contacts.map do |contact|
|
||||||
serializer = ::Serializers::Repp::Contact.new(contact, show_address: Contact.address_processing?)
|
serializer = ::Serializers::Repp::Contact.new(contact,
|
||||||
|
show_address: Contact.address_processing?)
|
||||||
serializer.to_json
|
serializer.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ module Repp
|
||||||
params.permit(data: [
|
params.permit(data: [
|
||||||
:type, :id,
|
:type, :id,
|
||||||
{ domains: [],
|
{ domains: [],
|
||||||
attributes: [:hostname, { ipv4: [], ipv6: [] }] },
|
attributes: [:hostname, { ipv4: [], ipv6: [] }] }
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
BIN
lib/serializers/registrant_api/.DS_Store
vendored
Normal file
BIN
lib/serializers/registrant_api/.DS_Store
vendored
Normal file
Binary file not shown.
|
@ -8,35 +8,29 @@ module Serializers
|
||||||
@show_address = show_address
|
@show_address = show_address
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_json
|
def to_json(_obj)
|
||||||
json = {
|
json = { id: contact.code, name: contact.name, ident: ident,
|
||||||
id: contact.code,
|
email: contact.email, phone: contact.phone, fax: contact.fax,
|
||||||
name: contact.name,
|
auth_info: contact.auth_info, statuses: contact.statuses,
|
||||||
ident: {
|
disclosed_attributes: contact.disclosed_attributes }
|
||||||
code: contact.ident,
|
|
||||||
type: contact.ident_type,
|
|
||||||
country_code: contact.ident_country_code,
|
|
||||||
},
|
|
||||||
email: contact.email,
|
|
||||||
phone: contact.phone,
|
|
||||||
fax: contact.fax,
|
|
||||||
auth_info: contact.auth_info,
|
|
||||||
statuses: contact.statuses,
|
|
||||||
disclosed_attributes: contact.disclosed_attributes,
|
|
||||||
}
|
|
||||||
|
|
||||||
return json unless @show_address
|
json[:address] = address if @show_address
|
||||||
|
|
||||||
json[:address] = {
|
|
||||||
street: contact.street,
|
|
||||||
zip: contact.zip,
|
|
||||||
city: contact.city,
|
|
||||||
state: contact.state,
|
|
||||||
country_code: contact.country_code,
|
|
||||||
}
|
|
||||||
|
|
||||||
json
|
json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ident
|
||||||
|
{
|
||||||
|
code: contact.ident,
|
||||||
|
type: contact.ident_type,
|
||||||
|
country_code: contact.ident_country_code,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def address
|
||||||
|
{ street: contact.street, zip: contact.zip, city: contact.city,
|
||||||
|
state: contact.state, country_code: contact.country_code }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue