reve_ai 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/README.md +204 -0
- data/Rakefile +15 -0
- data/lib/reve_ai/client.rb +105 -0
- data/lib/reve_ai/configuration.rb +100 -0
- data/lib/reve_ai/errors.rb +194 -0
- data/lib/reve_ai/http/client.rb +208 -0
- data/lib/reve_ai/resources/base.rb +109 -0
- data/lib/reve_ai/resources/images.rb +184 -0
- data/lib/reve_ai/response.rb +136 -0
- data/lib/reve_ai/version.rb +6 -0
- data/lib/reve_ai.rb +90 -0
- metadata +87 -0
data/lib/reve_ai.rb
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "reve_ai/version"
|
|
4
|
+
require_relative "reve_ai/errors"
|
|
5
|
+
require_relative "reve_ai/configuration"
|
|
6
|
+
require_relative "reve_ai/response"
|
|
7
|
+
require_relative "reve_ai/http/client"
|
|
8
|
+
require_relative "reve_ai/resources/base"
|
|
9
|
+
require_relative "reve_ai/resources/images"
|
|
10
|
+
require_relative "reve_ai/client"
|
|
11
|
+
|
|
12
|
+
# Ruby client for the Reve image generation API.
|
|
13
|
+
#
|
|
14
|
+
# ReveAI provides a lightweight Faraday-based wrapper for the Reve API,
|
|
15
|
+
# supporting image creation, editing, and remixing operations.
|
|
16
|
+
#
|
|
17
|
+
# @example Global configuration
|
|
18
|
+
# ReveAI.configure do |config|
|
|
19
|
+
# config.api_key = ENV["REVE_AI_API_KEY"]
|
|
20
|
+
# config.timeout = 120
|
|
21
|
+
# end
|
|
22
|
+
#
|
|
23
|
+
# client = ReveAI::Client.new
|
|
24
|
+
# result = client.images.create(prompt: "A sunset over mountains")
|
|
25
|
+
#
|
|
26
|
+
# @example Per-instance configuration
|
|
27
|
+
# client = ReveAI.client(api_key: "your-api-key", timeout: 60)
|
|
28
|
+
# result = client.images.create(prompt: "A sunset over mountains")
|
|
29
|
+
#
|
|
30
|
+
# @see Client
|
|
31
|
+
# @see Configuration
|
|
32
|
+
# @see https://api.reve.com/console/docs Reve API Documentation
|
|
33
|
+
module ReveAI
|
|
34
|
+
class << self
|
|
35
|
+
# @return [Configuration, nil] Global configuration instance
|
|
36
|
+
attr_accessor :configuration
|
|
37
|
+
|
|
38
|
+
# Configures global settings for all ReveAI clients.
|
|
39
|
+
#
|
|
40
|
+
# @yield [config] Configuration block
|
|
41
|
+
# @yieldparam config [Configuration] Configuration instance to modify
|
|
42
|
+
# @return [Configuration] The configuration instance
|
|
43
|
+
#
|
|
44
|
+
# @example
|
|
45
|
+
# ReveAI.configure do |config|
|
|
46
|
+
# config.api_key = "your-api-key"
|
|
47
|
+
# config.base_url = "https://api.reve.com"
|
|
48
|
+
# config.timeout = 120
|
|
49
|
+
# config.debug = true
|
|
50
|
+
# end
|
|
51
|
+
def configure
|
|
52
|
+
self.configuration ||= Configuration.new
|
|
53
|
+
yield(configuration) if block_given?
|
|
54
|
+
configuration
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Resets the global configuration to nil.
|
|
58
|
+
#
|
|
59
|
+
# Useful for testing or reinitializing the client.
|
|
60
|
+
#
|
|
61
|
+
# @return [nil]
|
|
62
|
+
#
|
|
63
|
+
# @example
|
|
64
|
+
# ReveAI.reset_configuration!
|
|
65
|
+
def reset_configuration!
|
|
66
|
+
self.configuration = nil
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Creates a new API client with optional per-instance configuration.
|
|
70
|
+
#
|
|
71
|
+
# This is a convenience method equivalent to calling {Client.new}.
|
|
72
|
+
#
|
|
73
|
+
# @param api_key [String, nil] API key (defaults to global config or ENV)
|
|
74
|
+
# @param options [Hash] Additional configuration options
|
|
75
|
+
# @option options [String] :base_url Base URL for API requests
|
|
76
|
+
# @option options [Integer] :timeout Request timeout in seconds
|
|
77
|
+
# @option options [Integer] :open_timeout Connection timeout in seconds
|
|
78
|
+
# @option options [Integer] :max_retries Number of retry attempts
|
|
79
|
+
# @option options [Logger] :logger Logger instance for debugging
|
|
80
|
+
# @option options [Boolean] :debug Enable debug logging
|
|
81
|
+
#
|
|
82
|
+
# @return [Client] New client instance
|
|
83
|
+
#
|
|
84
|
+
# @example
|
|
85
|
+
# client = ReveAI.client(api_key: "your-key", timeout: 60)
|
|
86
|
+
def client(api_key: nil, **options)
|
|
87
|
+
Client.new(api_key: api_key, **options)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: reve_ai
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- dpaluy
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: faraday
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '2.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '2.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: faraday-retry
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '2.0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '2.0'
|
|
40
|
+
description: ReveAI provides a lightweight Faraday-based wrapper for the Reve image
|
|
41
|
+
generation API (create, edit, remix images).
|
|
42
|
+
email:
|
|
43
|
+
- dpaluy@users.noreply.github.com
|
|
44
|
+
executables: []
|
|
45
|
+
extensions: []
|
|
46
|
+
extra_rdoc_files:
|
|
47
|
+
- README.md
|
|
48
|
+
files:
|
|
49
|
+
- README.md
|
|
50
|
+
- Rakefile
|
|
51
|
+
- lib/reve_ai.rb
|
|
52
|
+
- lib/reve_ai/client.rb
|
|
53
|
+
- lib/reve_ai/configuration.rb
|
|
54
|
+
- lib/reve_ai/errors.rb
|
|
55
|
+
- lib/reve_ai/http/client.rb
|
|
56
|
+
- lib/reve_ai/resources/base.rb
|
|
57
|
+
- lib/reve_ai/resources/images.rb
|
|
58
|
+
- lib/reve_ai/response.rb
|
|
59
|
+
- lib/reve_ai/version.rb
|
|
60
|
+
homepage: https://github.com/dpaluy/reve_ai
|
|
61
|
+
licenses:
|
|
62
|
+
- MIT
|
|
63
|
+
metadata:
|
|
64
|
+
rubygems_mfa_required: 'true'
|
|
65
|
+
homepage_uri: https://github.com/dpaluy/reve_ai
|
|
66
|
+
documentation_uri: https://rubydoc.info/gems/reve_ai
|
|
67
|
+
source_code_uri: https://github.com/dpaluy/reve_ai
|
|
68
|
+
changelog_uri: https://github.com/dpaluy/reve_ai/blob/master/CHANGELOG.md
|
|
69
|
+
bug_tracker_uri: https://github.com/dpaluy/reve_ai/issues
|
|
70
|
+
rdoc_options: []
|
|
71
|
+
require_paths:
|
|
72
|
+
- lib
|
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
|
+
requirements:
|
|
75
|
+
- - ">="
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: 3.0.0
|
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
requirements: []
|
|
84
|
+
rubygems_version: 4.0.3
|
|
85
|
+
specification_version: 4
|
|
86
|
+
summary: Ruby client for the Reve image generation API.
|
|
87
|
+
test_files: []
|