mass-client 1.0.16 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/first-line/profile_rpa.rb +27 -0
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72e73ed48a3ece2e7f8eee5d01ec38f8d4d96b6b489d807d61810d153d23cbe0
4
- data.tar.gz: 3bbf7cbd0ee7c51d3609d1e98982a5afd7bfd2ed007cf7dcee51041746fbfeda
3
+ metadata.gz: 15fc20e0e46b85a66c45cbabbf3862fd1db6bff5fc254ec8b94414a0c5f086da
4
+ data.tar.gz: 6cd0e9274b472a4e64a07d3f9f0d846b5499b2bbb3384e3e45a322d3a1210202
5
5
  SHA512:
6
- metadata.gz: 5f3fd3cead76ae5aebcd3ce49e69c993892103c9d54f491bbf698a20d3f00b549094fe3aa8a0b11cd94670664c2ebcea76a58731d02adbb79f9a6195fd0f7ff6
7
- data.tar.gz: 5e93634a3363448dd86a81d5435056f68251640bad12e3bb94988e3a0aad1ffdfe3c8fd64370694c76705ab9e1e07893885317a2da6efa4465317255d91a73a4
6
+ metadata.gz: 663c292587112ca68d8a29643d7348d4510cf7028d1564d7f24c9259c518e1e25de0dfffc8bfef889f90f2f8e7a9d4625e80e4d95e8344ce81db83387c84cb66
7
+ data.tar.gz: 176098ed2b937fc66af21da5e0d2d585a1960c209ab0eaa2be6579aa2a05fe866f532b36011c2bcb01043e51af202e1026235e870116f519191ecc04cd954e9b
@@ -195,6 +195,7 @@ module Mass
195
195
  #binding.pry
196
196
  # this function is to download images from the same browser, using the proxy of the browser.
197
197
  # never download images from the server, because sites can track the IP.
198
+ =begin
198
199
  js0 = "
199
200
  async function downloadImage(imageSrc, filename) {
200
201
  const image = await fetch(imageSrc)
@@ -210,6 +211,32 @@ module Mass
210
211
  }
211
212
  downloadImage('#{url}', '#{filename}')
212
213
  "
214
+ =end
215
+ # Promise Handling: By returning a Promise in the JavaScript code, Selenium will wait for the asynchronous operation to complete.
216
+ # Reference: https://github.com/MassProspecting/docs/issues/253
217
+ js0 = "
218
+ function downloadImage(imageSrc, filename) {
219
+ return new Promise(async (resolve, reject) => {
220
+ try {
221
+ const image = await fetch(imageSrc);
222
+ const imageBlob = await image.blob();
223
+ const imageURL = URL.createObjectURL(imageBlob);
224
+
225
+ const link = document.createElement('a');
226
+ link.href = imageURL;
227
+ link.download = filename;
228
+ document.body.appendChild(link);
229
+ link.click();
230
+ document.body.removeChild(link);
231
+
232
+ resolve('Download initiated');
233
+ } catch (error) {
234
+ reject(error);
235
+ }
236
+ });
237
+ }
238
+ return downloadImage('#{url}', '#{filename}');
239
+ "
213
240
  #binding.pry
214
241
  driver.execute_script(js0)
215
242
  sleep(10)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mass-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
4
+ version: 1.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-06 00:00:00.000000000 Z
11
+ date: 2024-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uri
@@ -150,7 +150,7 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: 1.1.2
153
- description: Ruby library for Mass API.
153
+ description: Ruby library for MassProspecting API.
154
154
  email: leandro@massprospecting.com
155
155
  executables: []
156
156
  extensions: []
@@ -206,5 +206,5 @@ requirements: []
206
206
  rubygems_version: 3.3.7
207
207
  signing_key:
208
208
  specification_version: 4
209
- summary: Ruby library for Mass API.
209
+ summary: Ruby library for MassProspecting API.
210
210
  test_files: []