userapi-ai 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8e731075ee42254e2b5449b12c471ad38ec7b17f49ed35c27e1f8b9cb3ab994
4
- data.tar.gz: 5649910f890faa5412886612a3a615e0e6dcfeead93a874d2bc8d018082f6f60
3
+ metadata.gz: 2974c481166912bcce0d7a9a618c078aca85d5bfd8743cc56459772a5f66f96c
4
+ data.tar.gz: 4d89389ee688e9127058bd34b7866f0daf72a09684679148114a12c7fe62c061
5
5
  SHA512:
6
- metadata.gz: b5f8753fb545c528159d891f6164adeac1a2aab4f76679c8893a73fe27c9eec19a9d406c7c22c7e3c114d5438e36f60cac32648b17aa98724f63081e96e5ee88
7
- data.tar.gz: c7f0caef35c18a90a87c9747d85c0de3cec320ef9796de7946d20789ceffafc376794f2316c15786ef12bd9a255a55893f2cd7e18e5352f8179ceefa2d486f08
6
+ metadata.gz: c01ab655dc9b0982d2a8dad34a2b4627bfe22a16233a1e76045fcdb27020f5645fcead5e95f5cd66d14295c4e725d8e13cd478f23e82829a1a6e2ee30eb97603
7
+ data.tar.gz: 57294ef669f33f3bcccf5b13787c070f13d7ca3780a15da7433b1b362829bfca813025feee3b357ca3006034cd2b05c3b66e380b09ab3bca141fc495bc206a00
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+
4
+ ## [0.2.0] - 2024-03-24
5
+ raise StandardError on {"status"=>false, "error"=>"..."}
6
+
3
7
  ## [0.1.0] - 2024-03-24
4
8
 
5
9
  - Initial release
data/README.md CHANGED
@@ -1,11 +1,23 @@
1
- # Midjourney Ruby
1
+ # Userapi.ai Ruby
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/userapi-ai.svg)](https://badge.fury.io/rb/userapi-ai)
4
4
  [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](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("]"))
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UserapiAi
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: userapi-ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smolev Denis