maos_rb 0.1.0
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 +7 -0
- data/lib/maos_rb.rb +44 -0
- data/lib/version.rb +3 -0
- metadata +74 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: '039ddf521399a685487159408a5b4954fcb0744965bde9099acf785711ca7b7b'
|
|
4
|
+
data.tar.gz: 0a29e1bf3ffaf737f8c344cc4c3e7d729f6e6d2bb7a240f3706e08e2608f3e91
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 48d2f6baaa44ea5b1cb08d96f71ffc2ca35ff4f1679595411a0fb7a13c75eb8798ad31fc80a54674d8b245f65836bdc823720f8973598d9501b61f090738997b
|
|
7
|
+
data.tar.gz: 4f3a0b3810e33d7172861eecca611eb2656276e96dd903552be21631289c0580c1b32f8de41709ab4d6644130d1469a4916efddbdf7e2c0b88fd19a222f91bb6
|
data/lib/maos_rb.rb
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require 'httparty'
|
|
2
|
+
|
|
3
|
+
module MaosRb
|
|
4
|
+
class Error < StandardError; end
|
|
5
|
+
|
|
6
|
+
class Client
|
|
7
|
+
include HTTParty
|
|
8
|
+
|
|
9
|
+
attr_reader :api_key, :core_url
|
|
10
|
+
|
|
11
|
+
def initialize(config)
|
|
12
|
+
@api_key = config[:api_key]
|
|
13
|
+
@core_url = config[:core_url]
|
|
14
|
+
|
|
15
|
+
raise ArgumentError, 'API key is required' if @api_key.nil?
|
|
16
|
+
raise ArgumentError, 'Core URL is required' if @core_url.nil?
|
|
17
|
+
|
|
18
|
+
self.class.base_uri @core_url
|
|
19
|
+
self.class.headers 'Authorization' => "Bearer #{@api_key}"
|
|
20
|
+
self.class.headers 'Content-Type' => 'application/json'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def execute(agent, kind, input, wait = nil)
|
|
24
|
+
path = "/v1/invocations/sync#{wait ? "?wait=#{wait}" : ''}"
|
|
25
|
+
fetch_with_auth(path, {
|
|
26
|
+
body: { agent: agent, meta: { kind: kind }, payload: input }.to_json
|
|
27
|
+
})
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def fetch_with_auth(endpoint, options = {})
|
|
33
|
+
response = self.class.post(endpoint, options)
|
|
34
|
+
|
|
35
|
+
if response.success?
|
|
36
|
+
[true, response.parsed_response || {}]
|
|
37
|
+
else
|
|
38
|
+
[false, "HTTP error! status: #{response.code}, message: #{response.message}"]
|
|
39
|
+
end
|
|
40
|
+
rescue StandardError => e
|
|
41
|
+
[false, e.message]
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
data/lib/version.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: maos_rb
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- BlueX
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2024-07-31 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: httparty
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0.18'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0.18'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rspec
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '3.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '3.0'
|
|
41
|
+
description: A Ruby client library for interacting with the MAOS API
|
|
42
|
+
email:
|
|
43
|
+
- dev@bluextrade.com
|
|
44
|
+
executables: []
|
|
45
|
+
extensions: []
|
|
46
|
+
extra_rdoc_files: []
|
|
47
|
+
files:
|
|
48
|
+
- lib/maos_rb.rb
|
|
49
|
+
- lib/version.rb
|
|
50
|
+
homepage: https://gitlab.com/navyx/ai/maos/maos-rb
|
|
51
|
+
licenses:
|
|
52
|
+
- MIT
|
|
53
|
+
metadata:
|
|
54
|
+
homepage_uri: https://gitlab.com/navyx/ai/maos/maos-rb
|
|
55
|
+
post_install_message:
|
|
56
|
+
rdoc_options: []
|
|
57
|
+
require_paths:
|
|
58
|
+
- lib
|
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
|
+
requirements:
|
|
61
|
+
- - ">="
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: 2.3.0
|
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
requirements: []
|
|
70
|
+
rubygems_version: 3.3.7
|
|
71
|
+
signing_key:
|
|
72
|
+
specification_version: 4
|
|
73
|
+
summary: A ruby client libraryfor the MAOS API
|
|
74
|
+
test_files: []
|