Class: NewDemoApiClient::GcsSignedURLResponse
- Inherits:
-
Object
- Object
- NewDemoApiClient::GcsSignedURLResponse
- Defined in:
- lib/test_sdk/types/gcs_signed_url_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #fields ⇒ Hash{String => Object} readonly
- #headers ⇒ Hash{String => Object} readonly
- #method ⇒ String readonly
- #url ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::GcsSignedURLResponse
Deserialize a JSON object to an instance of GcsSignedURLResponse.
-
.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(method:, url:, fields: OMIT, headers: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::GcsSignedURLResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of GcsSignedURLResponse to a JSON object.
Constructor Details
#initialize(method:, url:, fields: OMIT, headers: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::GcsSignedURLResponse
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_properties ⇒ OpenStruct (readonly)
Returns 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 |
#fields ⇒ Hash{String => Object} (readonly)
13 14 15 |
# File 'lib/test_sdk/types/gcs_signed_url_response.rb', line 13 def fields @fields end |
#headers ⇒ Hash{String => Object} (readonly)
15 16 17 |
# File 'lib/test_sdk/types/gcs_signed_url_response.rb', line 15 def headers @headers end |
#method ⇒ String (readonly)
9 10 11 |
# File 'lib/test_sdk/types/gcs_signed_url_response.rb', line 9 def method @method end |
#url ⇒ String (readonly)
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
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.
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
64 65 66 |
# File 'lib/test_sdk/types/gcs_signed_url_response.rb', line 64 def to_json(*_args) @_field_set&.to_json end |