Class: NewDemoApiClient::GcsSignedURLResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/test_sdk/types/gcs_signed_url_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method:, url:, fields: OMIT, headers: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::GcsSignedURLResponse

Parameters:

  • method (String)
  • url (String)
  • fields (Hash{String => Object}) (defaults to: OMIT)
  • headers (Hash{String => Object}) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



30
31
32
33
34
35
36
37
38
39
# File 'lib/test_sdk/types/gcs_signed_url_response.rb', line 30

def initialize(method:, url:, fields: OMIT, headers: OMIT, additional_properties: nil)
  @method = method
  @url = url
  @fields = fields if fields != OMIT
  @headers = headers if headers != OMIT
  @additional_properties = additional_properties
  @_field_set = { "method": method, "url": url, "fields": fields, "headers": headers }.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



17
18
19
# File 'lib/test_sdk/types/gcs_signed_url_response.rb', line 17

def additional_properties
  @additional_properties
end

#fieldsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


13
14
15
# File 'lib/test_sdk/types/gcs_signed_url_response.rb', line 13

def fields
  @fields
end

#headersHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


15
16
17
# File 'lib/test_sdk/types/gcs_signed_url_response.rb', line 15

def headers
  @headers
end

#methodString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/test_sdk/types/gcs_signed_url_response.rb', line 9

def method
  @method
end

#urlString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/test_sdk/types/gcs_signed_url_response.rb', line 11

def url
  @url
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::GcsSignedURLResponse

Deserialize a JSON object to an instance of GcsSignedURLResponse

Parameters:

  • json_object (String)

Returns:



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/test_sdk/types/gcs_signed_url_response.rb', line 45

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

Parameters:

  • obj (Object)

Returns:

  • (Void)


74
75
76
77
78
79
# File 'lib/test_sdk/types/gcs_signed_url_response.rb', line 74

def self.validate_raw(obj:)
  obj.method.is_a?(String) != false || raise("Passed value for field obj.method 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.fields&.is_a?(Hash) != false || raise("Passed value for field obj.fields 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 GcsSignedURLResponse to a JSON object

Returns:

  • (String)


64
65
66
# File 'lib/test_sdk/types/gcs_signed_url_response.rb', line 64

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