Class: Getimg::Client
- Inherits:
-
Object
show all
- Includes:
- HTTParty
- Defined in:
- lib/getimg/client.rb,
lib/getimg/client/models.rb,
lib/getimg/client/account.rb,
lib/getimg/client/enhancements.rb,
lib/getimg/client/stable_diffusion.rb,
lib/getimg/client/stable_diffusion_xl.rb
Overview
Client for the getimg API
Defined Under Namespace
Classes: Account, Enhancements, Models, StableDiffusion, StableDiffusionXl
Instance Method Summary
collapse
Constructor Details
#initialize(api_key = nil) ⇒ Client
Returns a new instance of Client.
22
23
24
|
# File 'lib/getimg/client.rb', line 22
def initialize(api_key = nil)
@api_key = api_key || ENV["GETIMG_API_LEY"]
end
|
Instance Method Details
#account ⇒ Object
42
43
44
|
# File 'lib/getimg/client.rb', line 42
def account
@account ||= Account.new(self)
end
|
#enhancements ⇒ Object
38
39
40
|
# File 'lib/getimg/client.rb', line 38
def enhancements
@enhancements ||= Enhancements.new(self)
end
|
#get(path, options = {}) ⇒ Object
46
47
48
49
|
# File 'lib/getimg/client.rb', line 46
def get(path, options = {})
options = default_request_options.merge({query: options})
handle_response(self.class.get(path, options))
end
|
#models ⇒ Object
26
27
28
|
# File 'lib/getimg/client.rb', line 26
def models
@models ||= Models.new(self)
end
|
#post(path, options = {}, headers = {}) ⇒ Object
51
52
53
54
|
# File 'lib/getimg/client.rb', line 51
def post(path, options = {}, = {})
options = default_request_options().merge({body: options.to_json})
handle_response(self.class.post(path, options))
end
|
#stable_diffusion ⇒ Object
30
31
32
|
# File 'lib/getimg/client.rb', line 30
def stable_diffusion
@stable_diffusion ||= StableDiffusion.new(self)
end
|
#stable_diffusion_xl ⇒ Object
34
35
36
|
# File 'lib/getimg/client.rb', line 34
def stable_diffusion_xl
@stable_diffusion_xl ||= StableDiffusionXl.new(self)
end
|