lib/ding/utils/utils.rb in ding_sdk-0.4.3 vs lib/ding/utils/utils.rb in ding_sdk-0.5.0
- old
+ new
@@ -277,12 +277,12 @@
end
end
params
end
- sig { params(clazz: Class, server_url: String, path: String, path_params: FieldAugmented, gbls: T::Hash[Symbol, T::Hash[Symbol, T::Hash[Symbol, Object]]]).returns(String) }
- def self.generate_url(clazz, server_url, path, path_params, gbls)
+ sig { params(clazz: Class, server_url: String, path: String, path_params: FieldAugmented, gbls: T.nilable(T::Hash[Symbol, T::Hash[Symbol, T::Hash[Symbol, Object]]])).returns(String) }
+ def self.generate_url(clazz, server_url, path, path_params, gbls = nil)
clazz.fields.each do |f|
param_metadata = f.metadata[:path_param]
next if param_metadata.nil?
if param_metadata.fetch(:style, 'simple') == 'simple'
@@ -716,10 +716,10 @@
end
url_with_params
end
- sig { params(param_name: Symbol, value: Object, param_type: String, gbls: T::Hash[Symbol, T::Hash[Symbol, T::Hash[Symbol, Object]]]).returns(Object) }
+ sig { params(param_name: Symbol, value: Object, param_type: String, gbls: T.nilable(T::Hash[Symbol, T::Hash[Symbol, T::Hash[Symbol, Object]]])).returns(Object) }
def self._populate_from_globals(param_name, value, param_type, gbls)
if value.nil? && !gbls.nil?
global_value = gbls.dig(:parameters, param_type.to_sym, param_name.to_sym)
value = global_value if !global_value.nil?
end