Class: Merge::Filestorage::ExternalTargetFieldApiResponse
- Inherits:
-
Object
- Object
- Merge::Filestorage::ExternalTargetFieldApiResponse
- Defined in:
- lib/merge_ruby_client/filestorage/types/external_target_field_api_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #drive ⇒ Array<Merge::Filestorage::ExternalTargetFieldApi> readonly
- #file ⇒ Array<Merge::Filestorage::ExternalTargetFieldApi> readonly
- #folder ⇒ Array<Merge::Filestorage::ExternalTargetFieldApi> readonly
- #group ⇒ Array<Merge::Filestorage::ExternalTargetFieldApi> readonly
- #user ⇒ Array<Merge::Filestorage::ExternalTargetFieldApi> readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Filestorage::ExternalTargetFieldApiResponse
Deserialize a JSON object to an instance of ExternalTargetFieldApiResponse.
-
.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.
Instance Method Summary collapse
- #initialize(file: OMIT, folder: OMIT, drive: OMIT, group: OMIT, user: OMIT, additional_properties: nil) ⇒ Merge::Filestorage::ExternalTargetFieldApiResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ExternalTargetFieldApiResponse to a JSON object.
Constructor Details
#initialize(file: OMIT, folder: OMIT, drive: OMIT, group: OMIT, user: OMIT, additional_properties: nil) ⇒ Merge::Filestorage::ExternalTargetFieldApiResponse
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/merge_ruby_client/filestorage/types/external_target_field_api_response.rb', line 35 def initialize(file: OMIT, folder: OMIT, drive: OMIT, group: OMIT, user: OMIT, additional_properties: nil) @file = file if file != OMIT @folder = folder if folder != OMIT @drive = drive if drive != OMIT @group = group if group != OMIT @user = user if user != OMIT @additional_properties = additional_properties @_field_set = { "File": file, "Folder": folder, "Drive": drive, "Group": group, "User": user }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
21 22 23 |
# File 'lib/merge_ruby_client/filestorage/types/external_target_field_api_response.rb', line 21 def additional_properties @additional_properties end |
#drive ⇒ Array<Merge::Filestorage::ExternalTargetFieldApi> (readonly)
15 16 17 |
# File 'lib/merge_ruby_client/filestorage/types/external_target_field_api_response.rb', line 15 def drive @drive end |
#file ⇒ Array<Merge::Filestorage::ExternalTargetFieldApi> (readonly)
11 12 13 |
# File 'lib/merge_ruby_client/filestorage/types/external_target_field_api_response.rb', line 11 def file @file end |
#folder ⇒ Array<Merge::Filestorage::ExternalTargetFieldApi> (readonly)
13 14 15 |
# File 'lib/merge_ruby_client/filestorage/types/external_target_field_api_response.rb', line 13 def folder @folder end |
#group ⇒ Array<Merge::Filestorage::ExternalTargetFieldApi> (readonly)
17 18 19 |
# File 'lib/merge_ruby_client/filestorage/types/external_target_field_api_response.rb', line 17 def group @group end |
#user ⇒ Array<Merge::Filestorage::ExternalTargetFieldApi> (readonly)
19 20 21 |
# File 'lib/merge_ruby_client/filestorage/types/external_target_field_api_response.rb', line 19 def user @user end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Filestorage::ExternalTargetFieldApiResponse
Deserialize a JSON object to an instance of ExternalTargetFieldApiResponse
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/merge_ruby_client/filestorage/types/external_target_field_api_response.rb', line 57 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) file = parsed_json["File"]&.map do |item| item = item.to_json Merge::Filestorage::ExternalTargetFieldApi.from_json(json_object: item) end folder = parsed_json["Folder"]&.map do |item| item = item.to_json Merge::Filestorage::ExternalTargetFieldApi.from_json(json_object: item) end drive = parsed_json["Drive"]&.map do |item| item = item.to_json Merge::Filestorage::ExternalTargetFieldApi.from_json(json_object: item) end group = parsed_json["Group"]&.map do |item| item = item.to_json Merge::Filestorage::ExternalTargetFieldApi.from_json(json_object: item) end user = parsed_json["User"]&.map do |item| item = item.to_json Merge::Filestorage::ExternalTargetFieldApi.from_json(json_object: item) end new( file: file, folder: folder, drive: drive, group: group, user: user, 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.
103 104 105 106 107 108 109 |
# File 'lib/merge_ruby_client/filestorage/types/external_target_field_api_response.rb', line 103 def self.validate_raw(obj:) obj.file&.is_a?(Array) != false || raise("Passed value for field obj.file is not the expected type, validation failed.") obj.folder&.is_a?(Array) != false || raise("Passed value for field obj.folder is not the expected type, validation failed.") obj.drive&.is_a?(Array) != false || raise("Passed value for field obj.drive is not the expected type, validation failed.") obj.group&.is_a?(Array) != false || raise("Passed value for field obj.group is not the expected type, validation failed.") obj.user&.is_a?(Array) != false || raise("Passed value for field obj.user is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ExternalTargetFieldApiResponse to a JSON object
93 94 95 |
# File 'lib/merge_ruby_client/filestorage/types/external_target_field_api_response.rb', line 93 def to_json(*_args) @_field_set&.to_json end |