userapi-ai 0.1.0 → 0.2.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +14 -2
- data/lib/userapi/http.rb +6 -4
- data/lib/userapi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2974c481166912bcce0d7a9a618c078aca85d5bfd8743cc56459772a5f66f96c
|
|
4
|
+
data.tar.gz: 4d89389ee688e9127058bd34b7866f0daf72a09684679148114a12c7fe62c061
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c01ab655dc9b0982d2a8dad34a2b4627bfe22a16233a1e76045fcdb27020f5645fcead5e95f5cd66d14295c4e725d8e13cd478f23e82829a1a6e2ee30eb97603
|
|
7
|
+
data.tar.gz: 57294ef669f33f3bcccf5b13787c070f13d7ca3780a15da7433b1b362829bfca813025feee3b357ca3006034cd2b05c3b66e380b09ab3bca141fc495bc206a00
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Userapi.ai Ruby
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/userapi-ai)
|
|
4
4
|
[](https://github.com/neonix20b/userapi-ai/blob/main/LICENSE.txt)
|
|
5
5
|
|
|
6
6
|
Userapi.ai is an awesome tool that brings great value to products.
|
|
7
7
|
This gem was created to facilitate Ruby and also Rails applications to use all services of Userapi.ai:
|
|
8
|
-
- Midjourney
|
|
8
|
+
- Midjourney API
|
|
9
|
+
- [Imagine](https://www.notion.so/Midjourney-userapi-ai-doc-en-119680339b0a47e2ba6ae467eca58142?pvs=21)
|
|
10
|
+
- [Describe](https://www.notion.so/Midjourney-userapi-ai-doc-en-119680339b0a47e2ba6ae467eca58142?pvs=21)
|
|
11
|
+
- [Upscale](https://www.notion.so/Midjourney-userapi-ai-doc-en-119680339b0a47e2ba6ae467eca58142?pvs=21)
|
|
12
|
+
- [Upsample](https://www.notion.so/Midjourney-userapi-ai-doc-en-119680339b0a47e2ba6ae467eca58142?pvs=21)
|
|
13
|
+
- [Variation](https://www.notion.so/Midjourney-userapi-ai-doc-en-119680339b0a47e2ba6ae467eca58142?pvs=21)
|
|
14
|
+
- [Inpaint](https://www.notion.so/Midjourney-userapi-ai-doc-en-119680339b0a47e2ba6ae467eca58142?pvs=21)
|
|
15
|
+
- [Blend](https://www.notion.so/Midjourney-userapi-ai-doc-en-119680339b0a47e2ba6ae467eca58142?pvs=21)
|
|
16
|
+
- [Reroll](https://www.notion.so/Midjourney-userapi-ai-doc-en-119680339b0a47e2ba6ae467eca58142?pvs=21)
|
|
17
|
+
- [Zoom](https://www.notion.so/Midjourney-userapi-ai-doc-en-119680339b0a47e2ba6ae467eca58142?pvs=21)
|
|
18
|
+
- [Pan](https://www.notion.so/Midjourney-userapi-ai-doc-en-119680339b0a47e2ba6ae467eca58142?pvs=21)
|
|
19
|
+
- [Info](https://www.notion.so/Midjourney-userapi-ai-doc-en-119680339b0a47e2ba6ae467eca58142?pvs=21)
|
|
20
|
+
- [Status](https://www.notion.so/Midjourney-userapi-ai-doc-en-119680339b0a47e2ba6ae467eca58142?pvs=21)
|
|
9
21
|
|
|
10
22
|
## Installation
|
|
11
23
|
|
data/lib/userapi/http.rb
CHANGED
|
@@ -7,9 +7,6 @@ module UserapiAi
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def json_post(path:, parameters:)
|
|
10
|
-
puts uri(path: path)
|
|
11
|
-
puts headers
|
|
12
|
-
puts parameters.to_json
|
|
13
10
|
to_json(conn.post(uri(path: path)) do |req|
|
|
14
11
|
req.headers = headers
|
|
15
12
|
req.body = parameters.to_json
|
|
@@ -21,7 +18,12 @@ module UserapiAi
|
|
|
21
18
|
def to_json(string)
|
|
22
19
|
return unless string
|
|
23
20
|
|
|
24
|
-
JSON.parse(string)
|
|
21
|
+
json = JSON.parse(string)
|
|
22
|
+
if json["status"] == false and json.has_key?("error")
|
|
23
|
+
raise StandardError.new json["error"]
|
|
24
|
+
else
|
|
25
|
+
json
|
|
26
|
+
end
|
|
25
27
|
rescue JSON::ParserError
|
|
26
28
|
# Convert a multiline string of JSON objects to a JSON array.
|
|
27
29
|
JSON.parse(string.gsub("}\n{", "},{").prepend("[").concat("]"))
|
data/lib/userapi/version.rb
CHANGED