stealth_browser_automation 1.1.22 → 1.1.23

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: 67e04c19c3a815cdf05e0cc467f5bafa6f07171b
4
- data.tar.gz: 23b30a071938aaed5dca1a829dded4555362593b
3
+ metadata.gz: 5d6faad7a5e569cccff434a14bfb1eff858b861d
4
+ data.tar.gz: a59900bf05b6c0c49d85c9552e8b9a10d125a3d9
5
5
  SHA512:
6
- metadata.gz: 97bf2d2cccc8c0d7f52f468974fbd6f37d47114f77a7b88f081e60af3f8ad131bc85811c478e018c82775bc84cde78bd788f1d6be1b61d9fd1d88ddb1aaaaf9c
7
- data.tar.gz: 1e5a350d47e3a42aad26d283cbde56ba29e97ebc31a61e3319486608db86ee22735130126b10e5addad1ecc42ea9a2a83427cf909c794f9023909a86da06e157
6
+ metadata.gz: ea31855118dcf73ca711841e337f18be379bb4a6b1caedcdb7a743d314063bb33e649abb004c3b9972a938dfbc1ffa9392c7313e31f245e2728e854fddcecc9f
7
+ data.tar.gz: ebc2208d2ab49018a6b0cbe84028c68f585a1d1fe4c44f15744707be65eb1b140e102f5d1fd037f056335f920f3be07d32b615d0fd8fac564b86354ccad4c90b
@@ -52,31 +52,37 @@ module BlackStack
52
52
  def self.remove_local_profile(profile_id)
53
53
  url = "http://127.0.0.1:#{BlackStack::StealthBrowserAutomation::Multilogin::mla_local_port.to_s}/api/v2/localprofile/remove?profileId=#{profile_id}"
54
54
  uri = URI.parse(url)
55
- req = Net::HTTP::Post.new(uri)
56
- req['Content-Type'] = 'application/json'
57
55
  res = Net::HTTP.start(uri.host, uri.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) {|http|
58
56
  req = Net::HTTP::Post.new(uri)
59
57
  req['Content-Type'] = 'application/json'
60
58
  req.body = [profile_id].to_json
61
59
  res = JSON.parse(http.request(req).body)
62
60
  raise "Error creating Multilogin local profile: #{res.to_s}" if res['status'] != 'OK'
63
- return res['uuid']
61
+ return
64
62
  }
65
63
  end # def self.delete_profile
66
64
 
67
65
  # returns the profileId of the new Mimic profile
66
+ # TODO: validar posibles errores
68
67
  def self.local_profiles()
69
68
  url = "http://127.0.0.1:#{BlackStack::StealthBrowserAutomation::Multilogin::mla_local_port.to_s}/api/v2/localprofile/list"
70
69
  uri = URI.parse(url)
71
- req = Net::HTTP::Post.new(uri)
72
- req['Content-Type'] = 'application/json'
73
70
  res = Net::HTTP.start(uri.host, uri.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) {|http|
74
- http.request(req)
71
+ req = Net::HTTP::Get.new(uri)
72
+ #req['Content-Type'] = 'application/json'
73
+ #req.body = {}.to_json
74
+ res = JSON.parse(http.request(req).body)
75
+ #raise "Error creating Multilogin local profile: #{res.to_s}" if res['status'] != 'OK'
76
+ return res
75
77
  }
76
- res = JSON.parse(res.body)
77
- raise "Error getting Multilogin local profiles: #{res.to_s}" if !res.has_key?('status')
78
- raise "Error getting Multilogin local profiles: #{res['status'].to_s}" if res['status'] != 'OK'
79
- res
78
+ end # def self.delete_profile
79
+
80
+ # returns the profile_id from its name.
81
+ # If not exists a profile with such name, it returns nil.
82
+ def self.local_profile_id(name)
83
+ h = self.local_profiles.select { |h| h['name'] == name }.first
84
+ return nil if h.nil?
85
+ h['sid']
80
86
  end # def self.delete_profile
81
87
 
82
88
  # returns the profileId of the new Mimic profile
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stealth_browser_automation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.22
4
+ version: 1.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi