pampa_workers 1.1.12 → 1.1.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2dad18d5f5f7633d9ad7bc4e9e5a772742f6e95a
4
- data.tar.gz: 8baca930b019317adca58ca19749e31e2845a35c
3
+ metadata.gz: 7c4aa601fbee13613b79ce12aead5b1b2595057a
4
+ data.tar.gz: ef70920af4002fa4d01fdf5ac8f9415704002026
5
5
  SHA512:
6
- metadata.gz: 9c28677eb7d139b247177b3834c7cd67d0b92a079720c6658791fa9c832ba49aae0b9f088c23238a2b609fd0d3ded8b6b5f3d650f290a32698a5e923740fdb43
7
- data.tar.gz: a2f4fe384f8d9d5d1a1ad67f40902f8a266d47feab9421a00959e3436982f439c1b64de845b0287687bb1627e920f58f3704c210657627493481cb3e3bbac62a
6
+ metadata.gz: 3b066535662908abe26d916747d1dc822d2ca204bfd8ed941f6bf1a5297e9114892ef38e49df90b35cbc9bf248eec36d91182dfe036fcc52ca6a959b4ea49ea8
7
+ data.tar.gz: 58c31dedf4d304ba7271919418cc63eb99dcc0195864e139041527ee26e464e5022f32890264242765263f8b8498c4f471950715ca6e150c1b3b4dd6e9eabeb9
@@ -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
@@ -172,7 +181,7 @@ module BlackStack
172
181
  if self.resellerSignatureEnabled?
173
182
  return self.from_email_for_ssm.to_s
174
183
  else
175
- return BlackStack::Params.getValue("notifications.user.email_from")
184
+ return NOTIFICATIONS[:from_email]
176
185
  end
177
186
  end
178
187
 
@@ -182,7 +191,7 @@ module BlackStack
182
191
  if self.resellerSignatureEnabled?
183
192
  return self.from_email_for_ssm.to_s
184
193
  else
185
- return BlackStack::Params.getValue("notifications.user.name_from")
194
+ return NOTIFICATIONS[:from_name]
186
195
  end
187
196
  end
188
197
  end # class Client
@@ -113,14 +113,14 @@ module BlackStack
113
113
  url =
114
114
  "#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/pampa/scrape.inbox/notify_lnchat.json?" +
115
115
  "api_key=#{BlackStack::Pampa::api_key}&" +
116
- "profile_code=#{URI.escape(conv[:profile_code])}&" +
117
- "profile_name=#{URI.escape(conv[:profile_name])}&" +
118
- "profile_headline=#{URI.escape(conv[:profile_headline])}&" +
119
- "first=#{URI.escape(conv[:first])}&" +
116
+ "profile_code=#{CGI.escape(conv[:profile_code])}&" +
117
+ "profile_name=#{CGI.escape(conv[:profile_name])}&" +
118
+ "profile_headline=#{CGI.escape(conv[:profile_headline])}&" +
119
+ "first=#{CGI.escape(conv[:first])}&" +
120
120
  "position=#{chat[:position].to_s}&" +
121
121
  "uid=#{lnuser['id']}&" +
122
- "sender_name=#{URI.escape(chat[:sender_name])}&" +
123
- "body=#{URI.escape(chat[:body])}&"
122
+ "sender_name=#{CGI.escape(chat[:sender_name])}&" +
123
+ "body=#{CGI.escape(chat[:body])}&"
124
124
  puts ""
125
125
  puts "url:#{url}:."
126
126
  puts ""
@@ -32,6 +32,7 @@ module BlackStack
32
32
 
33
33
  #
34
34
  @@division_name = nil
35
+ @@timeout = 5
35
36
 
36
37
  def self.division_name()
37
38
  @@division_name
@@ -42,6 +43,15 @@ module BlackStack
42
43
  @@division_name = s
43
44
  end
44
45
 
46
+ def self.timeout()
47
+ @@timeout
48
+ end
49
+
50
+ #
51
+ def self.set_timeout(t)
52
+ @@timeout = n
53
+ end
54
+
45
55
  # Api-key of the client who will be the owner of a process.
46
56
  @@api_key = nil
47
57
 
@@ -212,7 +222,8 @@ module BlackStack
212
222
  :port => BlackStack::Pampa::db_port, # Required when using other that 1433 (default)
213
223
  :database => BlackStack::Pampa::db_name,
214
224
  :user => BlackStack::Pampa::db_user,
215
- :password => BlackStack::Pampa::db_password
225
+ :password => BlackStack::Pampa::db_password,
226
+ :timeout => BlackStack::Pampa::timeout
216
227
  }
217
228
  else
218
229
  url = "#{BlackStack::Pampa::api_url}/api1.2/division/get.json"
@@ -233,7 +244,8 @@ module BlackStack
233
244
  :port => parsed["db_port"], # only required if port is different than 1433
234
245
  :database => parsed["db_name"],
235
246
  :user => parsed["db_user"],
236
- :password => parsed["db_password"]
247
+ :password => parsed["db_password"],
248
+ :timeout => BlackStack::Pampa::timeout
237
249
  }
238
250
  end
239
251
  end
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.12
4
+ version: 1.1.18
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-04-25 00:00:00.000000000 Z
11
+ date: 2020-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket