Fixed codeclimate errors

This commit is contained in:
Sergei Tsõganov 2022-06-06 16:12:16 +03:00
parent a5ffce290d
commit 7c570e2916
12 changed files with 114 additions and 103 deletions

View file

@ -10,13 +10,15 @@ module Serializers
@simplify = options[:simplify] || false
end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def to_json(obj = contact)
return simple_object if @simplify
json = { id: obj.uuid, code: obj.code, name: obj.name, ident: ident,
email: obj.email, phone: obj.phone, created_at: obj.created_at,
auth_info: obj.auth_info, statuses: statuses,
disclosed_attributes: obj.disclosed_attributes, registrar: registrar }
json = { id: obj.uuid, code: obj.code, name: obj.name, ident: ident, phone: obj.phone,
created_at: obj.created_at, auth_info: obj.auth_info, email: obj.email,
statuses: statuses, disclosed_attributes: obj.disclosed_attributes,
registrar: registrar }
json[:address] = address if @show_address
if @domain_params
json[:domains] = domains
@ -24,6 +26,8 @@ module Serializers
end
json
end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
def registrar
contact.registrar.as_json(only: %i[name website])

View file

@ -9,6 +9,7 @@ module Serializers
@simplify = simplify
end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def to_json(obj = domain)
return simple_object if @simplify
@ -26,6 +27,7 @@ module Serializers
json[:transfer_code] = obj.auth_info if @sponsored
json
end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
def contacts

View file

@ -8,6 +8,8 @@ module Serializers
@simplify = simplify
end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def to_json(obj = invoice)
return simple_object if @simplify
@ -29,16 +31,11 @@ module Serializers
def seller
{
name: invoice.seller_name,
reg_no: invoice.seller_reg_no,
iban: invoice.seller_iban,
bank: invoice.seller_bank,
swift: invoice.seller_swift,
vat_no: invoice.seller_vat_no,
address: invoice.seller_address,
country: invoice.seller_country.name,
phone: invoice.seller_phone,
url: invoice.seller_url,
name: invoice.seller_name, reg_no: invoice.seller_reg_no,
iban: invoice.seller_iban, bank: invoice.seller_bank,
swift: invoice.seller_swift, vat_no: invoice.seller_vat_no,
address: invoice.seller_address, country: invoice.seller_country.name,
phone: invoice.seller_phone, url: invoice.seller_url,
email: invoice.seller_email,
contact_name: invoice.seller_contact_name,
}
@ -80,6 +77,8 @@ module Serializers
recipient: invoice.buyer.billing_email,
}
end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
end
end
end