Class: Merge::Filestorage::MetaResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/filestorage/types/meta_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_schema:, has_conditional_params:, has_required_linked_account_params:, remote_field_classes: OMIT, status: OMIT, additional_properties: nil) ⇒ Merge::Filestorage::MetaResponse

Parameters:

  • request_schema (Hash{String => Object})
  • remote_field_classes (Hash{String => Object}) (defaults to: OMIT)
  • status (Merge::Filestorage::LinkedAccountStatus) (defaults to: OMIT)
  • has_conditional_params (Boolean)
  • has_required_linked_account_params (Boolean)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/merge_ruby_client/filestorage/types/meta_response.rb', line 35

def initialize(request_schema:, has_conditional_params:, has_required_linked_account_params:,
               remote_field_classes: OMIT, status: OMIT, additional_properties: nil)
  @request_schema = request_schema
  @remote_field_classes = remote_field_classes if remote_field_classes != OMIT
  @status = status if status != OMIT
  @has_conditional_params = has_conditional_params
  @has_required_linked_account_params = 
  @additional_properties = additional_properties
  @_field_set = {
    "request_schema": request_schema,
    "remote_field_classes": remote_field_classes,
    "status": status,
    "has_conditional_params": has_conditional_params,
    "has_required_linked_account_params": 
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



21
22
23
# File 'lib/merge_ruby_client/filestorage/types/meta_response.rb', line 21

def additional_properties
  @additional_properties
end

#has_conditional_paramsBoolean (readonly)

Returns:

  • (Boolean)


17
18
19
# File 'lib/merge_ruby_client/filestorage/types/meta_response.rb', line 17

def has_conditional_params
  @has_conditional_params
end

#has_required_linked_account_paramsBoolean (readonly)

Returns:

  • (Boolean)


19
20
21
# File 'lib/merge_ruby_client/filestorage/types/meta_response.rb', line 19

def 
  @has_required_linked_account_params
end

#remote_field_classesHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


13
14
15
# File 'lib/merge_ruby_client/filestorage/types/meta_response.rb', line 13

def remote_field_classes
  @remote_field_classes
end

#request_schemaHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


11
12
13
# File 'lib/merge_ruby_client/filestorage/types/meta_response.rb', line 11

def request_schema
  @request_schema
end

#statusMerge::Filestorage::LinkedAccountStatus (readonly)



15
16
17
# File 'lib/merge_ruby_client/filestorage/types/meta_response.rb', line 15

def status
  @status
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Filestorage::MetaResponse

Deserialize a JSON object to an instance of MetaResponse

Parameters:

  • json_object (String)

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/merge_ruby_client/filestorage/types/meta_response.rb', line 58

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  request_schema = parsed_json["request_schema"]
  remote_field_classes = parsed_json["remote_field_classes"]
  if parsed_json["status"].nil?
    status = nil
  else
    status = parsed_json["status"].to_json
    status = Merge::Filestorage::LinkedAccountStatus.from_json(json_object: status)
  end
  has_conditional_params = parsed_json["has_conditional_params"]
   = parsed_json["has_required_linked_account_params"]
  new(
    request_schema: request_schema,
    remote_field_classes: remote_field_classes,
    status: status,
    has_conditional_params: has_conditional_params,
    has_required_linked_account_params: ,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


94
95
96
97
98
99
100
# File 'lib/merge_ruby_client/filestorage/types/meta_response.rb', line 94

def self.validate_raw(obj:)
  obj.request_schema.is_a?(Hash) != false || raise("Passed value for field obj.request_schema is not the expected type, validation failed.")
  obj.remote_field_classes&.is_a?(Hash) != false || raise("Passed value for field obj.remote_field_classes is not the expected type, validation failed.")
  obj.status.nil? || Merge::Filestorage::LinkedAccountStatus.validate_raw(obj: obj.status)
  obj.has_conditional_params.is_a?(Boolean) != false || raise("Passed value for field obj.has_conditional_params is not the expected type, validation failed.")
  obj..is_a?(Boolean) != false || raise("Passed value for field obj.has_required_linked_account_params is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of MetaResponse to a JSON object

Returns:

  • (String)


84
85
86
# File 'lib/merge_ruby_client/filestorage/types/meta_response.rb', line 84

def to_json(*_args)
  @_field_set&.to_json
end