leoandruby 0.2.1 → 0.3.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: d08e4e83b6414b66ee4c7886035d979b22d8900ec86f87a810f73f083a9ba35c
4
- data.tar.gz: e5ae5c28619eb03d3373c1d8eeded218d7622d651eeb28e608dfc9728d51707b
3
+ metadata.gz: 7522b23651a0856c37a0c3dd0905b35f630f4b5eb57dba784b0a1d907dbcf670
4
+ data.tar.gz: 429364affc88fd9b428aa8bceb05414077918d2a20aacb8d72db0de4b79189b8
5
5
  SHA512:
6
- metadata.gz: 7c0d03f7978a1371ebc6d3974fbc6254b104a3a8ca337b93f84d9c522b2c2f83f058201dab30bafce79838eb76eeeb3b46211fbe0e24876424691bd52b0b3bf7
7
- data.tar.gz: 5a2fc24092d32710e8660097acc44611e0668944acbae73241ba2c8e07998f02e481b2559872d1023a0a5f926d492217809493460700dfd5f95c0eb835145c46
6
+ metadata.gz: b977f50edc64edc3963ce25169dc4e300160c7a22a2606ff262ffe3b1076d205ba1c109ad4841ba9abff95da4c1e83041a710df6597caa1de8fc9afbfeadb750
7
+ data.tar.gz: 25679bce91e27cd095c8de5a9317560097dd932069e9daa0a6a415fb677335736cae1be8a56c98bc824f0dd8258de9a2a19a5dac68cf164302a58e5c8c61e3d7
data/CHANGELOG.md CHANGED
@@ -18,4 +18,12 @@
18
18
 
19
19
  ## [0.2.1] - 2024-11-22
20
20
 
21
- - Fixed: Fixed issue with gemfile preventing bundle install functioning properly.
21
+ - Fixed: Fixed issue with gemfile preventing bundle install functioning properly.
22
+
23
+ ## [0.2.2] - 2024-11-22
24
+
25
+ - Fixed: Another bug fix
26
+
27
+ ## [0.3.0] - 2024-11-25
28
+
29
+ - Added: New feature allowing user to display a list of all the available models.
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2024 Richard HW Baldwin
3
+ Copyright (c) 2024 Richard HW Baldwin and Empire Creative, LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -73,7 +73,18 @@ generation_response = client.generate_image(
73
73
  generation_id = generation_response['sdGenerationJob']['generationId']
74
74
  ```
75
75
 
76
- ### 3. Retrieve the Generated Image
76
+ ### 3. List Available Models
77
+
78
+ You can fetch a list of all available platform models using the `list_models` method:
79
+
80
+ ```ruby
81
+ models_response = client.list_models
82
+ puts models_response
83
+ ```
84
+
85
+ This will return a list of models available in the Leonardo.ai platform.
86
+
87
+ ### 4. Retrieve the Generated Image
77
88
 
78
89
  Wait a few seconds for the image to be generated, then retrieve it using the generation ID:
79
90
 
@@ -105,6 +116,32 @@ client = LeoAndRuby::Client.new(api_key)
105
116
 
106
117
  ---
107
118
 
119
+ ## Expected Response for List Models
120
+
121
+ The `list_models` method will return a response in the following format:
122
+
123
+ ```json
124
+ {
125
+ "custom_models": [
126
+ {
127
+ "id": "model_id_1",
128
+ "name": "Model Name 1",
129
+ "description": "Description of Model 1",
130
+ "nsfw": false,
131
+ },
132
+ {
133
+ "id": "model_id_2",
134
+ "name": "Model Name 2",
135
+ "description": "Description of Model 2",
136
+ "nsfw": false,
137
+ }
138
+ // More models...
139
+ ]
140
+ }
141
+ ```
142
+
143
+ Each model object contains the `id`, `name`, `description`, and `created_at` fields.
144
+
108
145
  ## Example Script
109
146
 
110
147
  Here's a full example script:
@@ -45,6 +45,19 @@ module LeoAndRuby
45
45
  handle_response(response)
46
46
  end
47
47
 
48
+ def list_models
49
+ uri = URI("#{API_BASE_URL}/platformModels")
50
+ request = Net::HTTP::Get.new(uri)
51
+ request["Accept"] = "application/json"
52
+ request["Authorization"] = "Bearer #{@api_key}"
53
+
54
+ response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
55
+ http.request(request)
56
+ end
57
+
58
+ handle_response(response)
59
+ end
60
+
48
61
  private
49
62
 
50
63
  def handle_response(response)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leoandruby
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leoandruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard HW Baldwin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-21 00:00:00.000000000 Z
11
+ date: 2024-11-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: LeoAndRuby is a Ruby gem for integrating with the Leonardo.ai API, enabling
14
14
  seamless image generation within Ruby applications. It provides a simple and intuitive