Class: Merge::Crm::DataPassthroughRequest
- Inherits:
-
Object
- Object
- Merge::Crm::DataPassthroughRequest
- Defined in:
- lib/merge_ruby_client/crm/types/data_passthrough_request.rb
Overview
# The DataPassthrough Object
### Description
The `DataPassthrough` object is used to send information to an
otherwise-unsupported third-party endpoint.
### Usage Example
Create a `DataPassthrough` to get team hierarchies from your Rippling
integration.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#base_url_override ⇒ String
readonly
An optional override of the third party’s base url for the request.
-
#data ⇒ String
readonly
The data with the request.
-
#headers ⇒ Hash{String => Object}
readonly
The headers to use for the request (Merge will handle the account’s authorization headers).
- #method ⇒ Merge::Crm::MethodEnum readonly
-
#multipart_form_data ⇒ Array<Merge::Crm::MultipartFormFieldRequest>
readonly
Pass an array of ‘MultipartFormField` objects in here instead of using the `data` param if `request_format` is set to `MULTIPART`.
-
#normalize_response ⇒ Boolean
readonly
Optional.
-
#path ⇒ String
readonly
The path of the request in the third party’s platform.
- #request_format ⇒ Merge::Crm::RequestFormatEnum readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Crm::DataPassthroughRequest
Deserialize a JSON object to an instance of DataPassthroughRequest.
-
.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:, base_url_override: OMIT, data: OMIT, multipart_form_data: OMIT, headers: OMIT, request_format: OMIT, normalize_response: OMIT, additional_properties: nil) ⇒ Merge::Crm::DataPassthroughRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of DataPassthroughRequest to a JSON object.
Constructor Details
#initialize(method:, path:, base_url_override: OMIT, data: OMIT, multipart_form_data: OMIT, headers: OMIT, request_format: OMIT, normalize_response: OMIT, additional_properties: nil) ⇒ Merge::Crm::DataPassthroughRequest
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/crm/types/data_passthrough_request.rb', line 65 def initialize(method:, path:, base_url_override: OMIT, data: OMIT, multipart_form_data: OMIT, headers: OMIT, request_format: OMIT, normalize_response: OMIT, additional_properties: nil) @method = method @path = path @base_url_override = base_url_override if base_url_override != OMIT @data = data if data != OMIT @multipart_form_data = multipart_form_data if multipart_form_data != OMIT @headers = headers if headers != OMIT @request_format = request_format if request_format != OMIT @normalize_response = normalize_response if normalize_response != OMIT @additional_properties = additional_properties @_field_set = { "method": method, "path": path, "base_url_override": base_url_override, "data": data, "multipart_form_data": multipart_form_data, "headers": headers, "request_format": request_format, "normalize_response": normalize_response }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
42 43 44 |
# File 'lib/merge_ruby_client/crm/types/data_passthrough_request.rb', line 42 def additional_properties @additional_properties end |
#base_url_override ⇒ String (readonly)
Returns An optional override of the third party’s base url for the request.
24 25 26 |
# File 'lib/merge_ruby_client/crm/types/data_passthrough_request.rb', line 24 def base_url_override @base_url_override end |
#data ⇒ String (readonly)
Returns The data with the request. You must include a ‘request_format` parameter matching the data’s format.
27 28 29 |
# File 'lib/merge_ruby_client/crm/types/data_passthrough_request.rb', line 27 def data @data end |
#headers ⇒ Hash{String => Object} (readonly)
Returns The headers to use for the request (Merge will handle the account’s authorization headers). ‘Content-Type` header is required for passthrough. Choose content type corresponding to expected format of receiving server.
34 35 36 |
# File 'lib/merge_ruby_client/crm/types/data_passthrough_request.rb', line 34 def headers @headers end |
#method ⇒ Merge::Crm::MethodEnum (readonly)
20 21 22 |
# File 'lib/merge_ruby_client/crm/types/data_passthrough_request.rb', line 20 def method @method end |
#multipart_form_data ⇒ Array<Merge::Crm::MultipartFormFieldRequest> (readonly)
Returns Pass an array of ‘MultipartFormField` objects in here instead of using the `data` param if `request_format` is set to `MULTIPART`.
30 31 32 |
# File 'lib/merge_ruby_client/crm/types/data_passthrough_request.rb', line 30 def multipart_form_data @multipart_form_data end |
#normalize_response ⇒ Boolean (readonly)
Returns Optional. If true, the response will always be an object of the form ‘T, “value”: …` where `T` will be one of `string, boolean, number, null, array, object`.
40 41 42 |
# File 'lib/merge_ruby_client/crm/types/data_passthrough_request.rb', line 40 def normalize_response @normalize_response end |
#path ⇒ String (readonly)
Returns The path of the request in the third party’s platform.
22 23 24 |
# File 'lib/merge_ruby_client/crm/types/data_passthrough_request.rb', line 22 def path @path end |
#request_format ⇒ Merge::Crm::RequestFormatEnum (readonly)
36 37 38 |
# File 'lib/merge_ruby_client/crm/types/data_passthrough_request.rb', line 36 def request_format @request_format end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Crm::DataPassthroughRequest
Deserialize a JSON object to an instance of DataPassthroughRequest
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/merge_ruby_client/crm/types/data_passthrough_request.rb', line 94 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"] base_url_override = parsed_json["base_url_override"] data = parsed_json["data"] multipart_form_data = parsed_json["multipart_form_data"]&.map do |item| item = item.to_json Merge::Crm::MultipartFormFieldRequest.from_json(json_object: item) end headers = parsed_json["headers"] request_format = parsed_json["request_format"] normalize_response = parsed_json["normalize_response"] new( method: method, path: path, base_url_override: base_url_override, data: data, multipart_form_data: multipart_form_data, headers: headers, request_format: request_format, normalize_response: normalize_response, 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.
134 135 136 137 138 139 140 141 142 143 |
# File 'lib/merge_ruby_client/crm/types/data_passthrough_request.rb', line 134 def self.validate_raw(obj:) obj.method.is_a?(Merge::Crm::MethodEnum) != 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.base_url_override&.is_a?(String) != false || raise("Passed value for field obj.base_url_override is not the expected type, validation failed.") obj.data&.is_a?(String) != false || raise("Passed value for field obj.data is not the expected type, validation failed.") obj.multipart_form_data&.is_a?(Array) != false || raise("Passed value for field obj.multipart_form_data 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.") obj.request_format&.is_a?(Merge::Crm::RequestFormatEnum) != false || raise("Passed value for field obj.request_format is not the expected type, validation failed.") obj.normalize_response&.is_a?(Boolean) != false || raise("Passed value for field obj.normalize_response is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of DataPassthroughRequest to a JSON object
124 125 126 |
# File 'lib/merge_ruby_client/crm/types/data_passthrough_request.rb', line 124 def to_json(*_args) @_field_set&.to_json end |