ruby-magicwrite 0.1.0 → 0.1.1

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: 900f6dc8e52e9c2c4f69dbf3fab75bd5b11bc68bc0eaee46ae690895913a3ff4
4
- data.tar.gz: cfe2b116bb9a1c42c737b80d4392cfef0e43c1bbb400f4e06809130bbe096864
3
+ metadata.gz: a0c716f7c2b2ce16a998fd91bf887347655f93ae07e1a895e09c6ee6b857e43f
4
+ data.tar.gz: 7c5091fa210d5550b2b8d11ff5ca1c918328702052eee631bec8d661b4453856
5
5
  SHA512:
6
- metadata.gz: 29771cba1cf7062bf7b1931c163f50d0d88ed2efaf8960cf4f2f53b60093df82d23553b03e21d97641b1b766e1bfb7fdd782fc76e2f24868f50fa979fca425a5
7
- data.tar.gz: c4904a87fd42af27c4bfb51994d93324444c6a143838e980fdd9fbb49ff70dfa1ed192101e4c879d085a4a280a73a71a9537ce07df44fdac2725e4354cdb5dc9
6
+ metadata.gz: 1c403e98fd0c52c5963cc2dd931bf177c87b7ef826f7a270ff716df0623d0b112fb635c6f7f599e1d27b5dd31ac908bea51dc726d5b6ae0ea15b418ad4098c11
7
+ data.tar.gz: 766121aa9ed0e0bb7083d870d80f5428a451792707675672a4ce55ddfe16af1a3e81151cf2aa3c23f81857943a4cf6831a32d74574f0c645f099d83baa426055
data/CHANGELOG.md CHANGED
@@ -5,10 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.1] - 2023-06-21
9
+
10
+ ### Changed
11
+
12
+ - CHANGELOG
13
+ - README
14
+
15
+
8
16
  ## [0.1.0] - 2023-06-21
9
17
 
10
18
  ### Added
11
19
 
12
20
  - Initialise repository.
13
- - Add MagicWrite::Client to connect to OpenAI API using user tokens.
14
- - Add spec for Client with a cached response using VCR.
21
+ - Add MagicWrite::Client to connect to MagicWrite API using user tokens.
22
+
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-magicwrite (0.1.0)
4
+ ruby-magicwrite (0.1.1)
5
5
  faraday (>= 1)
6
6
  faraday-multipart (>= 1)
7
7
 
@@ -55,18 +55,9 @@ module MagicWrite
55
55
 
56
56
  JSON.parse(string)
57
57
  rescue JSON::ParserError
58
- # Convert a multiline string of JSON objects to a JSON array.
59
58
  JSON.parse(string.gsub("}\n{", '},{').prepend('[').concat(']'))
60
59
  end
61
60
 
62
- # Given a proc, returns an outer proc that can be used to iterate over a JSON stream of chunks.
63
- # For each chunk, the inner user_proc is called giving it the JSON object. The JSON object could
64
- # be a data object or an error object as described in the OpenAI API documentation.
65
- #
66
- # If the JSON object for a given data or error message is invalid, it is ignored.
67
- #
68
- # @param user_proc [Proc] The inner proc to call for each JSON object in the chunk.
69
- # @return [Proc] An outer proc that iterates over a raw stream, converting it to JSON.
70
61
  def to_json_stream(user_proc:)
71
62
  proc do |chunk, _|
72
63
  chunk.scan(/(?:data|error): (\{.*\})/i).flatten.each do |data|
@@ -99,9 +90,6 @@ module MagicWrite
99
90
  parameters&.transform_values do |value|
100
91
  next value unless value.is_a?(File)
101
92
 
102
- # Doesn't seem like OpenAI need mime_type yet, so not worth
103
- # the library to figure this out. Hence the empty string
104
- # as the second argument.
105
93
  Faraday::UploadIO.new(value, '', value.path)
106
94
  end
107
95
  end
@@ -1,3 +1,3 @@
1
1
  module MagicWrite
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-magicwrite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Campos