Skip to content

Commit

Permalink
Merge pull request #1876 from internetee/extended_response_from_regis…
Browse files Browse the repository at this point in the history
…trant_data_api

API: addeed extended data from registrant
  • Loading branch information
vohmar authored Mar 10, 2021
2 parents 57c27de + 0c22107 commit 2b07ac7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
5 changes: 5 additions & 0 deletions lib/serializers/registrant_api/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ def to_json(_obj = nil)
registrant: {
name: domain.registrant.name,
id: domain.registrant.uuid,
ident: domain.registrant.ident,
ident_type: domain.registrant.ident_type,
ident_country_code: domain.registrant.ident_country_code,
phone: domain.registrant.phone,
email: domain.registrant.email,
org: domain.registrant.org?,
},
tech_contacts: contacts(:tech),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ def test_get_domain_details_by_uuid

assert_equal('hospital.test', domain[:name])
assert_equal('5edda1a5-3548-41ee-8b65-6d60daf85a37', domain[:id])
assert_equal({name: 'John', id: 'eb2f2766-b44c-4e14-9f16-32ab1a7cb957', org: false}, domain[:registrant])
assert_equal({:name=>"John",
:id=>"eb2f2766-b44c-4e14-9f16-32ab1a7cb957",
:ident=>"1234", :ident_type=>"priv",
:ident_country_code=>"US",
:phone=>"+555.555",
:email=>"john@inbox.test",
:org=>false},
domain[:registrant])
assert_equal([{name: 'John',
id: 'eb2f2766-b44c-4e14-9f16-32ab1a7cb957',
email: 'john@inbox.test'}],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,15 @@ def test_locking_domains_returns_serialized_domain_object
response_json = JSON.parse(response.body, symbolize_names: true)

assert_equal({ name: 'Best Names', website: 'https://bestnames.test' }, response_json[:registrar])
assert_equal({name: 'John', id: 'eb2f2766-b44c-4e14-9f16-32ab1a7cb957', org: false}, response_json[:registrant])
assert_equal({:name=>"John",
:id=>"eb2f2766-b44c-4e14-9f16-32ab1a7cb957",
:ident=>"1234",
:ident_type=>"priv",
:ident_country_code=>"US",
:phone=>"+555.555",
:email=>"john@inbox.test",
:org=>false},
response_json[:registrant])
assert_equal([{name: 'Jane',
id: '9db3de62-2414-4487-bee2-d5c155567768',
email: 'jane@mail.test'
Expand Down
9 changes: 8 additions & 1 deletion test/lib/serializers/registrant_api/domain_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ def test_returns_registrar_name
end

def test_returns_registrant_name_uuid_and_org
assert_equal({name: 'John', id: 'eb2f2766-b44c-4e14-9f16-32ab1a7cb957', org: false},
assert_equal({:name=>"John",
:id=>"eb2f2766-b44c-4e14-9f16-32ab1a7cb957",
:ident=>"1234",
:ident_type=>"priv",
:ident_country_code=>"US",
:phone=>"+555.555",
:email=>"john@inbox.test",
:org=>false},
@json[:registrant])
end

Expand Down

0 comments on commit 2b07ac7

Please sign in to comment.