mass-client 1.0.10 → 1.0.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d85af9b839b0ffefd82361d16babe2d328a56f88cfad802f890a5967abae4203
4
- data.tar.gz: c93d4824827ddca2da4360c53959f2d737551a358ea83d9428d9002209d94346
3
+ metadata.gz: b2e2230b69c4aea3d96564dec306223fe4b328f87db27b63aa19a5dbf77e7743
4
+ data.tar.gz: 2ec24b690e9571a6dbcb4b7739756db1998d152c0edd71fa43c78a3da3db8c0f
5
5
  SHA512:
6
- metadata.gz: c54cba818679f24738c2819ca1979f0be8a402813ef607115d118c966902f146cec4dea56849765da5c76909516223f58b433be018a62d8cd13427672cbf1243
7
- data.tar.gz: 33b0a7a8ca117d41b87783e69c0541d248a5d46926f02db05227dff01b2849a629da868d9a19df1fd9a757a0a79d5cbc487140c5a36a5bd593d0d6f5f63db3ce
6
+ metadata.gz: 63b331adab42f9e8ed3d9ce12047d97908a12a3070ac0ddb14b0b4448d6cae5e609e759396f437870bb3b96706595889c316dea231acaac079bfc5ff575d3ffb
7
+ data.tar.gz: 05ed023c73d13c9b08e8ab7bd4ab450214664284f31b27bbdea28076554f6889b19a62ee1bd7e96269dd6ef538bae4ad82f6de3865e44d3efd3a9d0184e503ff
@@ -13,6 +13,7 @@ module Mass
13
13
  self.lead = Mass::Lead.new(h['lead']) if h['lead']
14
14
  self.company = Mass::Company.new(h['company']) if h['company']
15
15
  self.profile_type = Mass::ProfileType.page(
16
+ id_account: h['id_account'],
16
17
  page: 1,
17
18
  limit: 1,
18
19
  filters: {
@@ -13,6 +13,7 @@ module Mass
13
13
  self.lead = Mass::Lead.new(h['lead']) if h['lead']
14
14
  self.company = Mass::Company.new(h['company']) if h['company']
15
15
  self.profile_type = Mass::ProfileType.page(
16
+ id_account: h['id_account'],
16
17
  page: 1,
17
18
  limit: 1,
18
19
  filters: {
@@ -9,6 +9,7 @@ module Mass
9
9
  def initialize(h={})
10
10
  super(h)
11
11
  self.profile_type = Mass::ProfileType.page(
12
+ id_account: h['id_account'],
12
13
  page: 1,
13
14
  limit: 1,
14
15
  filters: {
@@ -42,6 +42,7 @@ module Mass
42
42
  h_filters = {}
43
43
  h_filters[field_2.to_s] = k[field_2]
44
44
  lead = Mass::Lead.page(
45
+ id_account: lead_descriptor['id_account'],
45
46
  page: 1,
46
47
  limit: 1,
47
48
  filters: h_filters
@@ -155,7 +156,7 @@ module Mass
155
156
  )
156
157
  err = []
157
158
  err << "The status must be :allow or :block." if ![:allow, :block].include?(status)
158
- err << "#{domain.to_s} is not a valid domain" if !domain.to_s.valid_domain?
159
+ err << "#{domain.to_s} is not a valid domain" if !domain.to_s.strip.downcase.valid_domain?
159
160
  raise err.join("\n") if err.size > 0
160
161
 
161
162
  site_url = secure ? "https://" : "http://"
data/lib/mass-client.rb CHANGED
@@ -10,8 +10,56 @@ require 'colorize'
10
10
  module Mass
11
11
  @@js_path
12
12
  @@drownload_path
13
+ @@api_client
14
+
15
+ # set the MassProspecting API client
16
+ #
17
+ # Parameters:
18
+ #
19
+ # api_key: Mandatory. The API key of your MassProspecting account.
20
+ # subaccount: Mandatory. The name of the subaccount you want to work with.
21
+ # api_url: Optional. The URL of the MassProspecting API. Default is 'https://massprospecting.com'.
22
+ # api_port: Optional. The port of the MassProspecting API. Default is 443.
23
+ # api_version: Optional. The version of the MassProspecting API. Default is '1.0'.
24
+ # backtrace: Optional. If true, the backtrace of the exceptions will be returned by the access points. If false, only an error description is returned. Default is false.
25
+ # js_path: Optional. The path to the JavaScript file to be used by the SDK. Default is nil.
26
+ # download_path: Optional. The path to the download folder(s) to be used by the SDK. Default is [].
27
+ def self.set(
28
+ api_key:,
29
+ subaccount:,
30
+ api_url: 'https://massprospecting.com',
31
+ api_port: 443,
32
+ api_version: '1.0',
33
+ backtrace: false,
34
+ js_path: nil,
35
+ download_path: []
36
+ )
37
+ # call the master to get the URL and port of the subaccount.
38
+ BlackStack::API.set_client(
39
+ api_key: api_key,
40
+ api_url: api_url,
41
+ api_port: api_port,
42
+ api_version: api_version,
43
+ backtrace: backtrace
44
+ )
45
+
46
+ params = { 'name' => subaccount }
47
+ ret = BlackStack::API.post(
48
+ endpoint: "resolve/get",
49
+ params: params
50
+ )
51
+
52
+ raise "Error initializing client: #{ret['status']}" if ret['status'] != 'success'
53
+
54
+ # call the master to get the URL and port of the subaccount.
55
+ BlackStack::API.set_client(
56
+ api_key: ret['api_key'],
57
+ api_url: ret['url'],
58
+ api_port: ret['port'],
59
+ api_version: api_version,
60
+ backtrace: backtrace
61
+ )
13
62
 
14
- def self.set(js_path:, download_path:)
15
63
  # validate: download_path must be a string or an arrow of strings
16
64
  if download_path.is_a?(String)
17
65
  raise ArgumentError.new("The parameter 'download_path' must be a string or an array of strings.") if download_path.to_s.empty?
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.10
4
+ version: 1.0.12
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-08-02 00:00:00.000000000 Z
11
+ date: 2024-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uri