Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0"
".": "0.1.1"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.1.1 (2026-03-03)

Full Changelog: [v0.1.0...v0.1.1](https://github.com/Hexlet/tilda-ruby/compare/v0.1.0...v0.1.1)

### Bug Fixes

* properly mock time in ruby ci tests ([137828d](https://github.com/Hexlet/tilda-ruby/commit/137828d8011b68ed9b2a5214d425d19b57188146))


### Chores

* **internal:** codegen related update ([84f2624](https://github.com/Hexlet/tilda-ruby/commit/84f262489527dbb97b1298cb9a8ede204dc39e0d))

## 0.1.0 (2026-02-25)

Full Changelog: [v0.0.2...v0.1.0](https://github.com/Hexlet/tilda-ruby/compare/v0.0.2...v0.1.0)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
tilda-ruby (0.1.0)
tilda-ruby (0.1.1)
cgi
connection_pool

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "tilda-ruby", "~> 0.1.0"
gem "tilda-ruby", "~> 0.1.1"
```

<!-- x-release-please-end -->
Expand Down
31 changes: 31 additions & 0 deletions lib/tilda_ruby/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,37 @@ def writable_enum(&blk)
JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}

class << self
# @api private
#
# @param query [Hash{Symbol=>Object}]
#
# @return [Hash{Symbol=>Object}]
def encode_query_params(query)
out = {}
query.each { write_query_param_element!(out, _1, _2) }
out
end

# @api private
#
# @param collection [Hash{Symbol=>Object}]
# @param key [String]
# @param element [Object]
#
# @return [nil]
private def write_query_param_element!(collection, key, element)
case element
in Hash
element.each do |name, value|
write_query_param_element!(collection, "#{key}[#{name}]", value)
end
in Array
collection[key] = element.map(&:to_s).join(",")
else
collection[key] = element.to_s
end
end

# @api private
#
# @param y [Enumerator::Yielder]
Expand Down
6 changes: 4 additions & 2 deletions lib/tilda_ruby/resources/export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ class Export
# @see TildaRuby::Models::ExportRetrieveParams
def retrieve(params)
parsed, options = TildaRuby::ExportRetrieveParams.dump_request(params)
query = TildaRuby::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "v1/getpageexport",
query: parsed,
query: query,
model: TildaRuby::Models::ExportRetrieveResponse,
options: options
)
Expand All @@ -32,10 +33,11 @@ def retrieve(params)
# @see TildaRuby::Models::ExportRetrieveFullParams
def retrieve_full(params)
parsed, options = TildaRuby::ExportRetrieveFullParams.dump_request(params)
query = TildaRuby::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "v1/getpagefullexport",
query: parsed,
query: query,
model: TildaRuby::Models::ExportRetrieveFullResponse,
options: options
)
Expand Down
9 changes: 6 additions & 3 deletions lib/tilda_ruby/resources/pages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ class Pages
# @see TildaRuby::Models::PageRetrieveParams
def retrieve(params)
parsed, options = TildaRuby::PageRetrieveParams.dump_request(params)
query = TildaRuby::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "v1/getpage",
query: parsed,
query: query,
model: TildaRuby::Models::PageRetrieveResponse,
options: options
)
Expand All @@ -32,10 +33,11 @@ def retrieve(params)
# @see TildaRuby::Models::PageListParams
def list(params)
parsed, options = TildaRuby::PageListParams.dump_request(params)
query = TildaRuby::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "v1/getpageslist",
query: parsed,
query: query,
model: TildaRuby::Models::PageListResponse,
options: options
)
Expand All @@ -51,10 +53,11 @@ def list(params)
# @see TildaRuby::Models::PageRetrieveFullParams
def retrieve_full(params)
parsed, options = TildaRuby::PageRetrieveFullParams.dump_request(params)
query = TildaRuby::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "v1/getpagefull",
query: parsed,
query: query,
model: TildaRuby::Models::PageRetrieveFullResponse,
options: options
)
Expand Down
3 changes: 2 additions & 1 deletion lib/tilda_ruby/resources/projects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ class Projects
# @see TildaRuby::Models::ProjectRetrieveParams
def retrieve(params)
parsed, options = TildaRuby::ProjectRetrieveParams.dump_request(params)
query = TildaRuby::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "v1/getprojectinfo",
query: parsed,
query: query,
model: TildaRuby::Models::ProjectRetrieveResponse,
options: options
)
Expand Down
2 changes: 1 addition & 1 deletion lib/tilda_ruby/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module TildaRuby
VERSION = "0.1.0"
VERSION = "0.1.1"
end
20 changes: 20 additions & 0 deletions rbi/tilda_ruby/internal/util.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,26 @@ module TildaRuby
T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp)

class << self
# @api private
sig do
params(query: TildaRuby::Internal::AnyHash).returns(
TildaRuby::Internal::AnyHash
)
end
def encode_query_params(query)
end

# @api private
sig do
params(
collection: TildaRuby::Internal::AnyHash,
key: String,
element: T.anything
).void
end
private def write_query_param_element!(collection, key, element)
end

# @api private
sig do
params(
Expand Down
10 changes: 10 additions & 0 deletions sig/tilda_ruby/internal/util.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ module TildaRuby
JSON_CONTENT: Regexp
JSONL_CONTENT: Regexp

def encode_query_params: (
::Hash[Symbol, top] query
) -> ::Hash[Symbol, top]

private def write_query_param_element!: (
::Hash[Symbol, top] collection,
String key,
top element
) -> nil

def self?.write_multipart_content: (
Enumerator::Yielder y,
val: top,
Expand Down
8 changes: 5 additions & 3 deletions test/tilda_ruby/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,11 @@ def test_client_retry_after_seconds
end

def test_client_retry_after_date
time_now = Time.now

stub_request(:get, "http://localhost/v1/getprojectslist?publickey,secretkey").to_return_json(
status: 500,
headers: {"retry-after" => (Time.now + 10).httpdate},
headers: {"retry-after" => (time_now + 10).httpdate},
body: {}
)

Expand All @@ -147,11 +149,11 @@ def test_client_retry_after_date
max_retries: 1
)

Thread.current.thread_variable_set(:time_now, time_now)
assert_raises(TildaRuby::Errors::InternalServerError) do
Thread.current.thread_variable_set(:time_now, Time.now)
tilda.projects.list
Thread.current.thread_variable_set(:time_now, nil)
end
Thread.current.thread_variable_set(:time_now, nil)

assert_requested(:any, /./, times: 2)
assert_in_delta(10, Thread.current.thread_variable_get(:mock_sleep).last, 1.0)
Expand Down
Loading