Class: ReveAI::Client
- Inherits:
-
Object
- Object
- ReveAI::Client
- Defined in:
- lib/reve_ai/client.rb
Overview
HTTP client for the Reve image generation API.
Provides access to all Reve API endpoints through resource objects. Configure globally via configure or pass parameters directly to the constructor.
Instance Attribute Summary collapse
-
#configuration ⇒ Configuration
readonly
Configuration instance for this client.
Instance Method Summary collapse
-
#effects ⇒ Resources::Effects
Returns the Effects resource for listing available effects.
-
#http_client ⇒ HTTP::Client
private
Returns the HTTP client for making API requests.
-
#images ⇒ Resources::Images
Returns the Images resource for image generation operations.
-
#initialize(api_key: nil, **options) ⇒ Client
constructor
Creates a new Reve API client.
-
#v2 ⇒ Resources::V2
Returns the v2 API namespace (image create and layout endpoints).
Constructor Details
#initialize(api_key: nil, **options) ⇒ Client
Creates a new Reve API client.
45 46 47 48 |
# File 'lib/reve_ai/client.rb', line 45 def initialize(api_key: nil, **) @configuration = build_configuration(api_key, ) validate_configuration! end |
Instance Attribute Details
#configuration ⇒ Configuration (readonly)
Returns Configuration instance for this client.
28 29 30 |
# File 'lib/reve_ai/client.rb', line 28 def configuration @configuration end |
Instance Method Details
#effects ⇒ Resources::Effects
Returns the Effects resource for listing available effects.
82 83 84 |
# File 'lib/reve_ai/client.rb', line 82 def effects @effects ||= Resources::Effects.new(self) end |
#http_client ⇒ HTTP::Client
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the HTTP client for making API requests.
105 106 107 |
# File 'lib/reve_ai/client.rb', line 105 def http_client @http_client ||= HTTP::Client.new(configuration) end |
#images ⇒ Resources::Images
Returns the Images resource for image generation operations.
70 71 72 |
# File 'lib/reve_ai/client.rb', line 70 def images @images ||= Resources::Images.new(self) end |
#v2 ⇒ Resources::V2
Returns the v2 API namespace (image create and layout endpoints).
97 98 99 |
# File 'lib/reve_ai/client.rb', line 97 def v2 @v2 ||= Resources::V2.new(self) end |