pampa_workers 1.1.3 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mybotprocess.rb +32 -0
  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: 1e39a8aa4b418ef142a3a2283028092c93f30eed
4
- data.tar.gz: fcfed79846916674bf24a3cabfab7ba02a4d1a4e
3
+ metadata.gz: c065e193d9eea6e4b7d79e69a741cf023372be62
4
+ data.tar.gz: a07698964231067c21cdcab1d9679079aa00466e
5
5
  SHA512:
6
- metadata.gz: a133aa8e8d815c0a843bb07822c0a63119241a52aa28e9c215abd04390ebee46985df75bb9cb97543b2dbf679cd8c104dcb47ee47946489bcf7cffb41886d94e
7
- data.tar.gz: 0c31ff155be2ef75bdf1c3b4f587adfdd01f8bab60a17efdfbf7c6ebfe19e3390794c90cf2af5e927d0ea6e96fde1a4c4b34cf038cc6500b17a2c88d16338f1d
6
+ metadata.gz: 229fafb626480f6c6d9f51fc65e2e21de5f44363335358ed5a260e72be9f2ea64dc22a7abdaa2b76ec06dc4d6d8815ab66fd2de33f148338565022b753845b26
7
+ data.tar.gz: 436082a37b96358b03c44e4a985b4bca623d868f1932205f8709ad3d4a05419e339d745df0efa42b5cccf9628345556a781cc0afdb16fe68d00de49cdecac8b5
@@ -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
@@ -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.3
4
+ version: 1.1.8
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-04 00:00:00.000000000 Z
11
+ date: 2020-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket