browse_ai 1.0.0 → 1.0.2

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: bffa5df7a1da9581dcfcfa89c210a0ea078349e98edd4dcdb5d7d66a5e0ff6df
4
- data.tar.gz: 59670edeb76def4ea436b0547527759b2637f239ef91db7ea560da04692a8d6a
3
+ metadata.gz: aa9be724e4e1f9095648bf053458241214deea87e3968bcce3a55e331ce5f76e
4
+ data.tar.gz: 6ead772fc6dfae7a2a1172393bb79eaa13ce0c43661a7a3de441a31dccecd21d
5
5
  SHA512:
6
- metadata.gz: 31a5722b43a96ded76d0c2dc24430fc5c524772d1f01daa15d898d6a0b2c39682752cc3630eeb5b9a62e7362b8c868999f916f1215f521f391459727934b0c17
7
- data.tar.gz: 0bdae608d3bf6da3a6aa55f35760da25c74e67adb0419cabb7ac4bc6bb937034721d251b48cadbb2e850249ad4bc2aaef161968f4ed489171d10cab47ad98109
6
+ metadata.gz: 5fef398b81317b7c69f6e3633e19b90c22e45f66e91c7215ad548433af01bcc21d5f9e4fe54d4e608e82c2605c90f04ecb5560ffef4e2c10e5b7fb06ac279b6d
7
+ data.tar.gz: 2e699ba07291d8366a7f334137d5b1ee5e3b9e35c9c772425276b3c3b5c8adaee6d88ae40f52987449963e41c3fad310ba9332972e3ce4bef40738cce2930f81
data/.DS_Store CHANGED
Binary file
data/README.md CHANGED
@@ -47,6 +47,13 @@ Get a robot's task.
47
47
  task = BrowseAi.client.get_tasks(robot_id: '<robot UUID>', id: '<task UUID>')
48
48
  ```
49
49
 
50
+ Run a robot.
51
+ ```
52
+ # Example JSON payload. The input parameters will vary depending on your robot's configuration.
53
+ payload = {'inputParameters' => {'originUrl' => 'Test'}}.to_json
54
+ task = BrowseAi.client.run_robot(robot_id: '<robot UUID>', payload:)
55
+ ```
56
+
50
57
  Get a robot's monitors.
51
58
  ```
52
59
  monitors = BrowseAi.client.get_monitors(robot_id: '<robot UUID>')
data/browse_ai.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.required_ruby_version = '>= 3.0.0'
20
20
 
21
21
  spec.add_dependency 'activesupport', '~> 8.0', '>= 8.0.2'
22
- spec.add_dependency 'faraday', '~> 2.13', '>= 2.13.1'
22
+ spec.add_dependency 'faraday', '>= 1.0'
23
23
  spec.add_dependency 'faraday-multipart', '~> 1.1'
24
24
  spec.add_dependency 'mime-types', '~> 3.7'
25
25
 
@@ -5,6 +5,7 @@ module BrowseAi
5
5
  # GET /Monitors
6
6
  # Get monitors.
7
7
  # @param [String] robot_id The ID of the robot the monitors belong to.
8
+ # @raise [ArgumentError] If the method arguments are blank.
8
9
  # @return [Array, nil].
9
10
  def get_monitors(robot_id:)
10
11
  raise ArgumentError, 'Robot ID cannot be blank' if robot_id.blank?
@@ -2,9 +2,23 @@ require 'browse_ai/dsl'
2
2
 
3
3
  module BrowseAi
4
4
  module DSL::Tasks
5
- # GET /Tasks
5
+ # POST /robots/{robotId}/tasks
6
+ # Runs a task on a robot.
7
+ # @param [String] robot_id The ID of the robot the tasks belongs to.
8
+ # @param [String] :payload The JSON payload to send to the robot.
9
+ # @raise [ArgumentError] If the method arguments are blank.
10
+ # @return [BrowseAi::Resources::Task, nil].
11
+ def run_robot(robot_id:, payload:)
12
+ raise ArgumentError, 'Robot ID cannot be blank' if robot_id.blank?
13
+ raise ArgumentError, 'Payload cannot be blank' if payload.blank?
14
+
15
+ Resources::Task.parse(request(:post, "robots/#{robot_id}/tasks/", payload), ['result'])
16
+ end
17
+
18
+ # GET robots/{robotId}/tasks
6
19
  # Get tasks.
7
- # @param [String] robot_id The ID of the robot the tasks belong to.
20
+ # @param [String] robot_id The ID of the robot the tasks belongs to.
21
+ # @raise [ArgumentError] If the method arguments are blank.
8
22
  # @return [Array, nil].
9
23
  def get_tasks(robot_id:)
10
24
  raise ArgumentError, 'Robot ID cannot be blank' if robot_id.blank?
@@ -12,7 +26,7 @@ module BrowseAi
12
26
  Resources::Task.parse(request(:get, "robots/#{robot_id}/tasks/", nil), %w[tasks items])
13
27
  end
14
28
 
15
- # GET /Task/{id}
29
+ # GET robots/{robotId}/tasks/{id}
16
30
  # Get a task.
17
31
  # @param [String] id A task's ID.
18
32
  # @raise [ArgumentError] If the method arguments are blank.
@@ -5,6 +5,7 @@ module BrowseAi
5
5
  # GET /Webhooks
6
6
  # Get webhooks.
7
7
  # @param [String] robot_id The ID of the robot the webhooks belong to.
8
+ # @raise [ArgumentError] If the method arguments are blank.
8
9
  # @return [Array, nil].
9
10
  def get_webhooks(robot_id:)
10
11
  raise ArgumentError, 'Robot ID cannot be blank' if robot_id.blank?
@@ -16,7 +16,7 @@ module BrowseAi
16
16
  attribute :date_updated_utc, Time
17
17
 
18
18
  def inspect
19
- "#<#{self.class.name}:#{format('0x00%x', (object_id << 1))} #{inspect_attributes}>"
19
+ "#<#{self.class.name}:#{format('0x00%x', object_id << 1)} #{inspect_attributes}>"
20
20
  end
21
21
 
22
22
  private
@@ -1,3 +1,3 @@
1
1
  module BrowseAi
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.2'
3
3
  end
@@ -8,7 +8,25 @@ describe BrowseAi::DSL::Tasks do
8
8
  end
9
9
  end
10
10
 
11
- # GET /tasks
11
+ # POST /robots/{robotId}/tasks
12
+ describe '#run_robot' do
13
+ let(:payload) do
14
+ {
15
+ 'inputParameters' => {
16
+ 'originUrl' => 'Test',
17
+ }
18
+ }.to_json
19
+ end
20
+
21
+ it 'creates a task and runs it' do
22
+ VCR.use_cassette('run_robot') do
23
+ task = BrowseAi.client.run_robot(robot_id:, payload:)
24
+ expect(task).to be_a(Task)
25
+ end
26
+ end
27
+ end
28
+
29
+ # GET robots/{robotId}/tasks
12
30
  describe '#get_tasks' do
13
31
  it 'returns an array of tasks' do
14
32
  VCR.use_cassette('get_tasks') do
@@ -19,7 +37,7 @@ describe BrowseAi::DSL::Tasks do
19
37
  end
20
38
  end
21
39
 
22
- # GET /tasks/{id}
40
+ # GET robots/{robotId}/tasks/{id}
23
41
  describe '#get_task' do
24
42
  it 'returns an task' do
25
43
  id = VCR.use_cassette('get_tasks') do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browse_ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Iorns
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-06-25 00:00:00.000000000 Z
10
+ date: 2025-06-26 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activesupport
@@ -33,22 +33,16 @@ dependencies:
33
33
  name: faraday
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
36
- - - "~>"
37
- - !ruby/object:Gem::Version
38
- version: '2.13'
39
36
  - - ">="
40
37
  - !ruby/object:Gem::Version
41
- version: 2.13.1
38
+ version: '1.0'
42
39
  type: :runtime
43
40
  prerelease: false
44
41
  version_requirements: !ruby/object:Gem::Requirement
45
42
  requirements:
46
- - - "~>"
47
- - !ruby/object:Gem::Version
48
- version: '2.13'
49
43
  - - ">="
50
44
  - !ruby/object:Gem::Version
51
- version: 2.13.1
45
+ version: '1.0'
52
46
  - !ruby/object:Gem::Dependency
53
47
  name: faraday-multipart
54
48
  requirement: !ruby/object:Gem::Requirement