mass-client 1.0.28 → 1.0.29
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.
- checksums.yaml +4 -4
- data/lib/base-line/outreach.rb +1 -0
- data/lib/base-line/profile.rb +12 -1
- data/lib/first-line/profile_rpa.rb +11 -1
- data/lib/mass-client.rb +4 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9380c702eb69c7a65d4c547811eeab6785fa9fdeb9f85e3c0ec5909b0533e08e
|
4
|
+
data.tar.gz: 85cde6d58b6f13edb37d8abee02804330360cd818ef5945fc3436665c66cbaf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bc9901b6d7df6c6fefa02aa2e4c9d720fea770e106d41febb0cace29ca7ebe1f54977a6e11185f80d2e408334cbdf2a9e16e24fb037cb071a67f21599fa2e15
|
7
|
+
data.tar.gz: 28678eed6f14ac5c812b9116ce06a96d25c3fe39c1607e7c01936f5a1343ea396d59008499b9b61252f082820afa9185b96a35bdf71275387c6d3e5aa8528d22
|
data/lib/base-line/outreach.rb
CHANGED
@@ -32,6 +32,7 @@ module Mass
|
|
32
32
|
# crate an instance of the profile type using the class defined in the `desc['name']` attribute.
|
33
33
|
# override the base method
|
34
34
|
def child_class_instance
|
35
|
+
#binding.pry
|
35
36
|
outreach_type = self.desc['outreach_type']
|
36
37
|
key = self.class_name_from_outreach_type
|
37
38
|
raise "Source code of outreach type #{outreach_type} not found. Create a class #{key} in the folder `/lib` of your mass-sdk." unless Kernel.const_defined?(key)
|
data/lib/base-line/profile.rb
CHANGED
@@ -60,7 +60,7 @@ module Mass
|
|
60
60
|
# - url: Internet address of the image to download from the website and upload to dropbox.
|
61
61
|
# - dropbox_folder: Dropbox folder name to store the image.
|
62
62
|
#
|
63
|
-
def download_image_0(url, dropbox_folder = nil)
|
63
|
+
def download_image_0(url, dropbox_folder = nil, s3_optimization: true)
|
64
64
|
raise "Either dropbox_folder parameter or self.desc['id_account'] are required." if dropbox_folder.nil? && self.desc['id_account'].nil?
|
65
65
|
dropbox_folder = self.desc['id_account'] if dropbox_folder.nil?
|
66
66
|
|
@@ -127,6 +127,17 @@ module Mass
|
|
127
127
|
file.write(Base64.decode64(image_data))
|
128
128
|
end
|
129
129
|
|
130
|
+
# AWS/S3 optimization - Reduce the resolution of the screenshot
|
131
|
+
# Reference: https://github.com/MassProspecting/docs/issues/368
|
132
|
+
if s3_optimization
|
133
|
+
image = MiniMagick::Image.open(tmp_path)
|
134
|
+
image.format "jpeg"
|
135
|
+
image.strip # Remove all profiles and comments
|
136
|
+
image.quality "50" # Apply compression quality setting (for JPEG)
|
137
|
+
image_ret = image.quality "10" # reduce the file size as well by compressing the image
|
138
|
+
image.write(tmp_path)
|
139
|
+
end # s3_optimization
|
140
|
+
|
130
141
|
# Proceed with Dropbox operations
|
131
142
|
year = Time.now.year.to_s.rjust(4, '0')
|
132
143
|
month = Time.now.month.to_s.rjust(2, '0')
|
@@ -210,7 +210,7 @@ module Mass
|
|
210
210
|
|
211
211
|
# take screenshot and upload it to dropbox
|
212
212
|
# return the URL of the screenshot
|
213
|
-
def screenshot(dropbox_folder=nil)
|
213
|
+
def screenshot(dropbox_folder=nil, s3_optimization: true)
|
214
214
|
raise "Either dropbox_folder parameter or self.desc['id_account'] are required." if dropbox_folder.nil? && self.desc['id_account'].nil?
|
215
215
|
dropbox_folder = self.desc['id_account'] if dropbox_folder.nil?
|
216
216
|
# parameters
|
@@ -219,6 +219,16 @@ module Mass
|
|
219
219
|
tmp_path = "/tmp/#{filename}"
|
220
220
|
# take screenshot using selenium driver and save it into the /tmp folder
|
221
221
|
self.driver.save_screenshot(tmp_path)
|
222
|
+
# AWS/S3 optimization - Reduce the resolution of the screenshot
|
223
|
+
# Reference: https://github.com/MassProspecting/docs/issues/368
|
224
|
+
if s3_optimization
|
225
|
+
image = MiniMagick::Image.open(tmp_path)
|
226
|
+
image.format "jpeg"
|
227
|
+
image.strip # Remove all profiles and comments
|
228
|
+
image.quality "50" # Apply compression quality setting (for JPEG)
|
229
|
+
image_ret = image.quality "10" # reduce the file size as well by compressing the image
|
230
|
+
image.write(tmp_path)
|
231
|
+
end # s3_optimization
|
222
232
|
# code
|
223
233
|
year = Time.now.year.to_s.rjust(4,'0')
|
224
234
|
month = Time.now.month.to_s.rjust(2,'0')
|
data/lib/mass-client.rb
CHANGED
@@ -9,6 +9,7 @@ require 'timeout'
|
|
9
9
|
require 'base64'
|
10
10
|
require 'adspower-client'
|
11
11
|
require 'aws-sdk-s3' # Ensure the AWS SDK for S3 is installed
|
12
|
+
require 'mini_magick' # https://github.com/MassProspecting/docs/issues/368
|
12
13
|
|
13
14
|
# mass client configuration
|
14
15
|
module Mass
|
@@ -37,7 +38,9 @@ module Mass
|
|
37
38
|
#
|
38
39
|
# js_path: Optional. The path to the JavaScript file to be used by the SDK. Default is nil.
|
39
40
|
# download_path: Optional. The path to the download folder(s) to be used by the SDK. Default is [].
|
40
|
-
|
41
|
+
#
|
42
|
+
# s3_region, s3_access_key_id, s3_secret_access_key, s3_bucket: Defining AWS S3 parameter for storing files at the client-side.
|
43
|
+
#
|
41
44
|
def self.set(
|
42
45
|
api_key: ,
|
43
46
|
subaccount: nil,
|
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.
|
4
|
+
version: 1.0.29
|
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:
|
11
|
+
date: 2025-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: timeout
|
@@ -164,6 +164,20 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 1.169.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: mini_magick
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 5.1.0
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 5.1.0
|
167
181
|
description: Ruby library for MassProspecting API.
|
168
182
|
email: leandro@massprospecting.com
|
169
183
|
executables: []
|