leoandruby 0.1.1 → 0.1.2

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: 149d2e54ecda2eac9a33142240dd62f5b108741e0f5071b0a93a3290fec5ce10
4
- data.tar.gz: 444ff02b5545bfb777847096c83efb9479cafa0951481cf879aa186a01a16c8e
3
+ metadata.gz: 9d4a487c7ba83376e79ce73f898ebe75378f2df1d3fbedb6668a5b51b3641ece
4
+ data.tar.gz: 954f1e0cb9f0f3ced2fc853059e77825693a1cf6f57cdf84f827049ddb862add
5
5
  SHA512:
6
- metadata.gz: bca73afb65e1f65ab6468b2a6d2b31f04e601bd15284f7528e8d7bfa1ccbca5454ae4da10b958a84cec873bd3043e62f8979b7a2502f6d92bcdbcacd498989a9
7
- data.tar.gz: ed281dbcd565b839151cf828ab0ae31cee02c60355f7b46011b59160670d007f72db87c5f1608b31aa3b67399a217febaf908e2730f8adff2d2119c4b6d371af
6
+ metadata.gz: 46c3a77f0c5a3bd4970f9b137b64bbeda9595e3a454e71bf5aaa53784f578534feb5984867a9d97860d1a85234b2c6e1f2af80751ce3d649a9be64a84b088f54
7
+ data.tar.gz: dd969b602250d6eb442b465c483faf8a5be90d32178b9b83ee978493f4dd26418e3f8857bd71a76e3384010030b0340d7ce89c5aef0565bd5889d27567e10330
data/README.md CHANGED
@@ -3,6 +3,9 @@
3
3
 
4
4
  **LeoAndRuby** is a Ruby gem for generating images using the [Leonardo.ai API](https://docs.leonardo.ai/docs/generate-your-first-images). With this gem, you can easily integrate Leonardo.ai's powerful image generation capabilities into your Ruby applications.
5
5
 
6
+ [![Gem Version](https://badge.fury.io/rb/leoandruby.svg)](https://badge.fury.io/rb/leoandruby)
7
+
8
+
6
9
  ---
7
10
 
8
11
  ## Features
@@ -1,10 +1,10 @@
1
- require 'net/http'
2
- require 'json'
3
- require 'uri'
1
+ require "net/http"
2
+ require "json"
3
+ require "uri"
4
4
 
5
5
  module LeoAndRuby
6
6
  class Client
7
- API_BASE_URL = 'https://cloud.leonardo.ai/api/rest/v1'.freeze
7
+ API_BASE_URL = "https://cloud.leonardo.ai/api/rest/v1".freeze
8
8
 
9
9
  def initialize(api_key)
10
10
  @api_key = api_key
@@ -13,9 +13,9 @@ module LeoAndRuby
13
13
  def generate_image(prompt:, model_id:, width:, height:)
14
14
  uri = URI("#{API_BASE_URL}/generations")
15
15
  request = Net::HTTP::Post.new(uri)
16
- request['Accept'] = 'application/json'
17
- request['Authorization'] = "Bearer #{@api_key}"
18
- request['Content-Type'] = 'application/json'
16
+ request["Accept"] = "application/json"
17
+ request["Authorization"] = "Bearer #{@api_key}"
18
+ request["Content-Type"] = "application/json"
19
19
 
20
20
  request.body = {
21
21
  prompt: prompt,
@@ -34,8 +34,8 @@ module LeoAndRuby
34
34
  def get_generation(generation_id)
35
35
  uri = URI("#{API_BASE_URL}/generations/#{generation_id}")
36
36
  request = Net::HTTP::Get.new(uri)
37
- request['Accept'] = 'application/json'
38
- request['Authorization'] = "Bearer #{@api_key}"
37
+ request["Accept"] = "application/json"
38
+ request["Authorization"] = "Bearer #{@api_key}"
39
39
 
40
40
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
41
41
  http.request(request)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leoandruby
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/leoandruby.rb CHANGED
@@ -1,4 +1,3 @@
1
- #lib/leoandruby.rb
2
-
3
- require_relative 'leoandruby/client'
1
+ # lib/leoandruby.rb
4
2
 
3
+ require_relative "leoandruby/client"
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.1.1
4
+ version: 0.1.2
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-20 00:00:00.000000000 Z
11
+ date: 2024-11-21 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