pampa_workers 1.1.8 → 1.1.15

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
  SHA1:
3
- metadata.gz: c065e193d9eea6e4b7d79e69a741cf023372be62
4
- data.tar.gz: a07698964231067c21cdcab1d9679079aa00466e
3
+ metadata.gz: 7ab275405509b5e1757e26edcbd0aa703da36a65
4
+ data.tar.gz: 59873b29ad9be66f9c439478dedcef526e8581d1
5
5
  SHA512:
6
- metadata.gz: 229fafb626480f6c6d9f51fc65e2e21de5f44363335358ed5a260e72be9f2ea64dc22a7abdaa2b76ec06dc4d6d8815ab66fd2de33f148338565022b753845b26
7
- data.tar.gz: 436082a37b96358b03c44e4a985b4bca623d868f1932205f8709ad3d4a05419e339d745df0efa42b5cccf9628345556a781cc0afdb16fe68d00de49cdecac8b5
6
+ metadata.gz: fc5757fb1c54805415645caca9e87360c58cbcc0c4566700e772d0260edb30bc13245a76b73f413194373a8568cf397012e1973f94b8abce18e9f440e3844fca
7
+ data.tar.gz: b38cb83d0656799b2c531724075f7838fde797e26ff4f2c8afa6caec662286cb1dbdb4b96a34682ad2610f4f0a7c6b023419bb86404a9e3135808c0472107abf
@@ -10,7 +10,7 @@ module BlackStack
10
10
  one_to_many :users, :class=>:'BlackStack::User', :key=>:id_client
11
11
  many_to_one :timezone, :class=>:'BlackStack::Timezone', :key=>:id_timezone
12
12
  many_to_one :billingCountry, :class=>:'BlackStack::LnCountry', :key=>:billing_id_lncountry
13
- many_to_one :user_to_contect, :class=>'BlackStack:::User', :key=>:id_user_to_contact
13
+ many_to_one :user_to_contect, :class=>'BlackStack::User', :key=>:id_user_to_contact
14
14
 
15
15
 
16
16
  # -----------------------------------------------------------------------------------------
@@ -85,50 +85,59 @@ module BlackStack
85
85
 
86
86
  # llama a la api de postmark preguntando el reseller email configurado para este clietne fue ferificado
87
87
  def checkDomainForSSMVerified()
88
- return_message = {}
88
+ return_message = {}
89
89
  domain = self.domain_for_ssm
90
90
  email = self.from_email_for_ssm
91
91
  id = ''
92
92
  client = ''
93
-
94
93
  if domain != nil && email != nil
95
94
  begin
96
- client_postmark = Postmark::AccountApiClient.new(POSTMARK_API_TOKEN, secure: true)
97
- client_list = client_postmark.get_signatures()
98
-
99
- client_list.each do |sign|
100
- if sign[:domain] == domain
101
- if sign[:email_address] == email
102
- id = sign[:id]
103
- break
104
- end
105
- end
106
- end
107
-
108
- if id.to_s.size > 0
109
- client = client_postmark.get_sender(id)
95
+ # create postmark client
96
+ client_postmark = Postmark::AccountApiClient.new(POSTMARK_API_TOKEN, secure: true)
97
+
98
+ # get signature
99
+ # more info: https://github.com/wildbit/postmark-gem/wiki/Senders
100
+ #
101
+ # this first strategy is not scalable if we handle a large list of signatures.
102
+ #sign = client_postmark.signatures.select { |sign| sign[:domain]==domain }.first
103
+ #
104
+ # this other approach is a bit more scalable, but anyway we need to call the API
105
+ # with filering by the domain.
106
+ #
107
+ pagesize = 30 # TODO: increase this value to 300 for optimization
108
+ i = 0
109
+ j = 1
110
+ sign = nil
111
+ while j>0 && sign.nil?
112
+ buff = client_postmark.get_signatures(offset: i, count: pagesize)
113
+ j = buff.size
114
+ i += pagesize
115
+ sign = buff.select { |s| s[:domain]==domain }.first
116
+ end # while
117
+
118
+ # if signature has been found?
119
+ if sign.nil?
120
+ # sincronizo con la central
121
+ return_message[:status] = "Client Signature Not Found"
122
+ return_message[:value] = client[:id]
123
+ return return_message.to_json
124
+ else
125
+ id = sign[:id]
126
+ client = client_postmark.get_sender(id)
110
127
  if !client[:confirmed]
111
128
  self.domain_for_ssm_verified = false
112
- self.save
113
-
129
+ self.save
114
130
  return_message[:status] = "No Verified"
115
131
  return_message[:value] = client[:id]
116
-
117
132
  return return_message.to_json
118
133
  else
119
134
  self.domain_for_ssm_verified = true
120
- self.save
121
-
122
- # sincronizo con la central
123
- return_message = {}
124
-
135
+ self.save
125
136
  return_message[:status] = "success"
126
137
  return_message[:value] = client[:id]
127
-
128
138
  return return_message.to_json
129
139
  end
130
140
  end
131
-
132
141
  rescue Postmark::ApiInputError => e
133
142
  return_message[:status] = e.to_s
134
143
  return return_message.to_json
@@ -2,7 +2,7 @@ module BlackStack
2
2
 
3
3
  # clase de base para todos los bots ejecuten acciones con una cuenta de LinkedIn, Facebook, Twitter, etc.
4
4
  class MyBotProcess < BlackStack::MyRemoteProcess
5
- attr_accessor :username, :login_verifications, :run_once
5
+ attr_accessor :username, :login_verifications, :run_once, :cookies_robot
6
6
 
7
7
  # constructor
8
8
  def initialize(
@@ -18,7 +18,7 @@ module BlackStack
18
18
  self.worker_name = "#{the_worker_name}"
19
19
  self.division_name = the_division_name
20
20
  self.minimum_enlapsed_seconds = the_minimum_enlapsed_seconds
21
-
21
+
22
22
  # algunas clases como CreateLnUserProcess o RepairLnUserProcess, trabajan unicamente con el username especificado en este atributo, llamando al access point get_lnuser_by_username.
23
23
  # si este atributo es nil, entonces la clase pide un lnuser a la division, llamando al access point get_lnuser.
24
24
  self.username = nil
@@ -32,6 +32,9 @@ module BlackStack
32
32
  # si este proceso se corre de forma supevisada, se desa correr el procesamiento una unica vez.
33
33
  # cuando se activa este flag, generalmente se setea el atributo self.username tambien.
34
34
  self.run_once = false
35
+
36
+ # preguntar al servidor si el lnuser debe calentar el browser visitando sitios al azar para recolectar cookies
37
+ self.cookies_robot = true
35
38
  end
36
39
 
37
40
  # returns a hash with the parameters of a lnuser
@@ -199,7 +199,7 @@ module BlackStack
199
199
  # se notifica al dispatcher de la division
200
200
  def notify()
201
201
  if (self.ws_url==nil || self.ws_port==nil)
202
- raise "Cannot notify. Worker has not parameters."
202
+ raise "Cannot notify. Worker not exists, or it has not parameters, or it is belong another client. Check your api_key, and check the name of the worker."
203
203
  end
204
204
 
205
205
  # me notifico a la division. obtengo trabajo
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pampa_workers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 1.1.15
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: 2020-02-24 00:00:00.000000000 Z
11
+ date: 2020-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket