Method: Zitadel::Client::Models::IdentityProviderServiceRpcStatus._deserialize

Defined in:
lib/zitadel/client/models/identity_provider_service_rpc_status.rb

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/zitadel/client/models/identity_provider_service_rpc_status.rb', line 155

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf/anyOf constructs that resolve to a model name
    # MODIFIED: Ensure model is looked up in the Models namespace
    # 'type' here is expected to be the simple class name (e.g., "User", "OrderDetails")
    klass = Zitadel::Client::Models.const_get(type)
    # The `klass.build` method is for oneOf/anyOf types (defined in partial_oneof_module.mustache / partial_anyof_module.mustache)
    # The `klass.build_from_hash` is for regular model types (defined in this base_object.mustache itself)
    if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_allOf)
      klass.build(value) # For oneOf/anyOf/allOf, delegate to their specific build method
    else
      klass.build_from_hash(value) # For regular models
    end
  end
end