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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2,497 changes: 1,251 additions & 1,246 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
speakeasyVersion: 1.709.1
speakeasyVersion: 1.718.0
sources:
my-source:
sourceNamespace: my-source
sourceRevisionDigest: sha256:1b93ba775f35590a5836baf509f0283bf1a2f09989d0ad3420f19624064febd6
sourceBlobDigest: sha256:fb5df315dd5137dff5b3b7b80898ec48f6b67c67b8707c898d7c038529246c6c
sourceRevisionDigest: sha256:c9e306844028ae11d5a8f4f890b8519f85adfab5a67aa83d9a17a1a68baacb54
sourceBlobDigest: sha256:6b3e07d0928f3f26f25a2e58b8952744436c8f843f0de13125301371130adcd8
tags:
- latest
- speakeasy-sdk-regen-1769536154
- speakeasy-sdk-regen-1771233312
- 1.0.0
targets:
StackOneRubyClient:
source: my-source
sourceNamespace: my-source
sourceRevisionDigest: sha256:1b93ba775f35590a5836baf509f0283bf1a2f09989d0ad3420f19624064febd6
sourceBlobDigest: sha256:fb5df315dd5137dff5b3b7b80898ec48f6b67c67b8707c898d7c038529246c6c
sourceRevisionDigest: sha256:c9e306844028ae11d5a8f4f890b8519f85adfab5a67aa83d9a17a1a68baacb54
sourceBlobDigest: sha256:6b3e07d0928f3f26f25a2e58b8952744436c8f843f0de13125301371130adcd8
codeSamplesNamespace: code-samples-ruby-stackonerubyclient
codeSamplesRevisionDigest: sha256:e3cc5a542a2eda87cce1df0d0c16e3ab496c2fad2a5d7ed0b5518586437c9cd6
codeSamplesRevisionDigest: sha256:33359a69bef4aaf80fa2ef44e4d2869eff7170442bfbe464bd8ddc971f4ccf78
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@
<!-- Start Summary [summary] -->
## Summary

Accounting: The documentation for the StackOne Unified API - ACCOUNTING
Accounting: The documentation for the StackOne API
The documentation for the StackOne Unified API - HRIS
The documentation for the StackOne Unified API - ATS
The documentation for the StackOne Unified API - CRM
The documentation for the StackOne Unified API - MARKETING
The documentation for the StackOne Unified API - LMS
The documentation for the StackOne Unified API - IAM
The documentation for the StackOne Unified API - TICKETING
The documentation for the StackOne Unified API - DOCUMENTS
The documentation for the StackOne Unified API - SCREENING
The documentation for the StackOne Unified API - MESSAGING
The documentation for the StackOne Unified API - ACCOUNTING
<!-- End Summary [summary] -->

<!-- Start Table of Contents [toc] -->
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1088,4 +1088,14 @@ Based on:
### Generated
- [ruby v0.39.5] .
### Releases
- [Ruby Gems v0.39.5] https://rubygems.org/gems/stackone_client/versions/0.39.5 - .
- [Ruby Gems v0.39.5] https://rubygems.org/gems/stackone_client/versions/0.39.5 - .

## 2026-02-16 09:14:49
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.718.0 (2.824.1) https://github.com/speakeasy-api/speakeasy
### Generated
- [ruby v0.40.0] .
### Releases
- [Ruby Gems v0.40.0] https://rubygems.org/gems/stackone_client/versions/0.40.0 - .
568 changes: 284 additions & 284 deletions codeSamples.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/models/shared/linkedaccount.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
| `provider` | *::String* | :heavy_check_mark: | N/A | |
| `provider_name` | *T.nilable(::String)* | :heavy_minus_sign: | N/A | |
| `setup_information` | T::Hash[Symbol, *::Object*] | :heavy_minus_sign: | N/A | |
| `shared` | *T.nilable(T::Boolean)* | :heavy_minus_sign: | N/A | |
| `status` | [Models::Shared::LinkedAccountStatus](../../models/shared/linkedaccountstatus.md) | :heavy_check_mark: | N/A | |
| `status_reasons` | T::Array<[Models::Shared::StatusReason](../../models/shared/statusreason.md)> | :heavy_minus_sign: | N/A | |
| `type` | [T.nilable(Models::Shared::LinkedAccountType)](../../models/shared/linkedaccounttype.md) | :heavy_minus_sign: | The account type | [<br/>"PRODUCTION",<br/>"TEST"<br/>] |
Expand Down
1 change: 1 addition & 0 deletions docs/models/shared/patchaccountexternaldto.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
| `provider` | *T.nilable(::String)* | :heavy_minus_sign: | N/A | |
| `secrets` | [T.nilable(Models::Shared::Secrets)](../../models/shared/secrets.md) | :heavy_minus_sign: | N/A | |
| `setup_information` | [T.nilable(Models::Shared::SetupInformation)](../../models/shared/setupinformation.md) | :heavy_minus_sign: | N/A | |
| `shared` | *T.nilable(T::Boolean)* | :heavy_minus_sign: | N/A | |
| `type` | [T.nilable(Models::Shared::PatchAccountExternalDtoType)](../../models/shared/patchaccountexternaldtotype.md) | :heavy_minus_sign: | The account type | [<br/>"PRODUCTION",<br/>"TEST"<br/>] |
2 changes: 1 addition & 1 deletion extra.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -3885,4 +3885,4 @@ class DateTime
def self.civil_from_format(utc_or_local, year, month=T.unsafe(nil), day=T.unsafe(nil), hour=T.unsafe(nil), min=T.unsafe(nil), sec=T.unsafe(nil)); end

def self.new(*arg); end
end
end
5 changes: 4 additions & 1 deletion gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ generation:
generateNewTests: false
skipResponseBodyAssertions: false
ruby:
version: 0.39.5
version: 0.40.0
additionalDependencies:
development: {}
runtime: {}
Expand All @@ -37,6 +37,8 @@ ruby:
defaultErrorName: APIError
description: Ruby Client SDK Generated by Speakeasy
flattenGlobalSecurity: false
forwardCompatibleEnumsByDefault: false
forwardCompatibleUnionsByDefault: "false"
imports:
option: openapi
paths:
Expand All @@ -53,3 +55,4 @@ ruby:
outputModelSuffix: output
packageName: stackone_client
typingStrategy: sorbet
unionStrategy: left-to-right
17 changes: 17 additions & 0 deletions lib/crystalline/enum.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# typed: true

module Crystalline
module Enum
mixes_in_class_methods(ClassMethods)

module ClassMethods
def enums(&blk); end
def open!; end
def open?; end
def deserialize(val); end
end

def serialize; end
def known?; end
end
end
34 changes: 20 additions & 14 deletions lib/crystalline/metadata_fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def from_dict(d)
# If field is nilable, and the value is not in the dict, just move to the next field
next if value.nil?

if Crystalline::Utils.arr? field_type
if field_type.is_a?(Crystalline::DiscriminatedUnion)
to_build[key] = field_type.parse(value)
elsif Crystalline::Utils.arr? field_type
inner_type = Crystalline::Utils.arr_of(field_type)
unmarshalled_array = value.map { |f| unmarshal_single(inner_type, f, format_metadata) }
to_build[key] = unmarshalled_array
Expand Down Expand Up @@ -112,17 +114,21 @@ def from_dict(d)
union_types = Crystalline::Utils.get_union_types(field_type)
union_types = union_types.sort_by { |klass| Crystalline.non_nilable_attr_count(klass) }

union_types.each do |union_type|
begin
to_build[key] = Crystalline.unmarshal_json(value, union_type)
rescue TypeError
next
rescue NoMethodError
next
rescue KeyError
next
if Crystalline.union_strategy == :populated_fields
to_build[key] = Crystalline.unmarshal_union_populated_fields(value, union_types)
else
union_types.each do |union_type|
begin
to_build[key] = Crystalline.unmarshal_json(value, union_type)
rescue TypeError
next
rescue NoMethodError
next
rescue KeyError
next
end
break
end
break
end
end
elsif field_type.instance_of?(Class) && field_type.include?(::Crystalline::MetadataFields)
Expand Down Expand Up @@ -182,10 +188,10 @@ def to_dict
next if f.nil? && !required
result[key] = nil if f.nil? && required

if f.is_a? Array
if f.is_a? ::Array
result[key] = f.map { |o| marshal_single(o) }
elsif f.is_a? Hash
result[key] = f.map { |k, v| [k, marshal_single(v)] }
elsif f.is_a? ::Hash
result[key] = f.transform_values { |v| marshal_single(v) }
else
result[key] = marshal_single(f)
end
Expand Down
106 changes: 96 additions & 10 deletions lib/crystalline/module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
# frozen_string_literal: true

module Crystalline
@union_strategy = :left_to_right

class << self
attr_accessor :union_strategy
end

def self.to_dict(complex)
if complex.is_a? Array
Expand All @@ -29,21 +34,18 @@ def self.unmarshal_json(data, type)
if Crystalline::Utils.nilable? type
type = Crystalline::Utils.nilable_of type
end
if type.instance_of?(Class) && type.include?(::Crystalline::MetadataFields)
if type.is_a?(Crystalline::DiscriminatedUnion)
type.parse(data)
elsif type.instance_of?(Class) && type.include?(::Crystalline::MetadataFields)
type.from_dict(data)
elsif Crystalline::Utils.union? type
union_types = Crystalline::Utils.get_union_types(type)
union_types = union_types.sort_by { |klass| Crystalline.non_nilable_attr_count(klass) }

union_types.each do |union_type|
unmarshalled_val = Crystalline.unmarshal_json(data, union_type)
return unmarshalled_val
rescue TypeError
next
rescue NoMethodError
next
rescue KeyError
next
if Crystalline.union_strategy == :populated_fields
Crystalline.unmarshal_union_populated_fields(data, union_types)
else
Crystalline.unmarshal_union_left_to_right(data, union_types)
end
elsif Crystalline::Utils.arr? type
data.map { |v| Crystalline.unmarshal_json(v, Crystalline::Utils.arr_of(type)) }
Expand All @@ -55,6 +57,8 @@ def self.unmarshal_json(data, type)
Crystalline::Utils.to_boolean(data)
elsif type.is_a?(Class) && type < T::Enum
type.deserialize(data)
elsif type.is_a?(Class) && type.respond_to?(:enums) && type.respond_to?(:deserialize)
type.deserialize(data)
else
data
end
Expand All @@ -74,6 +78,88 @@ def self.json_encode(val, primitives: true)
end
end

def self.unmarshal_union_left_to_right(data, union_types)
union_types.each do |union_type|
return Crystalline.unmarshal_json(data, union_type)
rescue TypeError
next
rescue NoMethodError
next
rescue KeyError
next
end
nil
end

def self.unmarshal_union_populated_fields(data, union_types)
best_value = nil
best_matched = -1
best_inexact = 0
best_unmatched = 0

union_types.each do |union_type|
value = Crystalline.unmarshal_json(data, union_type)
matched, inexact, unmatched = count_matched_fields(value, data)

if best_value.nil? ||
matched > best_matched ||
(matched == best_matched && inexact < best_inexact) ||
(matched == best_matched && inexact == best_inexact && unmatched < best_unmatched)
best_value = value
best_matched = matched
best_inexact = inexact
best_unmatched = unmatched
end
rescue TypeError
next
rescue NoMethodError
next
rescue KeyError
next
end
best_value
end

def self.count_matched_fields(value, raw_data)
matched = 0
inexact = 0
unmatched = 0

if value.is_a?(Crystalline::Unknown)
return [0, 0, 0]
elsif value.class.include?(::Crystalline::MetadataFields)
value.fields.each do |field|
format_metadata = field.metadata.fetch(:format_json, {})
lookup = format_metadata.fetch(:letter_case, nil)&.call
field_val = value.send(field.name)

if raw_data.is_a?(::Hash) && lookup && raw_data.key?(lookup)
if field_val.class.include?(::Crystalline::MetadataFields) && raw_data[lookup].is_a?(::Hash)
nested_matched, nested_inexact, nested_unmatched = count_matched_fields(field_val, raw_data[lookup])
matched += nested_matched
inexact += nested_inexact
unmatched += nested_unmatched
else
matched += 1
if field_val.respond_to?(:known?) && !field_val.known?
inexact += 1
end
end
elsif !::Crystalline::Utils.nilable?(field.type)
unmatched += 1
end
end
elsif value.is_a?(::Array)
matched = value.length
elsif value.is_a?(::Hash)
matched = value.length
else
matched = 1
end

[matched, inexact, unmatched]
end

def self.non_nilable_attr_count(klass)
# somewhat sane sort ordering for Union deserialization.
# All Crystalline objects return the number of non-nilable fields
Expand Down
Loading