piston_sdk 0.2.0 → 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: a36996117e89c98c36fa3479f6789dbc9a1d160c729bcb85660e2dff55064eb0
4
- data.tar.gz: b4a2ab4d363581f6235c7ac055db053ef474be9640dc5022904eefb5d160efd6
3
+ metadata.gz: a19908e88f95ee0dfb51692308d52c310e0d1ff3734a7da06aa7964473b82ae3
4
+ data.tar.gz: 82ca4c12f3fe3aace465b6a6f9604873903ddf9634670ce7822501309ed443c4
5
5
  SHA512:
6
- metadata.gz: 663cdbfc6dbf27f92630b907e0920dcd934caee502e67d796daf713cb3156f65c6359aa024a2a42be4f0d1b05de8f76dc99206e477d0aa9895d9302963cbfddd
7
- data.tar.gz: d55471bfac793667c767f74afa02fcd12bb18fcaf51b00172fbbc1b5546732106763ed2fb15d4252f52bbe87fa2f21ec44ecbbd474fa618c6116718f449cf01d
6
+ metadata.gz: a5cf669f74c56086fb33082828d672080ee7a552ae76554d309c6fded180808568be6179ed9709c966f681f78980796cc77adc2f823cb28e610a9b7057a7b67a
7
+ data.tar.gz: 3a0b082fedef872a23f3c61b7db717820ad95fd4b248521a5bf0b6b9f0c70ca88c015ec1a20701ce91b78d741071f6999df7c76d0a32235e90e1c837f59326b4
data/.rubocop.yml CHANGED
@@ -1,6 +1,10 @@
1
1
  AllCops:
2
+ NewCops: enable
2
3
  TargetRubyVersion: 3.1
3
4
 
5
+ Gemspec/RequireMFA:
6
+ Enabled: false
7
+
4
8
  Metrics/AbcSize:
5
9
  Enabled: false
6
10
 
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.4
data/CHANGELOG.md CHANGED
@@ -18,6 +18,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
18
18
 
19
19
  ### Security
20
20
 
21
+ ## 0.3.0 2026-02-22
22
+
23
+ ### Added
24
+
25
+ - Support for new `token` parameter for optional authorization token.
26
+ - Minimum ruby version through `.ruby-version`.
27
+
28
+ ### Fixed
29
+
30
+ - `execute` no longer makes duplicate requests.
31
+
21
32
  ## 0.2.0 2025-09-28
22
33
 
23
34
  ### Added
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PistonSDK
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/piston_sdk.rb CHANGED
@@ -141,6 +141,7 @@ module PistonSDK
141
141
  sig do
142
142
  params(
143
143
  base_url: String,
144
+ token: T.nilable(String),
144
145
  retries: Integer,
145
146
  compile_timeout: T.nilable(Integer),
146
147
  run_timeout: T.nilable(Integer),
@@ -152,6 +153,7 @@ module PistonSDK
152
153
  end
153
154
  def initialize(
154
155
  base_url: "https://emkc.org/api/v2/piston",
156
+ token: nil,
155
157
  retries: 3,
156
158
  compile_timeout: nil,
157
159
  run_timeout: nil,
@@ -161,6 +163,7 @@ module PistonSDK
161
163
  run_memory_limit: nil
162
164
  )
163
165
  @uri = T.let(URI(base_url), URI::Generic)
166
+ @token = T.let(token, T.nilable(String))
164
167
  @retries = T.let(retries, Integer)
165
168
  @compile_timeout = T.let(compile_timeout, T.nilable(Integer))
166
169
  @run_timeout = T.let(run_timeout, T.nilable(Integer))
@@ -203,8 +206,8 @@ module PistonSDK
203
206
  def request(method: :get, path: "", body: nil)
204
207
  req = T.must(@method_classes[method]).new("#{@uri}#{path}")
205
208
  req["Content-Type"] = "application/json"
209
+ req["Authorization"] = @token unless @token.nil?
206
210
  req.body = body.to_json unless body.nil?
207
- res = @http.request(req)
208
211
 
209
212
  (0...@retries).each do |attempt|
210
213
  res = @http.request(req)
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piston_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zahin Zaman
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-02-22 00:00:00.000000000 Z
11
12
  dependencies: []
12
13
  description: piston_sdk is a lightweight Ruby gem for using the Piston API (see https://github.com/engineer-man/piston).
13
14
  email:
@@ -18,6 +19,7 @@ extra_rdoc_files: []
18
19
  files:
19
20
  - ".rspec"
20
21
  - ".rubocop.yml"
22
+ - ".ruby-version"
21
23
  - CHANGELOG.md
22
24
  - LICENSE
23
25
  - README.md
@@ -78,6 +80,7 @@ homepage: https://github.com/alvii147/piston-ruby-sdk
78
80
  licenses:
79
81
  - MIT
80
82
  metadata: {}
83
+ post_install_message:
81
84
  rdoc_options: []
82
85
  require_paths:
83
86
  - lib
@@ -92,7 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
95
  - !ruby/object:Gem::Version
93
96
  version: '0'
94
97
  requirements: []
95
- rubygems_version: 3.6.9
98
+ rubygems_version: 3.3.3
99
+ signing_key:
96
100
  specification_version: 4
97
101
  summary: A lightweight Ruby gem for using the Piston API.
98
102
  test_files: []