leoandruby 0.2.2 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe0711c73076d9149ebfada02f0958439fe3b198324d35babcf954b5582c45b0
4
- data.tar.gz: 734e3b02212a9e9e27097fe11a8972517cb666509737bd1fde82dc8f492a1e62
3
+ metadata.gz: 7522b23651a0856c37a0c3dd0905b35f630f4b5eb57dba784b0a1d907dbcf670
4
+ data.tar.gz: 429364affc88fd9b428aa8bceb05414077918d2a20aacb8d72db0de4b79189b8
5
5
  SHA512:
6
- metadata.gz: 1b303d0be8d7ebf321652c8418e373eae684534743575a8bc82250bdb76dbefb75b397fd007d33b8efd2adf189ac3c116c6ead25aaec8094676ed4c2c8e8ef02
7
- data.tar.gz: 6f37e842ed742d722c0a57899b4131a3331cb4a0fd5760f8b561b65b8417dbd0e3adfd18515c254b259726a0af0bdcb0e725232421b9ebb389aeb4430b046787
6
+ metadata.gz: b977f50edc64edc3963ce25169dc4e300160c7a22a2606ff262ffe3b1076d205ba1c109ad4841ba9abff95da4c1e83041a710df6597caa1de8fc9afbfeadb750
7
+ data.tar.gz: 25679bce91e27cd095c8de5a9317560097dd932069e9daa0a6a415fb677335736cae1be8a56c98bc824f0dd8258de9a2a19a5dac68cf164302a58e5c8c61e3d7
data/CHANGELOG.md CHANGED
@@ -22,4 +22,8 @@
22
22
 
23
23
  ## [0.2.2] - 2024-11-22
24
24
 
25
- - Fixed: Another bug
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.2"
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.2
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