892 lines
46 KiB
HTML
892 lines
46 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>
|
||
Module: ResponseDataHelper
|
||
|
||
— Documentation by YARD 0.9.37
|
||
|
||
</title>
|
||
|
||
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
||
|
||
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
||
|
||
<script type="text/javascript">
|
||
pathId = "ResponseDataHelper";
|
||
relpath = '';
|
||
</script>
|
||
|
||
|
||
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
||
|
||
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
||
|
||
|
||
</head>
|
||
<body>
|
||
<div class="nav_wrap">
|
||
<iframe id="nav" src="class_list.html?1"></iframe>
|
||
<div id="resizer"></div>
|
||
</div>
|
||
|
||
<div id="main" tabindex="-1">
|
||
<div id="header">
|
||
<div id="menu">
|
||
|
||
<a href="_index.html">Index (R)</a> »
|
||
|
||
|
||
<span class="title">ResponseDataHelper</span>
|
||
|
||
</div>
|
||
|
||
<div id="search">
|
||
|
||
<a class="full_list_link" id="class_list_link"
|
||
href="class_list.html">
|
||
|
||
<svg width="24" height="24">
|
||
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
||
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
||
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
||
</svg>
|
||
</a>
|
||
|
||
</div>
|
||
<div class="clear"></div>
|
||
</div>
|
||
|
||
<div id="content"><h1>Module: ResponseDataHelper
|
||
|
||
|
||
|
||
</h1>
|
||
<div class="box_info">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<dl>
|
||
<dt>Included in:</dt>
|
||
<dd><span class='object_link'><a href="Msf/WebServices/ServletHelper.html" title="Msf::WebServices::ServletHelper (module)">Msf::WebServices::ServletHelper</a></span>, <span class='object_link'><a href="RemoteCredentialDataService.html" title="RemoteCredentialDataService (module)">RemoteCredentialDataService</a></span>, <span class='object_link'><a href="RemoteDbExportDataService.html" title="RemoteDbExportDataService (module)">RemoteDbExportDataService</a></span>, <span class='object_link'><a href="RemoteDbImportDataService.html" title="RemoteDbImportDataService (module)">RemoteDbImportDataService</a></span>, <span class='object_link'><a href="RemoteEventDataService.html" title="RemoteEventDataService (module)">RemoteEventDataService</a></span>, <span class='object_link'><a href="RemoteHostDataService.html" title="RemoteHostDataService (module)">RemoteHostDataService</a></span>, <span class='object_link'><a href="RemoteLoginDataService.html" title="RemoteLoginDataService (module)">RemoteLoginDataService</a></span>, <span class='object_link'><a href="RemoteLootDataService.html" title="RemoteLootDataService (module)">RemoteLootDataService</a></span>, <span class='object_link'><a href="RemoteMsfDataService.html" title="RemoteMsfDataService (module)">RemoteMsfDataService</a></span>, <span class='object_link'><a href="RemoteNmapDataService.html" title="RemoteNmapDataService (module)">RemoteNmapDataService</a></span>, <span class='object_link'><a href="RemoteNoteDataService.html" title="RemoteNoteDataService (module)">RemoteNoteDataService</a></span>, <span class='object_link'><a href="RemotePayloadDataService.html" title="RemotePayloadDataService (module)">RemotePayloadDataService</a></span>, <span class='object_link'><a href="RemoteRouteDataService.html" title="RemoteRouteDataService (module)">RemoteRouteDataService</a></span>, <span class='object_link'><a href="RemoteSessionDataService.html" title="RemoteSessionDataService (module)">RemoteSessionDataService</a></span>, <span class='object_link'><a href="RemoteSessionEventDataService.html" title="RemoteSessionEventDataService (module)">RemoteSessionEventDataService</a></span>, <span class='object_link'><a href="RemoteVulnAttemptDataService.html" title="RemoteVulnAttemptDataService (module)">RemoteVulnAttemptDataService</a></span>, <span class='object_link'><a href="RemoteVulnDataService.html" title="RemoteVulnDataService (module)">RemoteVulnDataService</a></span>, <span class='object_link'><a href="RemoteWebDataService.html" title="RemoteWebDataService (module)">RemoteWebDataService</a></span>, <span class='object_link'><a href="RemoteWorkspaceDataService.html" title="RemoteWorkspaceDataService (module)">RemoteWorkspaceDataService</a></span></dd>
|
||
</dl>
|
||
|
||
|
||
|
||
<dl>
|
||
<dt>Defined in:</dt>
|
||
<dd>lib/metasploit/framework/data_service/remote/http/response_data_helper.rb</dd>
|
||
</dl>
|
||
|
||
</div>
|
||
|
||
<h2>Overview</h2><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>HTTP response helper class</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h2>
|
||
Instance Method Summary
|
||
<small><a href="#" class="summary_toggle">collapse</a></small>
|
||
</h2>
|
||
|
||
<ul class="summary">
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#json_to_hash-instance_method" title="#json_to_hash (instance method)">#<strong>json_to_hash</strong>(response_wrapper) ⇒ Hash </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Converts an HTTP response to a Hash.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#json_to_mdm_object-instance_method" title="#json_to_mdm_object (instance method)">#<strong>json_to_mdm_object</strong>(response_wrapper, mdm_class) ⇒ ApplicationRecord </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Converts an HTTP response to an Mdm Object.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#process_file-instance_method" title="#process_file (instance method)">#<strong>process_file</strong>(base64_file, save_path) ⇒ String </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Processes a Base64 encoded file included in a JSON request.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#to_ar-instance_method" title="#to_ar (instance method)">#<strong>to_ar</strong>(klass, val, base_object = nil) ⇒ ApplicationRecord </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Converts a Hash or JSON string to an ActiveRecord object.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
</ul>
|
||
|
||
|
||
|
||
|
||
<div id="instance_method_details" class="method_details_list">
|
||
<h2>Instance Method Details</h2>
|
||
|
||
|
||
<div class="method_details first">
|
||
<h3 class="signature first" id="json_to_hash-instance_method">
|
||
|
||
#<strong>json_to_hash</strong>(response_wrapper) ⇒ <tt>Hash</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Converts an HTTP response to a Hash</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
<p class="tag_title">Parameters:</p>
|
||
<ul class="param">
|
||
|
||
<li>
|
||
|
||
<span class='name'>response_wrapper</span>
|
||
|
||
|
||
<span class='type'>(<tt>ResponseWrapper</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>A wrapped HTTP response containing a JSON body.</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<p class="tag_title">Returns:</p>
|
||
<ul class="return">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>Hash</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>A Hash interpretation of the JSON body.</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
<p class="tag_title">Raises:</p>
|
||
<ul class="raise">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>RuntimeError</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>response_wrapper is a Metasploit::Framework::DataService::RemoteHTTPDataService::ErrorResponse</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>RuntimeError</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>response_wrapper is a Metasploit::Framework::DataService::RemoteHTTPDataService::FailedResponse</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>RuntimeError</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>response_wrapper contains an empty response</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
15
|
||
16
|
||
17
|
||
18
|
||
19
|
||
20
|
||
21
|
||
22
|
||
23
|
||
24
|
||
25
|
||
26
|
||
27
|
||
28
|
||
29
|
||
30
|
||
31</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/data_service/remote/http/response_data_helper.rb', line 15</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_json_to_hash'>json_to_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_response_wrapper'>response_wrapper</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='id identifier rubyid_response_wrapper'>response_wrapper</span><span class='period'>.</span><span class='id identifier rubyid_response_body'>response_body</span>
|
||
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
||
<span class='id identifier rubyid_parsed_body'>parsed_body</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_body'>body</span><span class='comma'>,</span> <span class='label'>symbolize_names:</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
||
|
||
<span class='kw'>if</span> <span class='id identifier rubyid_response_wrapper'>response_wrapper</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Metasploit.html" title="Metasploit (module)">Metasploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework.html" title="Metasploit::Framework (module)">Framework</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService.html" title="Metasploit::Framework::DataService (module)">DataService</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService/RemoteHTTPDataService.html" title="Metasploit::Framework::DataService::RemoteHTTPDataService (class)">RemoteHTTPDataService</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService/RemoteHTTPDataService/SuccessResponse.html" title="Metasploit::Framework::DataService::RemoteHTTPDataService::SuccessResponse (class)">SuccessResponse</a></span></span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_parsed_body'>parsed_body</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span>
|
||
<span class='kw'>elsif</span> <span class='id identifier rubyid_response_wrapper'>response_wrapper</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Metasploit.html" title="Metasploit (module)">Metasploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework.html" title="Metasploit::Framework (module)">Framework</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService.html" title="Metasploit::Framework::DataService (module)">DataService</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService/RemoteHTTPDataService.html" title="Metasploit::Framework::DataService::RemoteHTTPDataService (class)">RemoteHTTPDataService</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService/RemoteHTTPDataService/ErrorResponse.html" title="Metasploit::Framework::DataService::RemoteHTTPDataService::ErrorResponse (class)">ErrorResponse</a></span></span><span class='rparen'>)</span>
|
||
<span class='comment'># raise a local exception with the message of the server-side error
|
||
</span> <span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_parsed_body'>parsed_body</span><span class='lbracket'>[</span><span class='symbol'>:error</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:message</span><span class='rbracket'>]</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>elsif</span> <span class='id identifier rubyid_response_wrapper'>response_wrapper</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Metasploit.html" title="Metasploit (module)">Metasploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework.html" title="Metasploit::Framework (module)">Framework</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService.html" title="Metasploit::Framework::DataService (module)">DataService</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService/RemoteHTTPDataService.html" title="Metasploit::Framework::DataService::RemoteHTTPDataService (class)">RemoteHTTPDataService</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService/RemoteHTTPDataService/FailedResponse.html" title="Metasploit::Framework::DataService::RemoteHTTPDataService::FailedResponse (class)">FailedResponse</a></span></span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_response_wrapper'>response_wrapper</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
||
<span class='kw'>else</span>
|
||
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>empty response</span><span class='tstring_end'>'</span></span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="json_to_mdm_object-instance_method">
|
||
|
||
#<strong>json_to_mdm_object</strong>(response_wrapper, mdm_class) ⇒ <tt><span class='object_link'><a href="ApplicationRecord.html" title="ApplicationRecord (class)">ApplicationRecord</a></span></tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Converts an HTTP response to an Mdm Object</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
<p class="tag_title">Parameters:</p>
|
||
<ul class="param">
|
||
|
||
<li>
|
||
|
||
<span class='name'>response_wrapper</span>
|
||
|
||
|
||
<span class='type'>(<tt>ResponseWrapper</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>A wrapped HTTP response containing a JSON body.</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
<li>
|
||
|
||
<span class='name'>mdm_class</span>
|
||
|
||
|
||
<span class='type'>(<tt>String</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>The Mdm class name the JSON will be converted to.</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<p class="tag_title">Returns:</p>
|
||
<ul class="return">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt><span class='object_link'><a href="ApplicationRecord.html" title="ApplicationRecord (class)">ApplicationRecord</a></span></tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>An object of type mdm_class, which inherits from ApplicationRecord</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
<p class="tag_title">Raises:</p>
|
||
<ul class="raise">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>RuntimeError</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>response_wrapper is a Metasploit::Framework::DataService::RemoteHTTPDataService::ErrorResponse</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>RuntimeError</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>response_wrapper is a Metasploit::Framework::DataService::RemoteHTTPDataService::FailedResponse</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>RuntimeError</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>response_wrapper contains an empty response</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
42
|
||
43
|
||
44
|
||
45
|
||
46
|
||
47
|
||
48
|
||
49
|
||
50
|
||
51
|
||
52
|
||
53
|
||
54
|
||
55
|
||
56
|
||
57
|
||
58
|
||
59
|
||
60
|
||
61
|
||
62
|
||
63
|
||
64
|
||
65
|
||
66</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/data_service/remote/http/response_data_helper.rb', line 42</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_json_to_mdm_object'>json_to_mdm_object</span><span class='lparen'>(</span><span class='id identifier rubyid_response_wrapper'>response_wrapper</span><span class='comma'>,</span> <span class='id identifier rubyid_mdm_class'>mdm_class</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='id identifier rubyid_response_wrapper'>response_wrapper</span><span class='period'>.</span><span class='id identifier rubyid_response_body'>response_body</span>
|
||
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
||
<span class='id identifier rubyid_parsed_body'>parsed_body</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_body'>body</span><span class='comma'>,</span> <span class='label'>symbolize_names:</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
||
|
||
<span class='kw'>if</span> <span class='id identifier rubyid_response_wrapper'>response_wrapper</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Metasploit.html" title="Metasploit (module)">Metasploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework.html" title="Metasploit::Framework (module)">Framework</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService.html" title="Metasploit::Framework::DataService (module)">DataService</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService/RemoteHTTPDataService.html" title="Metasploit::Framework::DataService::RemoteHTTPDataService (class)">RemoteHTTPDataService</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService/RemoteHTTPDataService/SuccessResponse.html" title="Metasploit::Framework::DataService::RemoteHTTPDataService::SuccessResponse (class)">SuccessResponse</a></span></span><span class='rparen'>)</span>
|
||
<span class='kw'>begin</span>
|
||
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_wrap'>wrap</span><span class='lparen'>(</span><span class='id identifier rubyid_parsed_body'>parsed_body</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
||
<span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_json_object'>json_object</span><span class='op'>|</span>
|
||
<span class='id identifier rubyid_rv'>rv</span> <span class='op'><<</span> <span class='id identifier rubyid_to_ar'>to_ar</span><span class='lparen'>(</span><span class='id identifier rubyid_mdm_class'>mdm_class</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span><span class='comma'>,</span> <span class='id identifier rubyid_json_object'>json_object</span><span class='rparen'>)</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>return</span> <span class='id identifier rubyid_rv'>rv</span>
|
||
<span class='kw'>rescue</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
||
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Mdm Object conversion failed </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>elsif</span> <span class='id identifier rubyid_response_wrapper'>response_wrapper</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Metasploit.html" title="Metasploit (module)">Metasploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework.html" title="Metasploit::Framework (module)">Framework</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService.html" title="Metasploit::Framework::DataService (module)">DataService</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService/RemoteHTTPDataService.html" title="Metasploit::Framework::DataService::RemoteHTTPDataService (class)">RemoteHTTPDataService</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService/RemoteHTTPDataService/ErrorResponse.html" title="Metasploit::Framework::DataService::RemoteHTTPDataService::ErrorResponse (class)">ErrorResponse</a></span></span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_handle_error_response'>handle_error_response</span><span class='lparen'>(</span><span class='id identifier rubyid_parsed_body'>parsed_body</span><span class='rparen'>)</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>elsif</span> <span class='id identifier rubyid_response_wrapper'>response_wrapper</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Metasploit.html" title="Metasploit (module)">Metasploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework.html" title="Metasploit::Framework (module)">Framework</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService.html" title="Metasploit::Framework::DataService (module)">DataService</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService/RemoteHTTPDataService.html" title="Metasploit::Framework::DataService::RemoteHTTPDataService (class)">RemoteHTTPDataService</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Metasploit/Framework/DataService/RemoteHTTPDataService/FailedResponse.html" title="Metasploit::Framework::DataService::RemoteHTTPDataService::FailedResponse (class)">FailedResponse</a></span></span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_response_wrapper'>response_wrapper</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
||
<span class='kw'>else</span>
|
||
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>empty response</span><span class='tstring_end'>'</span></span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="process_file-instance_method">
|
||
|
||
#<strong>process_file</strong>(base64_file, save_path) ⇒ <tt>String</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Processes a Base64 encoded file included in a JSON request. Saves the file in the location specified in the parameter.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
<p class="tag_title">Parameters:</p>
|
||
<ul class="param">
|
||
|
||
<li>
|
||
|
||
<span class='name'>base64_file</span>
|
||
|
||
|
||
<span class='type'>(<tt>String</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>The Base64 encoded file.</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
<li>
|
||
|
||
<span class='name'>save_path</span>
|
||
|
||
|
||
<span class='type'>(<tt>String</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>The location to store the file. This should include the file’s name.</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<p class="tag_title">Returns:</p>
|
||
<ul class="return">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>String</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>The location where the file was successfully stored.</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
74
|
||
75
|
||
76
|
||
77
|
||
78
|
||
79
|
||
80
|
||
81
|
||
82
|
||
83
|
||
84
|
||
85
|
||
86
|
||
87</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/data_service/remote/http/response_data_helper.rb', line 74</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_process_file'>process_file</span><span class='lparen'>(</span><span class='id identifier rubyid_base64_file'>base64_file</span><span class='comma'>,</span> <span class='id identifier rubyid_save_path'>save_path</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_decoded_file'>decoded_file</span> <span class='op'>=</span> <span class='const'>Base64</span><span class='period'>.</span><span class='id identifier rubyid_urlsafe_decode64'>urlsafe_decode64</span><span class='lparen'>(</span><span class='id identifier rubyid_base64_file'>base64_file</span><span class='rparen'>)</span>
|
||
<span class='kw'>begin</span>
|
||
<span class='comment'># If we are running the data service on the same box this will ensure we only write
|
||
</span> <span class='comment'># the file if it is somehow not there already.
|
||
</span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_save_path'>save_path</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_save_path'>save_path</span><span class='comma'>,</span> <span class='label'>mode:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rb</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='op'>==</span> <span class='id identifier rubyid_decoded_file'>decoded_file</span>
|
||
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_save_path'>save_path</span><span class='comma'>,</span> <span class='id identifier rubyid_decoded_file'>decoded_file</span><span class='comma'>,</span> <span class='label'>mode:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>wb</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>rescue</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
||
<span class='id identifier rubyid_elog'><span class='object_link'><a href="top-level-namespace.html#elog-instance_method" title="#elog (method)">elog</a></span></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>There was an error writing the file: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_e'>e</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
||
<span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_backtrace'>backtrace</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='op'>|</span> <span class='id identifier rubyid_elog'><span class='object_link'><a href="top-level-namespace.html#elog-instance_method" title="#elog (method)">elog</a></span></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_line'>line</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='rbrace'>}</span>
|
||
<span class='kw'>end</span>
|
||
<span class='id identifier rubyid_save_path'>save_path</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="to_ar-instance_method">
|
||
|
||
#<strong>to_ar</strong>(klass, val, base_object = nil) ⇒ <tt><span class='object_link'><a href="ApplicationRecord.html" title="ApplicationRecord (class)">ApplicationRecord</a></span></tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Converts a Hash or JSON string to an ActiveRecord object. Importantly, this retains associated objects if they are in the JSON string.</p>
|
||
|
||
<p>Modified from <a href="https://github.com/swdyh/toar">github.com/swdyh/toar</a>/ Credit to <a href="https://github.com/swdyh">github.com/swdyh</a></p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
<p class="tag_title">Parameters:</p>
|
||
<ul class="param">
|
||
|
||
<li>
|
||
|
||
<span class='name'>klass</span>
|
||
|
||
|
||
<span class='type'>(<tt>String</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>The ActiveRecord class to convert the JSON/Hash to.</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
<li>
|
||
|
||
<span class='name'>val</span>
|
||
|
||
|
||
<span class='type'>(<tt>String</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>The JSON string, or Hash, to convert.</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
<li>
|
||
|
||
<span class='name'>base_class</span>
|
||
|
||
|
||
<span class='type'>(<tt>Class</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>The base class to build back to. Used for recursion.</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<p class="tag_title">Returns:</p>
|
||
<ul class="return">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt><span class='object_link'><a href="ApplicationRecord.html" title="ApplicationRecord (class)">ApplicationRecord</a></span></tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>A klass object, which inherits from ApplicationRecord.</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
99
|
||
100
|
||
101
|
||
102
|
||
103
|
||
104
|
||
105
|
||
106
|
||
107
|
||
108
|
||
109
|
||
110
|
||
111
|
||
112
|
||
113
|
||
114
|
||
115
|
||
116
|
||
117
|
||
118
|
||
119
|
||
120
|
||
121
|
||
122
|
||
123
|
||
124
|
||
125
|
||
126
|
||
127
|
||
128
|
||
129
|
||
130
|
||
131
|
||
132
|
||
133
|
||
134
|
||
135
|
||
136
|
||
137
|
||
138
|
||
139
|
||
140
|
||
141
|
||
142
|
||
143
|
||
144
|
||
145
|
||
146</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/metasploit/framework/data_service/remote/http/response_data_helper.rb', line 99</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_to_ar'>to_ar</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='comma'>,</span> <span class='id identifier rubyid_val'>val</span><span class='comma'>,</span> <span class='id identifier rubyid_base_object'>base_object</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
||
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_val'>val</span>
|
||
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_val'>val</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='const'>Hash</span> <span class='op'>?</span> <span class='id identifier rubyid_val'>val</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span> <span class='op'>:</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span><span class='comma'>,</span> <span class='label'>symbolize_names:</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_obj'>obj</span> <span class='op'>=</span> <span class='id identifier rubyid_base_object'>base_object</span> <span class='op'>||</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
||
|
||
<span class='id identifier rubyid_obj_associations'>obj_associations</span> <span class='op'>=</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_reflect_on_all_associations'>reflect_on_all_associations</span><span class='lparen'>(</span><span class='symbol'>:has_many</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_reflection'>reflection</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
|
||
<span class='id identifier rubyid_reflection'>reflection</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:through</span><span class='rbracket'>]</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_i'>i</span> <span class='kw'>if</span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:through</span><span class='rbracket'>]</span>
|
||
<span class='id identifier rubyid_reflection'>reflection</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='id identifier rubyid_obj_attribute_names'>obj_attribute_names</span> <span class='op'>=</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_transform_keys'>transform_keys</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:to_sym</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span>
|
||
|
||
<span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_except'>except</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_obj_attribute_names'>obj_attribute_names</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
|
||
<span class='id identifier rubyid_association'>association</span> <span class='op'>=</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_reflect_on_association'>reflect_on_association</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span>
|
||
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_association'>association</span>
|
||
|
||
<span class='kw'>case</span> <span class='id identifier rubyid_association'>association</span><span class='period'>.</span><span class='id identifier rubyid_macro'>macro</span>
|
||
<span class='kw'>when</span> <span class='symbol'>:belongs_to</span>
|
||
<span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:"#{</span><span class='id identifier rubyid_k'>k</span><span class='embexpr_end'>}</span><span class='tstring_content'>_id</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
||
<span class='comment'># Polymorphic associations do not auto-create the 'build_model' method
|
||
</span> <span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_association'>association</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:polymorphic</span><span class='rbracket'>]</span>
|
||
<span class='id identifier rubyid_to_ar'>to_ar</span><span class='lparen'>(</span><span class='id identifier rubyid_association'>association</span><span class='period'>.</span><span class='id identifier rubyid_klass'>klass</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='comma'>,</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>build_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_k'>k</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
|
||
<span class='id identifier rubyid_define_method'>define_method</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_k'>k</span><span class='embexpr_end'>}</span><span class='tstring_content'>_id</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span> <span class='rbrace'>}</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>when</span> <span class='symbol'>:has_one</span>
|
||
<span class='id identifier rubyid_to_ar'>to_ar</span><span class='lparen'>(</span><span class='id identifier rubyid_association'>association</span><span class='period'>.</span><span class='id identifier rubyid_klass'>klass</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='comma'>,</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>build_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_k'>k</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
||
<span class='kw'>when</span> <span class='symbol'>:has_many</span>
|
||
<span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_proxy_association'>proxy_association</span><span class='period'>.</span><span class='id identifier rubyid_target'>target</span> <span class='op'>=</span>
|
||
<span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_to_ar'>to_ar</span><span class='lparen'>(</span><span class='id identifier rubyid_association'>association</span><span class='period'>.</span><span class='id identifier rubyid_klass'>klass</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
||
|
||
<span class='id identifier rubyid_as_th'>as_th</span> <span class='op'>=</span> <span class='id identifier rubyid_obj_associations'>obj_associations</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
|
||
<span class='kw'>if</span> <span class='id identifier rubyid_as_th'>as_th</span>
|
||
<span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_as_th'>as_th</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_proxy_association'>proxy_association</span><span class='period'>.</span><span class='id identifier rubyid_target'>target</span> <span class='op'>=</span>
|
||
<span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_to_ar'>to_ar</span><span class='lparen'>(</span><span class='id identifier rubyid_as_th'>as_th</span><span class='period'>.</span><span class='id identifier rubyid_klass'>klass</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='lbracket'>[</span><span class='id identifier rubyid_as_th'>as_th</span><span class='period'>.</span><span class='id identifier rubyid_source_reflection_name'>source_reflection_name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span>
|
||
<span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_assign_attributes'>assign_attributes</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_slice'>slice</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_obj_attribute_names'>obj_attribute_names</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
||
|
||
<span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_instance_eval'>instance_eval</span> <span class='kw'>do</span>
|
||
<span class='comment'># prevent save
|
||
</span> <span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid__context'>_context</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
||
<span class='kw'>false</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span>
|
||
<span class='id identifier rubyid_obj'>obj</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div id="footer">
|
||
Generated on Fri May 8 17:02:53 2026 by
|
||
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
||
0.9.37 (ruby-3.1.5).
|
||
</div>
|
||
|
||
</div>
|
||
</body>
|
||
</html> |