Skip to content

Commit

Permalink
(WIP) changed naming, structure, added tests, README and types
Browse files Browse the repository at this point in the history
  • Loading branch information
renatosrounds committed Sep 25, 2024
1 parent c5d8764 commit dd7cac9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ Results:
developerEmail: '[email protected]',
developerWebsite: 'http://support.google.com/translate',
developerAddress: '1600 Amphitheatre Parkway, Mountain View 94043',
developerLegalName: undefined,
developerLegalEmail: undefined,
developerLegalAddress: undefined,
developerLegalPhoneNumber: undefined,
privacyPolicy: 'http://www.google.com/policies/privacy/',
developerInternalID: '5700313618786177705',
genre: 'Tools',
Expand Down
4 changes: 4 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ export interface IAppItemFullDetail extends IAppItem {
developerEmail: string
developerWebsite: string
developerAddress: string
developerLegalName: string
developerLegalEmail: string
developerLegalAddress: string
developerLegalPhoneNumber: string
genre: string
genreId: string
categories: Array<{
Expand Down
16 changes: 5 additions & 11 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,15 @@ const MAPPINGS = {
developerEmail: ['ds:5', 1, 2, 69, 1, 0],
developerWebsite: ['ds:5', 1, 2, 69, 0, 5, 2],
developerAddress: ['ds:5', 1, 2, 69, 2, 0],
aboutDeveloper: {
developerLegalName: ['ds:5', 1, 2, 69, 4, 0],
developerLegalEmail: ['ds:5', 1, 2, 69, 4, 1, 0],
developerLegalAddress: {
path: ['ds:5', 1, 2, 69],
fun: (searchArray) => {
const name = R.path([4, 0], searchArray);
const email = R.path([4, 1, 0], searchArray);
const address = R.path([4, 2, 0], searchArray).replace(/\n/g, ', ');
const phoneNumber = R.path([4, 3], searchArray);
return {
name,
email,
address,
phoneNumber
};
return R.path([4, 2, 0], searchArray)?.replace(/\n/g, ', ');
}
},
developerLegalPhoneNumber: ['ds:5', 1, 2, 69, 4, 3],
privacyPolicy: ['ds:5', 1, 2, 99, 0, 5, 2],
developerInternalID: {
path: ['ds:5', 1, 2, 68, 1, 4, 2],
Expand Down
10 changes: 10 additions & 0 deletions test/lib.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ describe('App method', () => {
});
});

it('should fetch the developer legal address, legal name, email and phone number', () => {
return gplay.app({ appId: 'com.taktak.browser' })
.then((app) => {
assert.equal(app.developerLegalName, 'AHREFS PTE. LTD.');
assert.equal(app.developerLegalAddress, '16 Raffles Quay #33-03 Hong Leong Building, Singapore 048581');
assert.equal(app.developerLegalEmail, '[email protected]');
assert.equal(app.developerLegalPhoneNumber, '+65 8372 0700');
});
});

it('should properly parse a VARY android version', () => {
return gplay.app({ appId: 'com.facebook.katana' })
.then((app) => {
Expand Down

0 comments on commit dd7cac9

Please sign in to comment.