mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 10:45:58 +02:00
REPP: Hide contact internal ID
This commit is contained in:
parent
fc816ad67b
commit
3d0150076c
3 changed files with 53 additions and 7 deletions
42
lib/serializers/repp/contact.rb
Normal file
42
lib/serializers/repp/contact.rb
Normal file
|
@ -0,0 +1,42 @@
|
|||
module Serializers
|
||||
module Repp
|
||||
class Contact
|
||||
attr_reader :contact
|
||||
|
||||
def initialize(contact, show_address:)
|
||||
@contact = contact
|
||||
@show_address = show_address
|
||||
end
|
||||
|
||||
def to_json
|
||||
json = {
|
||||
id: contact.code,
|
||||
name: contact.name,
|
||||
ident: {
|
||||
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] = {
|
||||
street: contact.street,
|
||||
zip: contact.zip,
|
||||
city: contact.city,
|
||||
state: contact.state,
|
||||
country_code: contact.country_code,
|
||||
}
|
||||
|
||||
json
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue