pampa_workers 1.1.2 → 1.1.7

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mybotprocess.rb +35 -1
  3. data/lib/worker.rb +2 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 782e133cec2c858b619c751b3bf51df20e29f771
4
- data.tar.gz: 42f4cab18236d5c33be917894ddad9195a6047b4
3
+ metadata.gz: c41ed9a369c934463212f9d6434c098ed971ef13
4
+ data.tar.gz: 2330480ddf8fad11014a8e0c81b25e86a1dde827
5
5
  SHA512:
6
- metadata.gz: d4ce7738ae0bcc792a35fdd132d081bf94fa2da36dbfff2b20d5d6093b17847675aa9ae567d810bcecd94e20550c5931238e7c937db0fa5b0977cfa55e35eab1
7
- data.tar.gz: 3eec7d8fed322007313031574e103442fd7585200ad364c5f333f20579270630cbf63e0c66f14fe0a488de20f2b21145c78d46cf2c0f932e85e78402a204a7bf
6
+ metadata.gz: 0b1ee6b2b57d5e0d7a2cc5e7cac5c9442624f61901a1d6d269ce94100f4f3f474d03c08711160107293da355b5a08835b2feb5f905a1469f82509e41a3d86d2d
7
+ data.tar.gz: 0580ff2bb92c2a8f095c8731b55243c2d2d48cb173cfe54f1ba8a94b0b14d54145b39eccd1fef4d6c1d3d12d3eaf1e0cb18017461cc2ccee8a3ba00ed075f0af
@@ -101,7 +101,39 @@ module BlackStack
101
101
 
102
102
  return lnuser
103
103
  end # getLnUser()
104
+
105
+ #
106
+ def notifyInbox(lnuser, conv)
107
+ conv[:chats].each { |chat|
108
+ # armo URL de notificacion
109
+ # se usa URI.encode para codificar caracteres no-ascii en los mensajes
110
+ url =
111
+ "#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/pampa/scrape.inbox/notify_lnchat.json?" +
112
+ "api_key=#{BlackStack::Pampa::api_key}&" +
113
+ "profile_code=#{URI.escape(conv[:profile_code])}&" +
114
+ "profile_name=#{URI.escape(conv[:profile_name])}&" +
115
+ "profile_headline=#{URI.escape(conv[:profile_headline])}&" +
116
+ "first=#{URI.escape(conv[:first])}&" +
117
+ "position=#{chat[:position].to_s}&" +
118
+ "uid=#{lnuser['id']}&" +
119
+ "sender_name=#{URI.escape(chat[:sender_name])}&" +
120
+ "body=#{URI.escape(chat[:body])}&"
121
+ #puts ""
122
+ #puts "url:#{url}:."
123
+ #puts ""
124
+ # HELP: File.open('./output3.txt', 'a') { |file| file.write(url + "\r\n") }
104
125
 
126
+ # push the chat
127
+ uri = URI.parse(url.to_s)
128
+ req = Net::HTTP::Get.new(uri.to_s)
129
+ res = Net::HTTP.start(uri.host, uri.port, :use_ssl => true, :verify_mode => OpenSSL::SSL::VERIFY_NONE) {|http|
130
+ http.request(req)
131
+ }
132
+ parsed = JSON.parse(res.body)
133
+ raise "error uploading chat: #{parsed['status']}" if parsed['status'] != 'success'
134
+ } # conv[:chats].each
135
+ end
136
+
105
137
  #
106
138
  def notifyLnUserUrl(id_lnuser, profile_url)
107
139
  nTries = 0
@@ -304,8 +336,9 @@ module BlackStack
304
336
  return ret
305
337
  end # isLnUserAvailable
306
338
 
307
- #
339
+ # TODO: deprecated
308
340
  def releaseLnUser(id_lnuser, workflow_name='incrawl.lnsearchvariation')
341
+ =begin
309
342
  nTries = 0
310
343
  parsed = nil
311
344
  bSuccess = false
@@ -339,6 +372,7 @@ module BlackStack
339
372
  end
340
373
 
341
374
  return ret
375
+ =end
342
376
  end # isLnUserAvailable
343
377
 
344
378
  end # class MyBotProcess
@@ -109,6 +109,7 @@ module BlackStack
109
109
  w.id_client = h['id_client']
110
110
  w.id_division = h['id_division']
111
111
  w.division_name = h['division_name']
112
+ w.public_ip_address = h['public_ip_address']
112
113
  w.save
113
114
  end
114
115
 
@@ -123,6 +124,7 @@ module BlackStack
123
124
  h['id_client'] = self.id_client
124
125
  h['id_division'] = self.id_division
125
126
  h['division_name'] = self.division_name
127
+ h['public_ip_address'] = self.public_ip_address
126
128
  h
127
129
  end
128
130
 
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.2
4
+ version: 1.1.7
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-01-16 00:00:00.000000000 Z
11
+ date: 2020-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket