Class: Merge::Ticketing::RemoteResponse
- Inherits:
-
Object
- Object
- Merge::Ticketing::RemoteResponse
- Defined in:
- lib/merge_ruby_client/ticketing/types/remote_response.rb
Overview
# The RemoteResponse Object
### Description
The `RemoteResponse` object is used to represent information returned from a
third-party endpoint.
### Usage Example
View the `RemoteResponse` returned from your `DataPassthrough`.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #headers ⇒ Hash{String => Object} readonly
- #method ⇒ String readonly
- #path ⇒ String readonly
- #response ⇒ Object readonly
- #response_headers ⇒ Hash{String => Object} readonly
- #response_type ⇒ Merge::Ticketing::ResponseTypeEnum readonly
- #status ⇒ Integer readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Ticketing::RemoteResponse
Deserialize a JSON object to an instance of RemoteResponse.
-
.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:, path:, status:, response:, response_headers: OMIT, response_type: OMIT, headers: OMIT, additional_properties: nil) ⇒ Merge::Ticketing::RemoteResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of RemoteResponse to a JSON object.
Constructor Details
#initialize(method:, path:, status:, response:, response_headers: OMIT, response_type: OMIT, headers: OMIT, additional_properties: nil) ⇒ Merge::Ticketing::RemoteResponse
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/merge_ruby_client/ticketing/types/remote_response.rb', line 47 def initialize(method:, path:, status:, response:, response_headers: OMIT, response_type: OMIT, headers: OMIT, additional_properties: nil) @method = method @path = path @status = status @response = response @response_headers = response_headers if response_headers != OMIT @response_type = response_type if response_type != OMIT @headers = headers if headers != OMIT @additional_properties = additional_properties @_field_set = { "method": method, "path": path, "status": status, "response": response, "response_headers": response_headers, "response_type": response_type, "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.
31 32 33 |
# File 'lib/merge_ruby_client/ticketing/types/remote_response.rb', line 31 def additional_properties @additional_properties end |
#headers ⇒ Hash{String => Object} (readonly)
29 30 31 |
# File 'lib/merge_ruby_client/ticketing/types/remote_response.rb', line 29 def headers @headers end |
#method ⇒ String (readonly)
17 18 19 |
# File 'lib/merge_ruby_client/ticketing/types/remote_response.rb', line 17 def method @method end |
#path ⇒ String (readonly)
19 20 21 |
# File 'lib/merge_ruby_client/ticketing/types/remote_response.rb', line 19 def path @path end |
#response ⇒ Object (readonly)
23 24 25 |
# File 'lib/merge_ruby_client/ticketing/types/remote_response.rb', line 23 def response @response end |
#response_headers ⇒ Hash{String => Object} (readonly)
25 26 27 |
# File 'lib/merge_ruby_client/ticketing/types/remote_response.rb', line 25 def response_headers @response_headers end |
#response_type ⇒ Merge::Ticketing::ResponseTypeEnum (readonly)
27 28 29 |
# File 'lib/merge_ruby_client/ticketing/types/remote_response.rb', line 27 def response_type @response_type end |
#status ⇒ Integer (readonly)
21 22 23 |
# File 'lib/merge_ruby_client/ticketing/types/remote_response.rb', line 21 def status @status end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Ticketing::RemoteResponse
Deserialize a JSON object to an instance of RemoteResponse
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/merge_ruby_client/ticketing/types/remote_response.rb', line 74 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) method = parsed_json["method"] path = parsed_json["path"] status = parsed_json["status"] response = parsed_json["response"] response_headers = parsed_json["response_headers"] response_type = parsed_json["response_type"] headers = parsed_json["headers"] new( method: method, path: path, status: status, response: response, response_headers: response_headers, response_type: response_type, 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.
109 110 111 112 113 114 115 116 117 |
# File 'lib/merge_ruby_client/ticketing/types/remote_response.rb', line 109 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.path.is_a?(String) != false || raise("Passed value for field obj.path is not the expected type, validation failed.") obj.status.is_a?(Integer) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.response.is_a?(Object) != false || raise("Passed value for field obj.response is not the expected type, validation failed.") obj.response_headers&.is_a?(Hash) != false || raise("Passed value for field obj.response_headers is not the expected type, validation failed.") obj.response_type&.is_a?(Merge::Ticketing::ResponseTypeEnum) != false || raise("Passed value for field obj.response_type 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 RemoteResponse to a JSON object
99 100 101 |
# File 'lib/merge_ruby_client/ticketing/types/remote_response.rb', line 99 def to_json(*_args) @_field_set&.to_json end |