Class: Merge::Filestorage::DownloadRequestMeta

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, url:, method:, headers:, additional_properties: nil) ⇒ Merge::Filestorage::DownloadRequestMeta



31
32
33
34
35
36
37
38
# File 'lib/merge_ruby_client/filestorage/types/download_request_meta.rb', line 31

def initialize(id:, url:, method:, headers:, additional_properties: nil)
  @id = id
  @url = url
  @method = method
  @headers = headers
  @additional_properties = additional_properties
  @_field_set = { "id": id, "url": url, "method": method, "headers": headers }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



18
19
20
# File 'lib/merge_ruby_client/filestorage/types/download_request_meta.rb', line 18

def additional_properties
  @additional_properties
end

#headersHash{String => Object} (readonly)



16
17
18
# File 'lib/merge_ruby_client/filestorage/types/download_request_meta.rb', line 16

def headers
  @headers
end

#idString (readonly)



10
11
12
# File 'lib/merge_ruby_client/filestorage/types/download_request_meta.rb', line 10

def id
  @id
end

#methodString (readonly)



14
15
16
# File 'lib/merge_ruby_client/filestorage/types/download_request_meta.rb', line 14

def method
  @method
end

#urlString (readonly)



12
13
14
# File 'lib/merge_ruby_client/filestorage/types/download_request_meta.rb', line 12

def url
  @url
end

Class Method Details

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

Deserialize a JSON object to an instance of DownloadRequestMeta



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/merge_ruby_client/filestorage/types/download_request_meta.rb', line 44

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  url = parsed_json["url"]
  method = parsed_json["method"]
  headers = parsed_json["headers"]
  new(
    id: id,
    url: url,
    method: method,
    headers: headers,
    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.



73
74
75
76
77
78
# File 'lib/merge_ruby_client/filestorage/types/download_request_meta.rb', line 73

def self.validate_raw(obj:)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
  obj.method.is_a?(String) != false || raise("Passed value for field obj.method is not the expected type, validation failed.")
  obj.headers.is_a?(Hash) != false || raise("Passed value for field obj.headers is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of DownloadRequestMeta to a JSON object



63
64
65
# File 'lib/merge_ruby_client/filestorage/types/download_request_meta.rb', line 63

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