diff --git a/.github/workflows/publish-ruby-sdk.yml b/.github/workflows/publish-ruby-sdk.yml index d474784eb3c..bb08869b807 100644 --- a/.github/workflows/publish-ruby-sdk.yml +++ b/.github/workflows/publish-ruby-sdk.yml @@ -36,5 +36,5 @@ jobs: # cache-from: type=gha # cache-to: type=gha,mode=min push: true - labels: version=0.9.0-rc1 - tags: fernapi/fern-ruby-sdk:0.9.0-rc1 + labels: version=0.9.0-rc2 + tags: fernapi/fern-ruby-sdk:0.9.0-rc2 diff --git a/generators/ruby/sdk/src/AbstractionUtilities.ts b/generators/ruby/sdk/src/AbstractionUtilities.ts index 09c8a8f3830..7ae89c094c6 100644 --- a/generators/ruby/sdk/src/AbstractionUtilities.ts +++ b/generators/ruby/sdk/src/AbstractionUtilities.ts @@ -625,27 +625,34 @@ export function generateService( name: "initialize", invocationName: "new", // Initialize each subpackage - functionBody: Array.from(subpackages.entries()).map(([spName, sp]) => { - const subpackageClassVariable = new Variable({ - name: getSubpackagePropertyNameFromIr(spName), - type: sp.classReference, - variableType: VariableType.INSTANCE - }); - return new Expression({ - leftSide: subpackageClassVariable, - rightSide: - sp.initializer !== undefined - ? new FunctionInvocation({ - onObject: sp.classReference, - baseFunction: sp.initializer, - arguments_: sp.initializer.parameters.map((param) => - param.toArgument(requestClientProperty.toVariable(VariableType.LOCAL)) - ) - }) - : sp.classReference, + functionBody: [ + new Expression({ + leftSide: requestClientProperty.toVariable(), + rightSide: requestClientProperty.name, isAssignment: true - }); - }), + }), + ...Array.from(subpackages.entries()).map(([spName, sp]) => { + const subpackageClassVariable = new Variable({ + name: getSubpackagePropertyNameFromIr(spName), + type: sp.classReference, + variableType: VariableType.INSTANCE + }); + return new Expression({ + leftSide: subpackageClassVariable, + rightSide: + sp.initializer !== undefined + ? new FunctionInvocation({ + onObject: sp.classReference, + baseFunction: sp.initializer, + arguments_: sp.initializer.parameters.map((param) => + param.toArgument(requestClientProperty.toVariable(VariableType.LOCAL)) + ) + }) + : sp.classReference, + isAssignment: true + }); + }) + ], parameters: [requestClientProperty.toParameter({})], returnValue: syncClassReference, documentation: subpackage.docs @@ -690,27 +697,34 @@ export function generateService( name: "initialize", invocationName: "new", // Initialize each subpackage - functionBody: Array.from(asyncSubpackages.entries()).map(([spName, sp]) => { - const subpackageClassVariable = new Variable({ - name: getSubpackagePropertyNameFromIr(spName), - type: sp.classReference, - variableType: VariableType.INSTANCE - }); - return new Expression({ - leftSide: subpackageClassVariable, - rightSide: - sp.initializer !== undefined - ? new FunctionInvocation({ - onObject: sp.classReference, - baseFunction: sp.initializer, - arguments_: sp.initializer.parameters.map((param) => - param.toArgument(asyncRequestClientProperty.toVariable(VariableType.LOCAL)) - ) - }) - : sp.classReference, + functionBody: [ + new Expression({ + leftSide: requestClientProperty.toVariable(), + rightSide: requestClientProperty.name, isAssignment: true - }); - }), + }), + ...Array.from(asyncSubpackages.entries()).map(([spName, sp]) => { + const subpackageClassVariable = new Variable({ + name: getSubpackagePropertyNameFromIr(spName), + type: sp.classReference, + variableType: VariableType.INSTANCE + }); + return new Expression({ + leftSide: subpackageClassVariable, + rightSide: + sp.initializer !== undefined + ? new FunctionInvocation({ + onObject: sp.classReference, + baseFunction: sp.initializer, + arguments_: sp.initializer.parameters.map((param) => + param.toArgument(asyncRequestClientProperty.toVariable(VariableType.LOCAL)) + ) + }) + : sp.classReference, + isAssignment: true + }); + }) + ], parameters: [requestClientProperty.toParameter({})], returnValue: asyncClassReference, documentation: subpackage.docs