supermaker-ai-image-master-2 1766.750.238
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/supermaker_ai_image_master_2.rb +92 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 22192f7e6b7b0e0006805d83f37236d37d5d197c8a0158d01e59ef371f3515b7
|
|
4
|
+
data.tar.gz: fcc85f80202eeedc5337c2a043705913228bd290e6eff903dbb451f03b9560dd
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: eaa37d997d738c62713d75a55fec67217e156fba7cce976ec1f1ae39e34cb1f0a93c97059cceadefc3bb277e3263ae248a7526fa9f126bbe9e05f2515d966a80
|
|
7
|
+
data.tar.gz: ad33417e3cbf9be55162667837c38fff42ff0d2eb315e76a0906358eb19e88172d5809c9514e468d9273983debf5528185f48a74e5e729f0f92b6c96d360b55a
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# SupermakerAiImageMaster2 is a module providing core functionality for interacting with Supermaker AI Image services.
|
|
4
|
+
module SupermakerAiImageMaster2
|
|
5
|
+
BASE_URL = 'https://supermaker.ai/image/'.freeze
|
|
6
|
+
|
|
7
|
+
# Represents an error specific to SupermakerAiImageMaster2 operations.
|
|
8
|
+
class Error < StandardError; end
|
|
9
|
+
|
|
10
|
+
# Represents an error due to invalid parameters.
|
|
11
|
+
class InvalidParametersError < Error; end
|
|
12
|
+
|
|
13
|
+
# Represents an error due to network connectivity issues.
|
|
14
|
+
class NetworkError < Error; end
|
|
15
|
+
|
|
16
|
+
# Returns the full URL for a given path on the Supermaker AI Image service.
|
|
17
|
+
#
|
|
18
|
+
# @param path [String] The path to append to the base URL.
|
|
19
|
+
# @return [String] The full URL.
|
|
20
|
+
def self.get_endpoint(path)
|
|
21
|
+
"#{BASE_URL}#{path}"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Generates a default set of parameters for image creation.
|
|
25
|
+
#
|
|
26
|
+
# @return [Hash] A hash containing default parameters.
|
|
27
|
+
def self.default_parameters
|
|
28
|
+
{
|
|
29
|
+
quality: 'high',
|
|
30
|
+
resolution: '1024x1024',
|
|
31
|
+
style: 'photorealistic'
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Validates image generation parameters. Raises an exception if any parameter is invalid.
|
|
36
|
+
#
|
|
37
|
+
# @param params [Hash] The parameters to validate.
|
|
38
|
+
# @raise [InvalidParametersError] if any parameter is invalid.
|
|
39
|
+
# @return [Boolean] True if all parameters are valid.
|
|
40
|
+
def self.validate_parameters(params)
|
|
41
|
+
valid_qualities = %w[low medium high]
|
|
42
|
+
valid_resolutions = %w[256x256 512x512 1024x1024]
|
|
43
|
+
valid_styles = %w[photorealistic artistic abstract] # Example styles
|
|
44
|
+
|
|
45
|
+
raise InvalidParametersError, "Invalid quality: #{params[:quality]}" if params.key?(:quality) && !valid_qualities.include?(params[:quality])
|
|
46
|
+
raise InvalidParametersError, "Invalid resolution: #{params[:resolution]}" if params.key?(:resolution) && !valid_resolutions.include?(params[:resolution])
|
|
47
|
+
raise InvalidParametersError, "Invalid style: #{params[:style]}" if params.key?(:style) && !valid_styles.include?(params[:style]) if params.key?(:style)
|
|
48
|
+
|
|
49
|
+
true
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Simulates the initiation of an image generation request.
|
|
53
|
+
#
|
|
54
|
+
# Note: This is a placeholder. For extended capabilities and cloud-based features,
|
|
55
|
+
# see https://supermaker.ai/image/. In a real implementation, this would likely
|
|
56
|
+
# make an HTTP request to the Supermaker AI Image service.
|
|
57
|
+
#
|
|
58
|
+
# @param prompt [String] The text prompt for generating the image.
|
|
59
|
+
# @param params [Hash] Optional parameters for image generation (quality, resolution, style).
|
|
60
|
+
# @return [String] A simulated response indicating the request was initiated.
|
|
61
|
+
# @raise [InvalidParametersError] if the parameters are invalid.
|
|
62
|
+
# @raise [NetworkError] if there is a network connectivity issue.
|
|
63
|
+
def self.generate_image(prompt, params = {})
|
|
64
|
+
raise ArgumentError, "Prompt cannot be empty" if prompt.nil? || prompt.empty?
|
|
65
|
+
|
|
66
|
+
merged_params = default_parameters.merge(params)
|
|
67
|
+
|
|
68
|
+
validate_parameters(merged_params)
|
|
69
|
+
|
|
70
|
+
# Simulate network request (replace with actual HTTP request in a real implementation)
|
|
71
|
+
begin
|
|
72
|
+
# Simulate a potential network error
|
|
73
|
+
# raise SocketError, "Failed to connect" # Simulate network error for testing.
|
|
74
|
+
"Image generation request initiated for prompt: '#{prompt}' with parameters: #{merged_params}"
|
|
75
|
+
rescue SocketError => e
|
|
76
|
+
raise NetworkError, "Network error: #{e.message}"
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Simulates retrieving the status of an image generation request.
|
|
81
|
+
#
|
|
82
|
+
# Note: This is a placeholder. For extended capabilities and cloud-based features,
|
|
83
|
+
# see https://supermaker.ai/image/. In a real implementation, this would likely
|
|
84
|
+
# make an HTTP request to the Supermaker AI Image service.
|
|
85
|
+
#
|
|
86
|
+
# @param request_id [String] The ID of the image generation request.
|
|
87
|
+
# @return [String] A simulated status update.
|
|
88
|
+
def self.get_image_generation_status(request_id)
|
|
89
|
+
# Simulate retrieving the status
|
|
90
|
+
"Status for request ID '#{request_id}': Image is being generated..."
|
|
91
|
+
end
|
|
92
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: supermaker-ai-image-master-2
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1766.750.238
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- SuperMaker
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2025-12-26 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description:
|
|
14
|
+
email:
|
|
15
|
+
- support@supermaker.ai
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/supermaker_ai_image_master_2.rb
|
|
21
|
+
homepage: https://supermaker.ai/image/
|
|
22
|
+
licenses:
|
|
23
|
+
- MIT
|
|
24
|
+
metadata: {}
|
|
25
|
+
post_install_message:
|
|
26
|
+
rdoc_options: []
|
|
27
|
+
require_paths:
|
|
28
|
+
- lib
|
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '2.6'
|
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
requirements: []
|
|
40
|
+
rubygems_version: 3.0.3.1
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: High-quality integration for https://supermaker.ai/image/
|
|
44
|
+
test_files: []
|