twelvedata_ruby 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/CHANGELOG.md +5 -0
  4. data/CODE_OF_CONDUCT.md +84 -0
  5. data/Gemfile +6 -0
  6. data/Gemfile.lock +80 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +125 -0
  9. data/Rakefile +12 -0
  10. data/bin/console +22 -0
  11. data/bin/setup +8 -0
  12. data/doc/TwelvedataRuby.html +353 -0
  13. data/doc/TwelvedataRuby/BadRequestResponseError.html +178 -0
  14. data/doc/TwelvedataRuby/Client.html +1443 -0
  15. data/doc/TwelvedataRuby/Endpoint.html +1478 -0
  16. data/doc/TwelvedataRuby/EndpointError.html +247 -0
  17. data/doc/TwelvedataRuby/EndpointNameError.html +167 -0
  18. data/doc/TwelvedataRuby/EndpointParametersKeysError.html +167 -0
  19. data/doc/TwelvedataRuby/EndpointRequiredParametersError.html +167 -0
  20. data/doc/TwelvedataRuby/Error.html +318 -0
  21. data/doc/TwelvedataRuby/ForbiddenResponseError.html +178 -0
  22. data/doc/TwelvedataRuby/InternalServerResponseErro.html +178 -0
  23. data/doc/TwelvedataRuby/NotFoundResponseError.html +178 -0
  24. data/doc/TwelvedataRuby/PageNotFoundResponseError.html +178 -0
  25. data/doc/TwelvedataRuby/ParameterTooLongResponseError.html +178 -0
  26. data/doc/TwelvedataRuby/Request.html +683 -0
  27. data/doc/TwelvedataRuby/Response.html +1622 -0
  28. data/doc/TwelvedataRuby/ResponseError.html +565 -0
  29. data/doc/TwelvedataRuby/TooManyRequestsResponseError.html +178 -0
  30. data/doc/TwelvedataRuby/UnauthorizedResponseError.html +178 -0
  31. data/doc/TwelvedataRuby/Utils.html +503 -0
  32. data/doc/_index.html +315 -0
  33. data/doc/class_list.html +51 -0
  34. data/doc/css/common.css +1 -0
  35. data/doc/css/full_list.css +58 -0
  36. data/doc/css/style.css +497 -0
  37. data/doc/file.README.html +194 -0
  38. data/doc/file_list.html +56 -0
  39. data/doc/frames.html +17 -0
  40. data/doc/index.html +194 -0
  41. data/doc/js/app.js +314 -0
  42. data/doc/js/full_list.js +216 -0
  43. data/doc/js/jquery.js +4 -0
  44. data/doc/method_list.html +707 -0
  45. data/doc/top-level-namespace.html +110 -0
  46. data/lib/twelvedata_ruby.rb +43 -0
  47. data/lib/twelvedata_ruby/client.rb +148 -0
  48. data/lib/twelvedata_ruby/endpoint.rb +271 -0
  49. data/lib/twelvedata_ruby/error.rb +90 -0
  50. data/lib/twelvedata_ruby/request.rb +54 -0
  51. data/lib/twelvedata_ruby/response.rb +132 -0
  52. data/lib/twelvedata_ruby/utils.rb +36 -0
  53. data/twelvedata_ruby.gemspec +37 -0
  54. metadata +201 -0
@@ -0,0 +1,194 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ File: README
8
+
9
+ &mdash; Documentation by YARD 0.9.26
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "README";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="file_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index</a> &raquo;
40
+ <span class="title">File: README</span>
41
+
42
+ </div>
43
+
44
+ <div id="search">
45
+
46
+ <a class="full_list_link" id="class_list_link"
47
+ href="class_list.html">
48
+
49
+ <svg width="24" height="24">
50
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
51
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
52
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
53
+ </svg>
54
+ </a>
55
+
56
+ </div>
57
+ <div class="clear"></div>
58
+ </div>
59
+
60
+ <div id="content"><div id='filecontents'><h1 id="twelvedataruby">TwelvedataRuby</h1>
61
+
62
+ <p>TwelvedataRuby is a Ruby library that exposes some convenient ways to access Twelve Data API to get information on stock, forex, crypto, and other financial market data. In order to do so, a free API key is required which can be easily requested <a href="https://twelvedata.com/pricing">here</a>. Visit their <a href="https://twelvedata.com/doc">API’s full documentation</a></p>
63
+
64
+ <h2 id="installation">Installation</h2>
65
+
66
+ <p>Add this line to your application’s Gemfile:</p>
67
+
68
+ <p><code>ruby
69
+ gem 'twelvedata_ruby'
70
+ </code></p>
71
+
72
+ <p>And then execute:</p>
73
+
74
+ <pre class="code ruby"><code class="ruby">$ bundle install
75
+ </code></pre>
76
+
77
+ <p>Or install it yourself as:</p>
78
+
79
+ <pre class="code ruby"><code class="ruby">$ gem install twelvedata_ruby
80
+ </code></pre>
81
+
82
+ <h2 id="usage">Usage</h2>
83
+
84
+ <p>The preferred way to include the Twelve Data API key in the request payload is to assign it to an ENVIRONMENT variable which your Ruby application can fetch if none was explicitly assigned. The default ENVIRONMENTt variable name is <code>TWELVEDATA_API_KEY</code> but you can configure this to any other value using the <code>#apikey_env_var_name=</code> setter method.</p>
85
+
86
+ <p>To get hold of the singleton <code>TwelvedataRuby::Client.instance</code>, you can directly used that inherited instance method from the mixed in <code>Singleton</code> module or thru the gem’s module helper class method:</p>
87
+
88
+ <p><code>ruby
89
+ require "twelvedata_ruby"
90
+ client = TwelvedataRuby.client
91
+ </code></p>
92
+
93
+ <p>By not passing anything to the options method parameters, the <code>client</code> instance attributes will have default values. Though you can still set different values to the attributes through their helper setter methods:</p>
94
+
95
+ <p><code>ruby
96
+ client.apikey = "twelvedata-apikey"
97
+ client.apikey_env_var_name = "the_environment_variable_name" # the helper getter method will upcase the value
98
+ client.connect_timeout = 300 # can also accept "300"
99
+ </code></p>
100
+
101
+ <p>or simply set them all at once:</p>
102
+
103
+ <p><code>ruby
104
+ require "twelvedata_ruby"
105
+ client = TwelvedataRuby.client(apikey: "twelvedata-apikey", connect_timeout: 300)
106
+ # or client = TwelvedataRuby.client(apikey_env_var_name: "the_environment_variable_name", connect_timeout: 300)
107
+ </code></p>
108
+
109
+ <p>The default values though are sufficient already.</p>
110
+
111
+ <p>Getting any type of financial data then from the API, simply invoke any valid endpoint name to the client instance. For example, to fetch some data for <code>GOOG</code> stock symbol using quote, timeseries, price, and etd API endpoints:</p>
112
+
113
+ <p><code>ruby
114
+ # 1. response content-type will be :csv
115
+ client.quote(symbol: "GOOG", format: :csv)
116
+ # 2. assigns custom attachment name
117
+ client.timeseries(symbol: "GOOG", interval: "1hour", format: :csv, filename: "google_timeseries_1hour.csv")
118
+ # 3. the content-type format will be :json
119
+ client.price(symbol: "GOOG")
120
+ # 4. the passed apikey is the used in the request payload
121
+ client.etd(symbol: "GOOG", apikey: "overrides-whatever-is-the-current-apikey")
122
+ # 5. an example of invocation which the API will respond with 401 error code
123
+ client.etd(symbol: "GOOG", apikey: "invalid-api-key")
124
+ # 6. still exactly the same object with client
125
+ TwelvedataRuby.client.api_usage
126
+ # 7. an invalid request wherein the required query parameter :interval is missing
127
+ TwelvedataRuby.client.timeseries(symbol: "GOOG")
128
+ # 8. an invalid request because it contains an invalid parameter
129
+ client.price(symbol: "GOOG", invalid_parameter: "value")
130
+ # 9. invoking a non-existing API endpoint will cause a NoMethodError exception
131
+ client.price(symbol: "GOOG", invalid_parameter: "value")
132
+ </code></p>
133
+
134
+ <p>All of the invocations possible return instance value is one of the following:
135
+ - <code>TwelvedataRuby::Response</code> instance object which <code>#error</code> instance getter method can return a nil or kind of <code>TwelvedataRuby::ResponseError</code> instance if the API, or the API web server responded with some errors. #5 is an example which the API response will have status error with 401 code. <code>TwelvedataRuby::Response</code> resolves this into <code>TwelvedataRuby::UnauthorizedResponseError</code> instance.
136
+ - <code>TwelvedataRuby::ResponseError</code> instance object itself when some error occurred that’s not coming from the API
137
+ - a Hash instance which has an <code>:errors</code> key that contains instances of kind <code>TwelvedataRuby::EndpointError</code>. This is an invalid request scenario which the #7, #8, and #9 examples. No actual API request was sent in this scenario.</p>
138
+
139
+ <p>On first invocation of a valid endpoint name, a <code>TwelvedataRuby::Client</code> instance method of the same name is dynamically defined. So in effect, ideally, there can be a one-to-one mapping of all the API endpoints with their respective parameters constraints. Please visit their excellent API documentation to know more of the endpoint details here https://twelvedata.com/doc. Or if you’re in a hurry, you can list the endpoints definitions:</p>
140
+
141
+ <p><code>ruby
142
+ TwelvedataRuby::Endpoint.definitions
143
+ </code></p>
144
+
145
+ <p>Another way of fetching data from API endpoints is by building a valid <code>TwelvedataRuby::Request</code> instance, then invoke <code>#fetch</code> on this instance. The possible return values are the same with the above examples.</p>
146
+
147
+ <p><code>ruby
148
+ quote_req = TwelvedataRuby::Request.new(:quote, symbol: "IBM")
149
+ quote_resp = quote_req.fetch
150
+ timeseries_req = TwelvedataRuby::Request.new(:quote, symbol: "IBM", interval: "1hour", format: :csv)
151
+ timeseries_resp = timeseries_req.fetch
152
+ etd_req = TwelvedataRuby::Request.new(:etd, symbol: "GOOG")
153
+ etd_resp = etd_req.fetch
154
+ # or just simply chain
155
+ price_resp = TwelvedataRuby::Request.new(:price, symbol: "GOOG").fetch
156
+ </code></p>
157
+
158
+ <p>An advantage of building a valid request instance first then invoke the <code>#fetch</code> on it is you actually have an option to not send the request one by one BUT rather send them to the API server all at once simultaneously (might be in parallel). Like so taking the above examples’ request instance objects, send them all simultaneously</p>
159
+
160
+ <p><code>ruby
161
+ # returns a 3 element array of Response objects
162
+ resp_objects_array = TwelvedataRuby::Client.request(quote_req, timeseries_req, etd_req)
163
+ </code></p>
164
+
165
+ <p>Be caution that the above example, depending on the number request objects sent and how large the responses, hitting the daily limit is likely possible. But then again if you have several api keys you might be able to supply each request object with its own apikey. :)</p>
166
+
167
+ <p>TODO: write more documenation especially the response object</p>
168
+
169
+ <h2 id="contributing">Contributing</h2>
170
+
171
+ <p>Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/twelvedata_ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the <a href="https://github.com/[USERNAME]/twelvedata_ruby/blob/master/CODE_OF_CONDUCT.md">code of conduct</a>.</p>
172
+
173
+ <h2 id="license">License</h2>
174
+
175
+ <p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
176
+
177
+ <h2 id="code-of-conduct">Code of Conduct</h2>
178
+
179
+ <p>Everyone interacting in the TwelvedataRuby project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the <a href="https://github.com/[USERNAME]/twelvedata_ruby/blob/master/CODE_OF_CONDUCT.md">code of conduct</a>.</p>
180
+
181
+ <h1 id="notice">Notice</h1>
182
+
183
+ <p>This is not an offical Twelve Data ruby library and the author of this gem is not affiliated with Twelve Data in any way, shape or form. Twelve Data APIs and data are Copyright © 2020 Twelve Data Pte. Ltd</p>
184
+ </div></div>
185
+
186
+ <div id="footer">
187
+ Generated on Tue Jul 13 08:56:46 2021 by
188
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
189
+ 0.9.26 (ruby-3.0.1).
190
+ </div>
191
+
192
+ </div>
193
+ </body>
194
+ </html>
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
+ <meta charset="utf-8" />
6
+
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" />
8
+
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" />
10
+
11
+
12
+
13
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
+
17
+
18
+ <title>File List</title>
19
+ <base id="base_target" target="_parent" />
20
+ </head>
21
+ <body>
22
+ <div id="content">
23
+ <div class="fixed_header">
24
+ <h1 id="full_list_header">File List</h1>
25
+ <div id="full_list_nav">
26
+
27
+ <span><a target="_self" href="class_list.html">
28
+ Classes
29
+ </a></span>
30
+
31
+ <span><a target="_self" href="method_list.html">
32
+ Methods
33
+ </a></span>
34
+
35
+ <span><a target="_self" href="file_list.html">
36
+ Files
37
+ </a></span>
38
+
39
+ </div>
40
+
41
+ <div id="search">Search: <input type="text" /></div>
42
+ </div>
43
+
44
+ <ul id="full_list" class="file">
45
+
46
+
47
+ <li id="object_README" class="odd">
48
+ <div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
49
+ </li>
50
+
51
+
52
+
53
+ </ul>
54
+ </div>
55
+ </body>
56
+ </html>
data/doc/frames.html ADDED
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Documentation by YARD 0.9.26</title>
6
+ </head>
7
+ <script type="text/javascript">
8
+ var match = unescape(window.location.hash).match(/^#!(.+)/);
9
+ var name = match ? match[1] : 'index.html';
10
+ name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
11
+ window.top.location = name;
12
+ </script>
13
+ <noscript>
14
+ <h1>Oops!</h1>
15
+ <h2>YARD requires JavaScript!</h2>
16
+ </noscript>
17
+ </html>
data/doc/index.html ADDED
@@ -0,0 +1,194 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ File: README
8
+
9
+ &mdash; Documentation by YARD 0.9.26
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "README";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index</a> &raquo;
40
+ <span class="title">File: README</span>
41
+
42
+ </div>
43
+
44
+ <div id="search">
45
+
46
+ <a class="full_list_link" id="class_list_link"
47
+ href="class_list.html">
48
+
49
+ <svg width="24" height="24">
50
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
51
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
52
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
53
+ </svg>
54
+ </a>
55
+
56
+ </div>
57
+ <div class="clear"></div>
58
+ </div>
59
+
60
+ <div id="content"><div id='filecontents'><h1 id="twelvedataruby">TwelvedataRuby</h1>
61
+
62
+ <p>TwelvedataRuby is a Ruby library that exposes some convenient ways to access Twelve Data API to get information on stock, forex, crypto, and other financial market data. In order to do so, a free API key is required which can be easily requested <a href="https://twelvedata.com/pricing">here</a>. Visit their <a href="https://twelvedata.com/doc">API’s full documentation</a></p>
63
+
64
+ <h2 id="installation">Installation</h2>
65
+
66
+ <p>Add this line to your application’s Gemfile:</p>
67
+
68
+ <p><code>ruby
69
+ gem 'twelvedata_ruby'
70
+ </code></p>
71
+
72
+ <p>And then execute:</p>
73
+
74
+ <pre class="code ruby"><code class="ruby">$ bundle install
75
+ </code></pre>
76
+
77
+ <p>Or install it yourself as:</p>
78
+
79
+ <pre class="code ruby"><code class="ruby">$ gem install twelvedata_ruby
80
+ </code></pre>
81
+
82
+ <h2 id="usage">Usage</h2>
83
+
84
+ <p>The preferred way to include the Twelve Data API key in the request payload is to assign it to an ENVIRONMENT variable which your Ruby application can fetch if none was explicitly assigned. The default ENVIRONMENTt variable name is <code>TWELVEDATA_API_KEY</code> but you can configure this to any other value using the <code>#apikey_env_var_name=</code> setter method.</p>
85
+
86
+ <p>To get hold of the singleton <code>TwelvedataRuby::Client.instance</code>, you can directly used that inherited instance method from the mixed in <code>Singleton</code> module or thru the gem’s module helper class method:</p>
87
+
88
+ <p><code>ruby
89
+ require "twelvedata_ruby"
90
+ client = TwelvedataRuby.client
91
+ </code></p>
92
+
93
+ <p>By not passing anything to the options method parameters, the <code>client</code> instance attributes will have default values. Though you can still set different values to the attributes through their helper setter methods:</p>
94
+
95
+ <p><code>ruby
96
+ client.apikey = "twelvedata-apikey"
97
+ client.apikey_env_var_name = "the_environment_variable_name" # the helper getter method will upcase the value
98
+ client.connect_timeout = 300 # can also accept "300"
99
+ </code></p>
100
+
101
+ <p>or simply set them all at once:</p>
102
+
103
+ <p><code>ruby
104
+ require "twelvedata_ruby"
105
+ client = TwelvedataRuby.client(apikey: "twelvedata-apikey", connect_timeout: 300)
106
+ # or client = TwelvedataRuby.client(apikey_env_var_name: "the_environment_variable_name", connect_timeout: 300)
107
+ </code></p>
108
+
109
+ <p>The default values though are sufficient already.</p>
110
+
111
+ <p>Getting any type of financial data then from the API, simply invoke any valid endpoint name to the client instance. For example, to fetch some data for <code>GOOG</code> stock symbol using quote, timeseries, price, and etd API endpoints:</p>
112
+
113
+ <p><code>ruby
114
+ # 1. response content-type will be :csv
115
+ client.quote(symbol: "GOOG", format: :csv)
116
+ # 2. assigns custom attachment name
117
+ client.timeseries(symbol: "GOOG", interval: "1hour", format: :csv, filename: "google_timeseries_1hour.csv")
118
+ # 3. the content-type format will be :json
119
+ client.price(symbol: "GOOG")
120
+ # 4. the passed apikey is the used in the request payload
121
+ client.etd(symbol: "GOOG", apikey: "overrides-whatever-is-the-current-apikey")
122
+ # 5. an example of invocation which the API will respond with 401 error code
123
+ client.etd(symbol: "GOOG", apikey: "invalid-api-key")
124
+ # 6. still exactly the same object with client
125
+ TwelvedataRuby.client.api_usage
126
+ # 7. an invalid request wherein the required query parameter :interval is missing
127
+ TwelvedataRuby.client.timeseries(symbol: "GOOG")
128
+ # 8. an invalid request because it contains an invalid parameter
129
+ client.price(symbol: "GOOG", invalid_parameter: "value")
130
+ # 9. invoking a non-existing API endpoint will cause a NoMethodError exception
131
+ client.price(symbol: "GOOG", invalid_parameter: "value")
132
+ </code></p>
133
+
134
+ <p>All of the invocations possible return instance value is one of the following:
135
+ - <code>TwelvedataRuby::Response</code> instance object which <code>#error</code> instance getter method can return a nil or kind of <code>TwelvedataRuby::ResponseError</code> instance if the API, or the API web server responded with some errors. #5 is an example which the API response will have status error with 401 code. <code>TwelvedataRuby::Response</code> resolves this into <code>TwelvedataRuby::UnauthorizedResponseError</code> instance.
136
+ - <code>TwelvedataRuby::ResponseError</code> instance object itself when some error occurred that’s not coming from the API
137
+ - a Hash instance which has an <code>:errors</code> key that contains instances of kind <code>TwelvedataRuby::EndpointError</code>. This is an invalid request scenario which the #7, #8, and #9 examples. No actual API request was sent in this scenario.</p>
138
+
139
+ <p>On first invocation of a valid endpoint name, a <code>TwelvedataRuby::Client</code> instance method of the same name is dynamically defined. So in effect, ideally, there can be a one-to-one mapping of all the API endpoints with their respective parameters constraints. Please visit their excellent API documentation to know more of the endpoint details here https://twelvedata.com/doc. Or if you’re in a hurry, you can list the endpoints definitions:</p>
140
+
141
+ <p><code>ruby
142
+ TwelvedataRuby::Endpoint.definitions
143
+ </code></p>
144
+
145
+ <p>Another way of fetching data from API endpoints is by building a valid <code>TwelvedataRuby::Request</code> instance, then invoke <code>#fetch</code> on this instance. The possible return values are the same with the above examples.</p>
146
+
147
+ <p><code>ruby
148
+ quote_req = TwelvedataRuby::Request.new(:quote, symbol: "IBM")
149
+ quote_resp = quote_req.fetch
150
+ timeseries_req = TwelvedataRuby::Request.new(:quote, symbol: "IBM", interval: "1hour", format: :csv)
151
+ timeseries_resp = timeseries_req.fetch
152
+ etd_req = TwelvedataRuby::Request.new(:etd, symbol: "GOOG")
153
+ etd_resp = etd_req.fetch
154
+ # or just simply chain
155
+ price_resp = TwelvedataRuby::Request.new(:price, symbol: "GOOG").fetch
156
+ </code></p>
157
+
158
+ <p>An advantage of building a valid request instance first then invoke the <code>#fetch</code> on it is you actually have an option to not send the request one by one BUT rather send them to the API server all at once simultaneously (might be in parallel). Like so taking the above examples’ request instance objects, send them all simultaneously</p>
159
+
160
+ <p><code>ruby
161
+ # returns a 3 element array of Response objects
162
+ resp_objects_array = TwelvedataRuby::Client.request(quote_req, timeseries_req, etd_req)
163
+ </code></p>
164
+
165
+ <p>Be caution that the above example, depending on the number request objects sent and how large the responses, hitting the daily limit is likely possible. But then again if you have several api keys you might be able to supply each request object with its own apikey. :)</p>
166
+
167
+ <p>TODO: write more documenation especially the response object</p>
168
+
169
+ <h2 id="contributing">Contributing</h2>
170
+
171
+ <p>Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/twelvedata_ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the <a href="https://github.com/[USERNAME]/twelvedata_ruby/blob/master/CODE_OF_CONDUCT.md">code of conduct</a>.</p>
172
+
173
+ <h2 id="license">License</h2>
174
+
175
+ <p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
176
+
177
+ <h2 id="code-of-conduct">Code of Conduct</h2>
178
+
179
+ <p>Everyone interacting in the TwelvedataRuby project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the <a href="https://github.com/[USERNAME]/twelvedata_ruby/blob/master/CODE_OF_CONDUCT.md">code of conduct</a>.</p>
180
+
181
+ <h1 id="notice">Notice</h1>
182
+
183
+ <p>This is not an offical Twelve Data ruby library and the author of this gem is not affiliated with Twelve Data in any way, shape or form. Twelve Data APIs and data are Copyright © 2020 Twelve Data Pte. Ltd</p>
184
+ </div></div>
185
+
186
+ <div id="footer">
187
+ Generated on Tue Jul 13 08:56:46 2021 by
188
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
189
+ 0.9.26 (ruby-3.0.1).
190
+ </div>
191
+
192
+ </div>
193
+ </body>
194
+ </html>