mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 21:54:48 +02:00
Fix some CC issues
This commit is contained in:
parent
db50a89d85
commit
7edf48c885
4 changed files with 24 additions and 28 deletions
|
@ -8,35 +8,29 @@ module Serializers
|
|||
@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,
|
||||
}
|
||||
def to_json(_obj)
|
||||
json = { id: contact.code, name: contact.name, ident: ident,
|
||||
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[:address] = address if @show_address
|
||||
|
||||
json
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue