adspower-client 1.0.17 → 1.0.18

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
  SHA256:
3
- metadata.gz: 0fa9af194c360323a9ddb4533f0be4df21414e2a3645fdebb03a9a13eb315183
4
- data.tar.gz: 474d47d140310200db7919c293e260761e90f33bbeef72ad923b27cfdbb180e2
3
+ metadata.gz: f42b0809ed76da37b7806a4f70ce727efe871def40a4a90c5810d972b0ea0556
4
+ data.tar.gz: d22f49494cae5e3ae3195984c604eea018c6dc180cb1b9dd3d62fcab55f21851
5
5
  SHA512:
6
- metadata.gz: 3e39840a574b00918fc9365be4ee9ffde97c8d9bdbcc4017184a2b4589dd99de31c6c6cc0e7a4eb14f6506b0e8e686ffe96f256d69dd7688dd379de9bab61b0d
7
- data.tar.gz: 93957f83998d804fe74a423337fb13afa8bff70ed1eddb74a4da0f7cd9722b857eed3870797670ce71c8387e3f7cab745752c48df7f6c5b9520e9f3d8b21c152
6
+ metadata.gz: e5951622b5d9f01c5515df6ce671cd0afd6a20872e6dedab34be1d088ebef3f6811b9473a700221e7447e3e6d2d811fe149a6fa3e8cd917ae9abad84e5f8dc24
7
+ data.tar.gz: 7c589af8831eb9596ab2799ae04bd9af6433883f467234e8fe220cd04a6bfc526e31aed74d4b5671330ab5034fc207cbb54c34fc5854f1ae291b431e6985de40
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'adspower-client'
3
- s.version = '1.0.17'
4
- s.date = '2025-07-27'
3
+ s.version = '1.0.18'
4
+ s.date = '2025-07-28'
5
5
  s.summary = "Ruby library for operating AdsPower API."
6
6
  s.description = "Ruby library for operating AdsPower API."
7
7
  s.authors = ["Leandro Daniel Sardi"]
@@ -104,6 +104,41 @@ class AdsPowerClient
104
104
  end
105
105
  end
106
106
  end
107
+
108
+ # Fetch all groups
109
+ def list_groups
110
+ uri = URI("#{adspower_listener}:#{port}/api/v1/group/list?api_key=#{key}")
111
+ resp = Net::HTTP.get(uri)
112
+ data = JSON.parse(resp)
113
+ raise "Error listing groups: #{data['msg']}" unless data['code'] == 0
114
+ data['data']['list'] # => [{ "id" => 0, "name" => "Ungrouped" }, …]
115
+ end
116
+
117
+ # Find the numeric ID for a given group name (exact match)
118
+ def find_group_id_by_name(name)
119
+ grp = list_groups.find { |g| g['group_name'].casecmp(name).zero? }
120
+ grp ? grp['group_id'] : nil
121
+ end
122
+
123
+ # returns an Array of profile‑hashes from the local API
124
+ def list_profiles(group_id: nil)
125
+ all = []
126
+ page = 1
127
+
128
+ loop do
129
+ params = { page: page, limit: 100 }
130
+ params[:group_id] = group_id if group_id
131
+ url = "#{adspower_listener}:#{port}/api/v2/browser-profile/list"
132
+ resp = BlackStack::Netting.call_post(url, params)
133
+ data = JSON.parse(resp.body)
134
+ break unless data['code'] == 0 && data.dig('data','list').any?
135
+ batch = data['data']['list']
136
+ all += batch
137
+ page += 1
138
+ end
139
+
140
+ all
141
+ end
107
142
 
108
143
  # Count current profiles (optionally filtered by group)
109
144
  def profile_count(group_id: nil)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adspower-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.17
4
+ version: 1.0.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: 2025-07-27 00:00:00.000000000 Z
11
+ date: 2025-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uri