Skip to content

Commit

Permalink
Final tweaks for v0.0.3 (#35)
Browse files Browse the repository at this point in the history
### What changed? Why?
Final tweaks for v0.0.3:
- Make `encrypt` a named variable in save_wallet
- Add `inspect` and `to_s` methods to most classes
- Bump version

#### Qualified Impact
<!-- Please evaluate what components could be affected and what the
impact would be if there was an
error. How would this error be resolved, e.g. rollback a deploy, push a
new fix, disable a feature
flag, etc... -->
  • Loading branch information
yuga-cb authored May 6, 2024
1 parent 6ee5418 commit 948fbe5
Show file tree
Hide file tree
Showing 50 changed files with 1,981 additions and 844 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ repl:

.PHONY: docs
docs:
bundle exec yardoc --output-dir ./docs --template-path ./docs/templates
bundle exec yardoc --output-dir ./docs --quiet --template-path ./docs/templates
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ for the data persisted locally. To re-instantiate wallets with encrypted data, e
the same API key when invoking `save_wallet` and `load_wallets`.

```ruby
u.save_wallet(w3, true)
u.save_wallet(w3, encrypt: true)
```

The below code demonstrates how to re-instantiate a Wallet from the data export.
Expand Down
3 changes: 2 additions & 1 deletion coinbase.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = 'coinbase-sdk'
spec.version = '0.0.2'
spec.version = '0.0.3'
spec.authors = ['Yuga Cohler']
spec.files = Dir['lib/**/*.rb']
spec.summary = 'Coinbase Ruby SDK'
Expand Down Expand Up @@ -31,4 +31,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rubocop', '1.63.1'
# Pin to a specific version of YARD to ensure consistent documentation generation.
spec.add_development_dependency 'yard', '0.9.36'
spec.add_development_dependency 'yard-markdown'
end
125 changes: 109 additions & 16 deletions docs/Coinbase/APIError.html
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ <h2>
<li class="public ">
<span class="summary_signature">

<a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> &#x21d2; Object </a>
<a href="#inspect-instance_method" title="#inspect (instance method)">#<strong>inspect</strong> &#x21d2; String </a>



Expand All @@ -300,7 +300,31 @@ <h2>


<span class="summary_desc"><div class='inline'>
<p>The string representation of the error.</p>
<p>Same as to_s.</p>
</div></span>

</li>


<li class="public ">
<span class="summary_signature">

<a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> &#x21d2; String </a>



</span>









<span class="summary_desc"><div class='inline'>
<p>Returns a String representation of the APIError.</p>
</div></span>

</li>
Expand Down Expand Up @@ -732,9 +756,68 @@ <h2>Instance Method Details</h2>


<div class="method_details first">
<h3 class="signature first" id="to_s-instance_method">
<h3 class="signature first" id="inspect-instance_method">

#<strong>inspect</strong> &#x21d2; <tt>String</tt>





</h3><div class="docstring">
<div class="discussion">

<p>Same as to_s.</p>


</div>
</div>
<div class="tags">

<p class="tag_title">Returns:</p>
<ul class="return">

<li>


<span class='type'>(<tt>String</tt>)</span>



&mdash;
<div class='inline'>
<p>a String representation of the APIError</p>
</div>

</li>

#<strong>to_s</strong> &#x21d2; <tt>Object</tt>
</ul>

</div><table class="source_code">
<tr>
<td>
<pre class="lines">


91
92
93</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/coinbase/errors.rb', line 91</span>

<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span>
<span class='id identifier rubyid_to_s'>to_s</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>

<div class="method_details ">
<h3 class="signature " id="to_s-instance_method">

#<strong>to_s</strong> &#x21d2; <tt>String</tt>



Expand All @@ -743,37 +826,47 @@ <h3 class="signature first" id="to_s-instance_method">
</h3><div class="docstring">
<div class="discussion">

<p>The string representation of the error.</p>
<p>Returns a String representation of the APIError.</p>


</div>
</div>
<div class="tags">

<p class="tag_title">Returns:</p>
<ul class="return">

<li>


<span class='type'>(<tt>String</tt>)</span>



&mdash;
<div class='inline'>
<p>a String representation of the APIError</p>
</div>

</li>

</ul>

</div><table class="source_code">
<tr>
<td>
<pre class="lines">


84
85
86
87
88
89
90</pre>
87</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/coinbase/errors.rb', line 84</span>
<pre class="code"><span class="info file"># File 'lib/coinbase/errors.rb', line 85</span>

<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>API Error \n</span><span class='tstring_end'>&quot;</span></span>
<span class='id identifier rubyid_message'>message</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>HTTP status code: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_http_code'>http_code</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_http_code'>http_code</span>
<span class='id identifier rubyid_message'>message</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>API error code: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_api_code'>api_code</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_api_code'>api_code</span>
<span class='id identifier rubyid_message'>message</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>API error message: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_api_message'>api_message</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_api_message'>api_message</span>
<span class='id identifier rubyid_message'>message</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>APIError{http_code: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@http_code</span><span class='embexpr_end'>}</span><span class='tstring_content'>, api_code: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_code</span><span class='embexpr_end'>}</span><span class='tstring_content'>, api_message: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_message</span><span class='embexpr_end'>}</span><span class='tstring_content'>}</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
Expand Down
107 changes: 95 additions & 12 deletions docs/Coinbase/Address.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,30 @@ <h2>
<p>Returns a new Address object.</p>
</div></span>

</li>


<li class="public ">
<span class="summary_signature">

<a href="#inspect-instance_method" title="#inspect (instance method)">#<strong>inspect</strong> &#x21d2; String </a>



</span>









<span class="summary_desc"><div class='inline'>
<p>Same as to_s.</p>
</div></span>

</li>


Expand Down Expand Up @@ -289,7 +313,7 @@ <h2>


<span class="summary_desc"><div class='inline'>
<p>Returns the address as a string.</p>
<p>Returns a String representation of the Address.</p>
</div></span>

</li>
Expand Down Expand Up @@ -361,7 +385,7 @@ <h3 class="signature first" id="initialize-instance_method">
</h3><div class="docstring">
<div class="discussion">

<p>Returns a new Address object. Do not use this method directly. Instead, use Wallet#create_address, or use the Wallets default_address.</p>
<p>Returns a new Address object. Do not use this method directly. Instead, use Wallet#create_address, or use the Wallet&#39;s default_address.</p>


</div>
Expand Down Expand Up @@ -570,14 +594,14 @@ <h3 class="signature " id="faucet-instance_method">
<pre class="lines">


147
148
149
150
151</pre>
153
154
155
156
157</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/coinbase/address.rb', line 147</span>
<pre class="code"><span class="info file"># File 'lib/coinbase/address.rb', line 153</span>

<span class='kw'>def</span> <span class='id identifier rubyid_faucet'>faucet</span>
<span class='const'><span class='object_link'><a href="../Coinbase.html" title="Coinbase (module)">Coinbase</a></span></span><span class='period'>.</span><span class='id identifier rubyid_call_api'><span class='object_link'><a href="../Coinbase.html#call_api-class_method" title="Coinbase.call_api (method)">call_api</a></span></span> <span class='kw'>do</span>
Expand Down Expand Up @@ -704,6 +728,65 @@ <h3 class="signature " id="get_balance-instance_method">
</td>
</tr>
</table>
</div>

<div class="method_details ">
<h3 class="signature " id="inspect-instance_method">

#<strong>inspect</strong> &#x21d2; <tt>String</tt>





</h3><div class="docstring">
<div class="discussion">

<p>Same as to_s.</p>


</div>
</div>
<div class="tags">

<p class="tag_title">Returns:</p>
<ul class="return">

<li>


<span class='type'>(<tt>String</tt>)</span>



&mdash;
<div class='inline'>
<p>a String representation of the Address</p>
</div>

</li>

</ul>

</div><table class="source_code">
<tr>
<td>
<pre class="lines">


144
145
146</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/coinbase/address.rb', line 144</span>

<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span>
<span class='id identifier rubyid_to_s'>to_s</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>

<div class="method_details ">
Expand Down Expand Up @@ -844,7 +927,7 @@ <h3 class="signature " id="to_s-instance_method">
</h3><div class="docstring">
<div class="discussion">

<p>Returns the address as a string.</p>
<p>Returns a String representation of the Address.</p>


</div>
Expand All @@ -863,7 +946,7 @@ <h3 class="signature " id="to_s-instance_method">

&mdash;
<div class='inline'>
<p>The address</p>
<p>a String representation of the Address</p>
</div>

</li>
Expand All @@ -884,7 +967,7 @@ <h3 class="signature " id="to_s-instance_method">
<pre class="code"><span class="info file"># File 'lib/coinbase/address.rb', line 138</span>

<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
<span class='id identifier rubyid_address_id'>address_id</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Coinbase::Address{address_id: &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_address_id'>address_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;, network_id: &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_network_id'>network_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;, wallet_id: &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_wallet_id'>wallet_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
Expand Down Expand Up @@ -955,7 +1038,7 @@ <h3 class="signature " id="transfer-instance_method">

&mdash;
<div class='inline'>
<p>The destination of the transfer. If a Wallet, sends to the Wallets default address. If a String, interprets it as the address ID.</p>
<p>The destination of the transfer. If a Wallet, sends to the Wallet&#39;s default address. If a String, interprets it as the address ID.</p>
</div>

</li>
Expand Down
2 changes: 1 addition & 1 deletion docs/Coinbase/AlreadyExistsError.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ <h3 class="inherited">Attributes inherited from <span class='object_link'><a hre
<h2>Method Summary</h2>

<h3 class="inherited">Methods inherited from <span class='object_link'><a href="APIError.html" title="Coinbase::APIError (class)">APIError</a></span></h3>
<p class="inherited"><span class='object_link'><a href="APIError.html#from_error-class_method" title="Coinbase::APIError.from_error (method)">from_error</a></span>, <span class='object_link'><a href="APIError.html#initialize-instance_method" title="Coinbase::APIError#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="APIError.html#to_s-instance_method" title="Coinbase::APIError#to_s (method)">#to_s</a></span></p>
<p class="inherited"><span class='object_link'><a href="APIError.html#from_error-class_method" title="Coinbase::APIError.from_error (method)">from_error</a></span>, <span class='object_link'><a href="APIError.html#initialize-instance_method" title="Coinbase::APIError#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="APIError.html#inspect-instance_method" title="Coinbase::APIError#inspect (method)">#inspect</a></span>, <span class='object_link'><a href="APIError.html#to_s-instance_method" title="Coinbase::APIError#to_s (method)">#to_s</a></span></p>

<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
Expand Down
Loading

0 comments on commit 948fbe5

Please sign in to comment.