opengate-js 12.1.1 → 12.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/bower.json +1 -1
  2. package/dist/{opengate-api-bower-12.1.1.js → opengate-api-bower-12.2.0.js} +28 -18
  3. package/dist/opengate-api-bower-12.2.0.js.map +1 -0
  4. package/dist/{opengate-api-bower-12.1.1.min.js → opengate-api-bower-12.2.0.min.js} +34 -34
  5. package/dist/{opengate-api-bower-12.1.1.min.js.map → opengate-api-bower-12.2.0.min.js.map} +1 -1
  6. package/dist/src/GenericFinder.js +1 -0
  7. package/dist/src/GenericFinder.js.map +1 -1
  8. package/dist/src/provision/BaseProvision.js +2 -0
  9. package/dist/src/provision/BaseProvision.js.map +1 -1
  10. package/dist/src/searching/BaseSearch.js +1 -0
  11. package/dist/src/searching/BaseSearch.js.map +1 -1
  12. package/dist/src/searching/builder/HardwaresSearchBuilder.js +5 -5
  13. package/dist/src/searching/builder/HardwaresSearchBuilder.js.map +1 -1
  14. package/dist/src/users/Users.js +3 -3
  15. package/dist/src/util/NorthAmpliaREST.js +6 -0
  16. package/dist/src/util/NorthAmpliaREST.js.map +1 -1
  17. package/docs/ast/source/GenericFinder.js.json +4504 -4504
  18. package/docs/ast/source/provision/BaseProvision.js.json +9643 -9643
  19. package/docs/ast/source/searching/BaseSearch.js.json +7981 -7981
  20. package/docs/ast/source/searching/builder/HardwaresSearchBuilder.js.json +505 -505
  21. package/docs/ast/source/users/Users.js.json +7 -7
  22. package/docs/ast/source/util/NorthAmpliaREST.js.json +10803 -10803
  23. package/docs/class/src/GenericFinder.js~GenericFinder.html +10 -3
  24. package/docs/class/src/provision/BaseProvision.js~BaseProvision.html +19 -6
  25. package/docs/class/src/searching/BaseSearch.js~BaseSearch.html +15 -8
  26. package/docs/class/src/searching/builder/HardwaresSearchBuilder.js~HardwaresSearchBuilder.html +37 -2
  27. package/docs/class/src/searching/builder/SearchBuilder.js~SearchBuilder.html +2 -2
  28. package/docs/class/src/searching/builder/SearchWithSummaryBuilder.js~SearchWithSummaryBuilder.html +1 -1
  29. package/docs/class/src/users/Users.js~User.html +34 -34
  30. package/docs/class/src/util/NorthAmpliaREST.js~NorthAmpliaREST.html +61 -19
  31. package/docs/class/src/util/SouthAmpliaREST.js~SouthAmpliaREST.html +6 -6
  32. package/docs/coverage.json +2 -2
  33. package/docs/dump.json +189 -89
  34. package/docs/file/src/GenericFinder.js.html +1 -0
  35. package/docs/file/src/provision/BaseProvision.js.html +2 -0
  36. package/docs/file/src/searching/BaseSearch.js.html +1 -0
  37. package/docs/file/src/searching/builder/HardwaresSearchBuilder.js.html +2 -2
  38. package/docs/file/src/users/Users.js.html +2 -2
  39. package/docs/file/src/util/NorthAmpliaREST.js.html +6 -0
  40. package/docs/package.json +1 -1
  41. package/docs/script/search_index.js +6 -6
  42. package/docs/source.html +231 -231
  43. package/features/features/provision/analytics/create_delete_analytics.feature +0 -1
  44. package/features/features/provision/users/reset_password.feature +3 -3
  45. package/features/features/provision/users/reset_password_mock.feature +0 -1
  46. package/features/step_definitions/when_step_definitions.js +39 -37
  47. package/features/support/hooks.js +11 -10
  48. package/features/support/world.js +1 -2
  49. package/package.json +1 -1
  50. package/src/GenericFinder.js +1 -0
  51. package/src/provision/BaseProvision.js +2 -0
  52. package/src/searching/BaseSearch.js +1 -0
  53. package/src/searching/builder/HardwaresSearchBuilder.js +2 -2
  54. package/src/users/Users.js +2 -2
  55. package/src/util/NorthAmpliaREST.js +6 -0
  56. package/dist/opengate-api-bower-12.1.1.js.map +0 -1
@@ -1,7 +1,6 @@
1
1
  # features/features/provision/analytics/create_delete_analytics.feature
2
2
  @create_provision
3
3
  @provision
4
- @wip
5
4
 
6
5
  Feature: Delete and Create an analytics pipeline
7
6
  As a user of JsApi
@@ -2,7 +2,7 @@
2
2
  @provision
3
3
  @users
4
4
  @resetpassword
5
- #@wip
5
+ @wip
6
6
 
7
7
  Feature: Reset password when the user forgets it
8
8
  As a user of JsApi
@@ -11,7 +11,7 @@ Feature: Reset password when the user forgets it
11
11
 
12
12
  @guerrilla
13
13
  Scenario: Precondition - Prepare scenario
14
- Given an apikey user by "require-real-apikey"
14
+ Given an apikey user by "1e0a6fa7-d770-4072-ab4e-f98581522a65"
15
15
  Then an ogapi "organizations builder" util
16
16
  And I want to create a "organization"
17
17
  And the "name" "resetPasswordOrganization"
@@ -59,7 +59,7 @@ Feature: Reset password when the user forgets it
59
59
  Then response code should be: 200
60
60
 
61
61
  Scenario: Delete an user that already exists
62
- Given an apikey user by "require-real-apikey"
62
+ Given an apikey user by "1e0a6fa7-d770-4072-ab4e-f98581522a65"
63
63
  Then an ogapi "users builder" util
64
64
  And I want to delete a "user"
65
65
  And the "email" "ogapi@guerrillamailblock.com"
@@ -2,7 +2,6 @@
2
2
  @provision
3
3
  @users
4
4
  @resetpassword
5
- #@wip
6
5
 
7
6
  Feature: Reset password when the user forgets it
8
7
  As a user of JsApi
@@ -1,6 +1,5 @@
1
1
  // features/step_definitions/when_step_definitions.js
2
- var OpengateAPI = require(process.cwd() + '/dist/opengate-api-npm');
3
- inspet = require('util').inspect;
2
+ var request = require('superagent')
4
3
  var GenericFinder = require(process.cwd() + '/dist/src/GenericFinder');
5
4
  var {
6
5
  When,
@@ -948,7 +947,7 @@ When(/^I read reset password mail and save token mock$/, function () {
948
947
 
949
948
  When(/^I read reset password mail and save token$/, { timeout: 30000 }, async function () {
950
949
  var _this = this;
951
- this.ogapiFG = new OpengateAPI({url: this.guerrillaApi})
950
+
952
951
  await new Promise(async (callback, error) => {
953
952
  _this.error = undefined;
954
953
  _this.responseData = undefined;
@@ -969,39 +968,44 @@ When(/^I read reset password mail and save token$/, { timeout: 30000 }, async fu
969
968
  }
970
969
 
971
970
  try {
972
- this.ogapiFG.Napi
973
- .get(_this.guerillaPath, undefined, undefined, {
974
- f: setEmailUserUrl,
975
- email_user: configUserEmail.email_user,
976
- lang: 'en'
977
- }
978
- )
979
- .then((response) => {
971
+ request.get(_this.guerrillaApi).query({
972
+ f: setEmailUserUrl,
973
+ email_user: configUserEmail.email_user,
974
+ lang: 'en'
975
+ }).end((err, response) => {
976
+ if(err){
977
+ console.log(err);
978
+ _this.error = err;
979
+ error(JSON.stringify(err));
980
+ }else{
980
981
  configUserEmail.sid_token = response.body.sid_token
981
- this.ogapiFG.Napi
982
- .get(_this.guerillaPath, undefined, undefined, {
983
- f: getEmailListUrl,
984
- offset: 0,
985
- sid_token: configUserEmail.sid_token
986
- }
987
- )
988
- .then((response) => {
982
+ request.get(_this.guerrillaApi).query(
983
+ {
984
+ f: getEmailListUrl,
985
+ offset: 0,
986
+ sid_token: configUserEmail.sid_token
987
+ }
988
+ )
989
+ .end((err, response) => {
990
+ if(err){
991
+ console.log(err);
992
+ _this.error = err;
993
+ error(JSON.stringify(err));
994
+ }else{
989
995
  const list = response.body && response.body.list || []
990
996
  const email = list[0]
991
997
  configUserEmail.email_id = email && email.mail_id
992
- this.ogapiFG.Napi
993
- .get(_this.guerillaPath, undefined, undefined, {
994
- f: fetchEmailUrl,
995
- email_id: configUserEmail.email_id,
996
- sid_token: configUserEmail.sid_token
997
- }
998
- )
999
- .catch((err) => {
998
+ request.get(_this.guerrillaApi).query({
999
+ f: fetchEmailUrl,
1000
+ email_id: configUserEmail.email_id,
1001
+ sid_token: configUserEmail.sid_token
1002
+ })
1003
+ .end((err, response) => {
1004
+ if(err){
1000
1005
  console.log(err);
1001
1006
  _this.error = err;
1002
1007
  error(JSON.stringify(err))
1003
- })
1004
- .then((response) => {
1008
+ }else{
1005
1009
  const getEmail = response.body.mail_body || ''
1006
1010
  const getToken = getEmail.match(/tokenId=([^&>;]*)"/) && getEmail.match(/tokenId=([^&>;]*)"/)[1];
1007
1011
  if (!getToken) {
@@ -1009,14 +1013,12 @@ When(/^I read reset password mail and save token$/, { timeout: 30000 }, async fu
1009
1013
  }
1010
1014
  _this.values.token = getToken;
1011
1015
  callback();
1012
- })
1013
- })
1014
- })
1015
- .catch((err) => {
1016
- console.log(err);
1017
- _this.error = err;
1018
- error(JSON.stringify(err));
1019
- })
1016
+ }
1017
+ })
1018
+ }
1019
+ })
1020
+ }
1021
+ })
1020
1022
  } catch (err) {
1021
1023
  console.log(err);
1022
1024
  _this.error = err;
@@ -1,21 +1,22 @@
1
1
  var { Before } = require('cucumber');
2
- var OpengateAPI = require(process.cwd() + '/dist/opengate-api-npm');
2
+ const request = require('superagent');
3
3
 
4
4
  Before({tags: "@guerrilla"}, async function (){
5
- this.ogapiFG = new OpengateAPI({url: this.guerrillaApi})
6
5
  const _this = this
7
6
  await new Promise(async (callback, error) => {
8
- this.ogapiFG.Napi.get(_this.guerillaPath, undefined, undefined, {
7
+ request.get(_this.guerrillaApi).query({
9
8
  f: 'set_email_address',
10
9
  email_user: 'ogapi',
11
10
  lang: 'en'
12
- }).then((response) => {
13
- console.log('RESPONSE: ', response)
14
- callback()
15
- }).catch((err) => {
16
- console.log(err);
17
- _this.error = err;
18
- error(err)
11
+ }).end((err, response) => {
12
+ if(err){
13
+ console.log(err);
14
+ _this.error = err;
15
+ error(err)
16
+ }else {
17
+ console.log('RESPONSE: ', response)
18
+ callback()
19
+ }
19
20
  })
20
21
  })
21
22
  })
@@ -17,8 +17,7 @@ function World() {
17
17
  this.test_url_north = process.env.API_NORTH_INTERNAL || 'API_NORTH_INTERNAL';
18
18
  this.test_url_south = process.env.API_SOUTH_INTERNAL || 'API_SOUTH_INTERNAL';
19
19
  this.apikey = process.env.API_KEY || 'API_KEY';
20
- this.guerrillaApi = 'https://api.guerrillamail.com/'
21
- this.guerillaPath = 'ajax.php'
20
+ this.guerrillaApi = 'https://api.guerrillamail.com/ajax.php'
22
21
  chai.use(chai_as_promised);
23
22
  this.expect = chai.expect;
24
23
  // Own dependencies with the model
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opengate-js",
3
- "version": "12.1.1",
3
+ "version": "12.2.0",
4
4
  "description": "",
5
5
  "main": "dist/opengate-api-npm.js",
6
6
  "repository": {
@@ -13,6 +13,7 @@ export default class GenericFinder {
13
13
  * @param {string} source - Relative url where is located the resource.
14
14
  * @param {string} reponseJsonData - Relative url where is located the resource. Can be null
15
15
  * @param {string} error_not_found - String error which will be thrown on not_found error.
16
+ * @param {string} serviceBaseURL - base of the uri petition
16
17
  */
17
18
  constructor(ogapi, source, entity, error_not_found, serviceBaseURL) {
18
19
  this._api = ogapi.Napi;
@@ -11,6 +11,8 @@ export default class BaseProvision {
11
11
  * @param {!InternalOpenGateAPI} ogapi - this is ogapi instance
12
12
  * @param {!string} resource - this is a base url resource
13
13
  * @param {!number} [timeout] - timeout on request
14
+ * @param {array} requiredParameters
15
+ * @param {string} serviceBaseURL - base of the uri petition
14
16
  */
15
17
  constructor(ogapi, resource, timeout, requiredParameters = [], serviceBaseURL) {
16
18
  if (this.constructor === BaseProvision) {
@@ -14,6 +14,7 @@ export default class BaseSearch {
14
14
  * @param {!InternalOpenGateAPI} ogapi - this is ogapi instance
15
15
  * @param {!string} resource - this is a base url resource
16
16
  * @param {!number} [timeout] - timeout on request
17
+ * @param {string} serviceBaseURL - base of the uri petition
17
18
  */
18
19
  constructor(ogapi, resource, timeout, serviceBaseURL) {
19
20
  if (this.constructor === BaseSearch) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- import SearchBuilder from './SearchBuilder';
3
+ import SearchWithSummaryBuilder from './SearchWithSummaryBuilder';
4
4
  import FieldFinder from '../../util/searchingFields/FieldFinder'
5
5
 
6
6
  const BASE_URL = '/catalog/hardwares';
@@ -8,7 +8,7 @@ const BASE_URL = '/catalog/hardwares';
8
8
  * Defined a search over Devices
9
9
  * @example ogapi.devicesSearchBuilder()
10
10
  */
11
- export default class HardwaresSearchBuilder extends SearchBuilder {
11
+ export default class HardwaresSearchBuilder extends SearchWithSummaryBuilder {
12
12
  /**
13
13
  * @param {!InternalOpenGateAPI} parent - Instance of our InternalOpenGateAPI
14
14
  */
@@ -262,9 +262,9 @@ export default class User extends BaseProvision {
262
262
  * @property {function (result:object, statusCode:number)} then - When request it is OK
263
263
  * @property {function (error:string)} catch - When request it is NOK
264
264
  * @example
265
- * ogapi.usersBuilder().withEmail(example@example.es).withPassword(oldPassword).updatePassword(newPassword);
265
+ * ogapi.usersBuilder().withEmail(example@example.es).withPassword(oldPassword).changePassword(newPassword);
266
266
  */
267
- updatePassword(newPassword) {
267
+ changePassword(newPassword) {
268
268
  this._newPassword = newPassword;
269
269
  if (_.isEmpty(this._email) || _.isEmpty(this._password) || _.isEmpty(this._newPassword)) {
270
270
  throw new Error('OGAPI_USER_UPDATE_PASSWORD_PARAMETER_MUST_BE_DEFINED');
@@ -86,6 +86,7 @@ export default class NorthAmpliaREST {
86
86
  * @param {object} headers - headers of request
87
87
  * @param {object} parameters - parameters of request
88
88
  * @param {boolean} asBlob - response body as Blob
89
+ * @param {string} serviceBaseURL - base of the uri petition
89
90
  * @return {Promise}
90
91
  */
91
92
  get(url, timeout, headers, parameters, asBlob, serviceBaseURL) {
@@ -102,6 +103,7 @@ export default class NorthAmpliaREST {
102
103
  * @param {number} timeout - timeout in milliseconds
103
104
  * @param {object} headers - headers of request
104
105
  * @param {object} parameters - parameters of request
106
+ * @param {string} serviceBaseURL - base of the uri petition
105
107
  * @return {Promise}
106
108
  */
107
109
  patch(url, data, timeout, headers, parameters, serviceBaseURL) {
@@ -120,6 +122,7 @@ export default class NorthAmpliaREST {
120
122
  * @param {number} timeout - timeout in milliseconds
121
123
  * @param {object} headers - headers of request
122
124
  * @param {object} parameters - parameters of request
125
+ * @param {string} serviceBaseURL - base of the uri petition
123
126
  * @return {Promise}
124
127
  */
125
128
  post(url, data, timeout, headers, parameters, serviceBaseURL) {
@@ -140,6 +143,7 @@ export default class NorthAmpliaREST {
140
143
  * @param {number} timeout - timeout in milliseconds
141
144
  * @param {object} headers - headers of request
142
145
  * @param {object} parameters - parameters of request
146
+ * @param {string} serviceBaseURL - base of the uri petition
143
147
  * @return {Promise}
144
148
  */
145
149
  post_multipart(url, formData, events, timeout, headers, parameters, serviceBaseURL) {
@@ -200,6 +204,7 @@ export default class NorthAmpliaREST {
200
204
  * @param {number} timeout - timeout in milliseconds
201
205
  * @param {object} headers - headers of request
202
206
  * @param {object} parameters - parameters of request
207
+ * @param {string} serviceBaseURL - base of the uri petition
203
208
  * @return {Promise}
204
209
  */
205
210
  put(url, data, timeout, headers, parameters, serviceBaseURL) {
@@ -226,6 +231,7 @@ export default class NorthAmpliaREST {
226
231
  * @param {number} timeout - timeout in milliseconds
227
232
  * @param {object} headers - headers of request
228
233
  * @param {object} parameters - parameters of request
234
+ * @param {string} serviceBaseURL - base of the uri petition
229
235
  * @return {Promise}
230
236
  */
231
237
  put_multipart(url, formData, events, timeout, headers, parameters, serviceBaseURL) {
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["opengate-api-bower.js"],"file":"opengate-api-bower-12.1.1.js","sourceRoot":".."}