pampa_workers 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mybotprocess.rb +30 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb2b708bea8e27a1b9f9f83b2ebd0180a6d6f234
4
- data.tar.gz: e23a4ba37bc84f7b3e739f6586cc2c314b960f3a
3
+ metadata.gz: caea45d434da43ea67afef7bc6bb493f5a40b44b
4
+ data.tar.gz: 073300b12dae57a3b354ee2bd12ad094ea3661bc
5
5
  SHA512:
6
- metadata.gz: 473e0f770d687e33990ae09e9a39ba80abb60f7a5ec91c80e500ec68bdae9d5bda12763b82fce38fb60e8cb25e9ba40f7dd59de9e3e32e15b3b4c1183a05f8ba
7
- data.tar.gz: 7ffd2a7e5b2e157b3f6c97a2b9ca71d2d1beb47cd2d3706cc127e06386f90e2db9c7159a1ffe0e891eb1e7ed0642597ac5e383cdd9dd686cf2f7b43c8ada9c35
6
+ metadata.gz: 3ad4f1eec949e91fd694afbc36043bf45e6fea95634175adb3b171e128c1f92327fca5b1b2bf14cfcdf38d27bf5ef528c6d57189787ff70577570b4c654f23e2
7
+ data.tar.gz: a50659c82af48217c6a2c48b92f678aabdff92daa73fe472a60d4dbc869ac44761b0d1de8a5860daae7fb5a801e46125daec14de37d10ccc52bff34f69d1ba1e
@@ -101,7 +101,37 @@ 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
+
122
+ # HELP: File.open('./output3.txt', 'a') { |file| file.write(url + "\r\n") }
104
123
 
124
+ # push the chat
125
+ uri = URI.parse(url.to_s)
126
+ req = Net::HTTP::Get.new(uri.to_s)
127
+ res = Net::HTTP.start(uri.host, uri.port, :use_ssl => true, :verify_mode => OpenSSL::SSL::VERIFY_NONE) {|http|
128
+ http.request(req)
129
+ }
130
+ parsed = JSON.parse(res.body)
131
+ raise "error uploading chat: #{parsed['status']}" if parsed['status'] != 'success'
132
+ } # conv[:chats].each
133
+ end
134
+
105
135
  #
106
136
  def notifyLnUserUrl(id_lnuser, profile_url)
107
137
  nTries = 0
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.4
4
+ version: 1.1.5
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-12 00:00:00.000000000 Z
11
+ date: 2020-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket