Skip to content

Commit 2d29ee4

Browse files
committed
Done requests changes
1 parent 24ea970 commit 2d29ee4

File tree

5 files changed

+47
-113
lines changed

5 files changed

+47
-113
lines changed

components/bigdatacorp/actions/get-address-data/get-address-data.mjs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,37 @@ import constants from "../../common/constants.mjs";
44
export default {
55
key: "bigdatacorp-get-address-data",
66
name: "Get Address Data",
7-
description: "Returns the available data for a CEP number according to the selected dataset. [See the documentation](https://docs.bigdatacorp.com.br/plataforma/reference/enderecos_legal_amazon)",
7+
description: "Returns the available data for a Zipcode number according to the selected dataset. [See the documentation](https://docs.bigdatacorp.com.br/plataforma/reference/enderecos_legal_amazon)",
88
version: "0.0.1",
99
type: "action",
1010
props: {
1111
app,
12-
zipcode: {
12+
doc: {
1313
propDefinition: [
1414
app,
15-
"zipcode",
15+
"doc"
1616
],
17+
description: "Zipcode of the address you want to search for, i.e.: `88048-656`"
1718
},
1819
dataset: {
1920
propDefinition: [
2021
app,
21-
"dataset",
22+
"dataset"
2223
],
2324
options: constants.ADDRESS_DATASETS,
24-
},
25+
}
2526
},
2627

2728
async run({ $ }) {
2829
const response = await this.app.getAddressData({
2930
$,
3031
data: {
3132
Datasets: this.dataset,
32-
q: `zipcode{${this.zipcode}}`,
33-
34-
},
33+
q: `zipcode{${this.doc}}`,
34+
}
3535
});
3636

37-
$.export("$summary", `Successfully sent the request for the '${this.dataset}' dataset`);
37+
$.export("$summary", `Successfully sent the request for the '${this.dataset}' dataset. Status: ${response.Status[this.dataset][0].Message}`);
3838

3939
return response;
4040
},

components/bigdatacorp/actions/get-company-data/get-company-data.mjs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@ export default {
1212
doc: {
1313
propDefinition: [
1414
app,
15-
"doc",
15+
"doc"
1616
],
17+
description: "Document Number of the entity you want to search for, i.e.: `27.823.957/0001-94`"
1718
},
1819
dataset: {
1920
propDefinition: [
2021
app,
21-
"dataset",
22+
"dataset"
2223
],
2324
options: constants.COMPANY_DATASETS,
24-
},
25+
}
2526
},
2627

2728
async run({ $ }) {
@@ -30,10 +31,10 @@ export default {
3031
data: {
3132
Datasets: this.dataset,
3233
q: `doc{${this.doc}}`,
33-
},
34+
}
3435
});
3536

36-
$.export("$summary", `Successfully sent the request for the '${this.dataset}' dataset`);
37+
$.export("$summary", `Successfully sent the request for the '${this.dataset}' dataset. Status: ${response.Status[this.dataset][0].Message}`);
3738

3839
return response;
3940
},

components/bigdatacorp/actions/get-person-data/get-person-data.mjs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@ export default {
1212
doc: {
1313
propDefinition: [
1414
app,
15-
"doc",
15+
"doc"
1616
],
17+
description: "Document Number of the entity you want to search for, i.e.: `128.982.560-21`"
1718
},
1819
dataset: {
1920
propDefinition: [
2021
app,
21-
"dataset",
22+
"dataset"
2223
],
2324
options: constants.PERSON_DATASETS,
24-
},
25+
}
2526
},
2627

2728
async run({ $ }) {
@@ -30,10 +31,10 @@ export default {
3031
data: {
3132
Datasets: this.dataset,
3233
q: `doc{${this.doc}}`,
33-
},
34+
}
3435
});
3536

36-
$.export("$summary", `Successfully sent the request for the '${this.dataset}' dataset`);
37+
$.export("$summary", `Successfully sent the request for the '${this.dataset}' dataset. Status: ${response.Status[this.dataset][0].Message}`);
3738

3839
return response;
3940
},

components/bigdatacorp/bigdatacorp.app.mjs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,17 @@ export default {
77
doc: {
88
type: "string",
99
label: "Document Number",
10-
description: "Document Number of the entity you want to search for, i.e.: `128.982.560-21` for CPF, `27.823.957/0001-94` CNPJ and `88048-656` for CEP",
10+
description: "Document Number of the entity you want to search for",
1111
},
1212
dataset: {
1313
type: "string",
1414
label: "Dataset",
1515
description: "The target dataset to which the query will be sent",
1616
},
17-
zipcode: {
18-
type: "string",
19-
label: "Zipcode",
20-
description: "The postal code to search for",
21-
},
2217
},
2318
methods: {
2419
_baseUrl() {
25-
return "https://plataforma.bigdatacorp.com.br";
20+
return `https://plataforma.bigdatacorp.com.br`;
2621
},
2722
async _makeRequest(opts = {}) {
2823
const {
@@ -36,7 +31,7 @@ export default {
3631
url: this._baseUrl() + path,
3732
headers: {
3833
...headers,
39-
"Accept": "application/json",
34+
"Accept": `application/json`,
4035
"AccessToken": `${this.$auth.access_token}`,
4136
"TokenId": `${this.$auth.token_id}`,
4237
},
Lines changed: 23 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,29 @@
11
export default {
22
PERSON_DATASETS: [
3-
{
4-
"value": "emails_extended",
5-
"label": "Emails",
6-
},
7-
{
8-
"value": "phones_extended",
9-
"label": "Phones",
10-
},
11-
{
12-
"value": "registration_data",
13-
"label": "Registration Data",
14-
},
15-
{
16-
"value": "related_people_emails",
17-
"label": "Related People Emails",
18-
},
19-
{
20-
"value": "related_people_phones",
21-
"label": "Related People Phones",
22-
},
23-
{
24-
"value": "related_people_addresses",
25-
"label": "Related People Addresses",
26-
},
27-
{
28-
"value": "vehicles",
29-
"label": "Vehicles",
30-
},
3+
{ "value": "emails_extended", "label": "Emails" },
4+
{ "value": "phones_extended", "label": "Phones" },
5+
{ "value": "registration_data", "label": "Registration Data" },
6+
{ "value": "related_people_emails", "label": "Related People Emails" },
7+
{ "value": "related_people_phones", "label": "Related People Phones" },
8+
{ "value": "related_people_addresses", "label": "Related People Addresses" },
9+
{ "value": "vehicles", "label": "Vehicles" },
3110
],
3211
COMPANY_DATASETS: [
33-
{
34-
"value": "emails_extended",
35-
"label": "Emails",
36-
},
37-
{
38-
"value": "phones_extended",
39-
"label": "Phones",
40-
},
41-
{
42-
"value": "registration_data",
43-
"label": "Registration Data",
44-
},
45-
{
46-
"value": "related_people_emails",
47-
"label": "Related People Emails",
48-
},
49-
{
50-
"value": "related_people_phones",
51-
"label": "Related People Phones",
52-
},
53-
{
54-
"value": "related_people_addresses",
55-
"label": "Related People Addresses",
56-
},
57-
{
58-
"value": "political_involvement",
59-
"label": "Political Involvement",
60-
},
61-
{
62-
"value": "online_ads",
63-
"label": "Online Ads",
64-
},
12+
{ "value": "emails_extended", "label": "Emails" },
13+
{ "value": "phones_extended", "label": "Phones" },
14+
{ "value": "registration_data", "label": "Registration Data" },
15+
{ "value": "related_people_emails", "label": "Related People Emails" },
16+
{ "value": "related_people_phones", "label": "Related People Phones" },
17+
{ "value": "related_people_addresses", "label": "Related People Addresses" },
18+
{ "value": "political_involvement", "label": "Political Involvement" },
19+
{ "value": "online_ads", "label": "Online Ads" },
6520
],
6621
ADDRESS_DATASETS: [
67-
{
68-
"value": "legal_amazon",
69-
"label": "Legal Amazon",
70-
},
71-
{
72-
"value": "environmental_preservation_areas",
73-
"label": "Environmental Preservation Areas",
74-
},
75-
{
76-
"value": "biomes_data",
77-
"label": "Biomes Data",
78-
},
79-
{
80-
"value": "embargoed_areas",
81-
"label": "Embargoed Areas",
82-
},
83-
{
84-
"value": "legal_reserve",
85-
"label": "Legal Reserve",
86-
},
87-
{
88-
"value": "basic_data",
89-
"label": "Basic Data",
90-
},
91-
],
92-
};
22+
{ "value": "legal_amazon", "label": "Legal Amazon" },
23+
{ "value": "environmental_preservation_areas", "label": "Enviromental Preservation Areas" },
24+
{ "value": "biomes_data", "label": "Biomes Data" },
25+
{ "value": "embargoed_areas", "label": "Embargoed Areas" },
26+
{ "value": "legal_reserve", "label": "Legal Reserve" },
27+
{ "value": "basic_data", "label": "Basic Data" },
28+
]
29+
}

0 commit comments

Comments
 (0)