clx_api 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.yardopts +1 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +55 -0
  7. data/Rakefile +7 -0
  8. data/clx_api.gemspec +26 -0
  9. data/doc/CLX.html +305 -0
  10. data/doc/CLX/API.html +1491 -0
  11. data/doc/CLX/CLXAPIException.html +411 -0
  12. data/doc/CLX/CLXException.html +134 -0
  13. data/doc/CLX/HTTPAdapter.html +1294 -0
  14. data/doc/CLX/HTTPClient.html +1058 -0
  15. data/doc/ClxApi.html +141 -0
  16. data/doc/_index.html +161 -0
  17. data/doc/class_list.html +58 -0
  18. data/doc/css/common.css +1 -0
  19. data/doc/css/full_list.css +57 -0
  20. data/doc/css/style.css +339 -0
  21. data/doc/file.README.html +112 -0
  22. data/doc/file_list.html +60 -0
  23. data/doc/frames.html +26 -0
  24. data/doc/index.html +112 -0
  25. data/doc/js/app.js +219 -0
  26. data/doc/js/full_list.js +181 -0
  27. data/doc/js/jquery.js +4 -0
  28. data/doc/method_list.html +279 -0
  29. data/doc/top-level-namespace.html +112 -0
  30. data/examples/get_gateway_by_id.rb +16 -0
  31. data/examples/get_gateways.rb +18 -0
  32. data/examples/get_operator_by_id.rb +21 -0
  33. data/examples/get_operators.rb +23 -0
  34. data/examples/get_price_entries_by_gateway_id.rb +19 -0
  35. data/examples/get_price_entries_by_gateway_id_and_operator_id.rb +17 -0
  36. data/examples/get_price_entries_by_gateway_id_and_operator_id_and_date.rb +18 -0
  37. data/examples/readme.md +167 -0
  38. data/lib/clx_api.rb +35 -0
  39. data/lib/clx_api/api.rb +132 -0
  40. data/lib/clx_api/exceptions/clx_api_exception.rb +25 -0
  41. data/lib/clx_api/exceptions/clx_exception.rb +8 -0
  42. data/lib/clx_api/http_adapter.rb +129 -0
  43. data/lib/clx_api/http_client.rb +163 -0
  44. data/lib/clx_api/version.rb +4 -0
  45. data/test/adapter/test_adapter.rb +67 -0
  46. data/test/api_test.rb +306 -0
  47. data/test/http_adapter_test.rb +211 -0
  48. data/test/http_client_test.rb +173 -0
  49. data/test/test_helper.rb +7 -0
  50. metadata +168 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bcfda1173b50cd858d90bd2c8071c557ff316d5a
4
+ data.tar.gz: af43ad91b7da35fb76fb0115090bb49c188e488d
5
+ SHA512:
6
+ metadata.gz: 365d5832735246a7d6d44b2bb91511231173aec25d58694f1b38cc23640e79b14e7783b8dee99866de5c42dfe4623f43a9ff0b4bd90a826804064c92c3a06879
7
+ data.tar.gz: 8859394409f47cc0e6725b7175baa9b6f67715c80a2e1b45662db5065493c71b01a6dadfcf6744311c9ee8fd5c7ddee1ab578b1d4bdf57c632735d4dfbd156d4
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.bundle
10
+ *.so
11
+ *.o
12
+ *.a
13
+ mkmf.log
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --private
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in clx_api.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Andreas Fridlund
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # ClxApi
2
+
3
+ A wrapper for easier use of CLX networks API.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'clx_api'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install clx_api
20
+
21
+ ## Usage
22
+
23
+ [See examples folder](https://github.com/CLXNetworks/ruby-api/tree/master/examples)
24
+
25
+ ## For Developers
26
+ ### Set up environment
27
+
28
+ Clone or download and unzip to local folder
29
+ Navigate to folder in console/terminal
30
+
31
+ $ cd [your_development_folder]/ruby_api
32
+
33
+ Install development dependencies
34
+
35
+ $ bundle install
36
+
37
+ ### Runing tests
38
+ [Minitest](https://github.com/seattlerb/minitest) is used for unit testing.
39
+
40
+ $ bundle exec rake test
41
+
42
+ ### Generate documentation
43
+ [Yard](https://github.com/lsegal/yard) generates documentation from comments in the code
44
+
45
+ $ bundle exec yard doc
46
+
47
+ ### Code coverage
48
+ [SimpleCov](https://github.com/colszowka/simplecov) checks test coverage automatically when tests are run
49
+
50
+ ## Contributing
51
+ 1. Fork it ( https://github.com/CLXNetworks/ruby-api/fork )
52
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
53
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
54
+ 4. Push to the branch (`git push origin my-new-feature`)
55
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'test'
6
+ t.pattern = "test/*_test.rb"
7
+ end
data/clx_api.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'clx_api/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "clx_api"
8
+ spec.version = CLX::VERSION
9
+ spec.authors = ["Andreas Fridlund"]
10
+ spec.email = ["afrxx09@student.lnu.se"]
11
+ spec.summary = %q{CLX Networks API Gem.}
12
+ spec.description = %q{Ruby Gem for CLX Networks API.}
13
+ spec.homepage = "https://clxnetworks.com/"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "minitest", "~> 5.5"
24
+ spec.add_development_dependency "yard", "~> 0.8.7.6"
25
+ spec.add_development_dependency "simplecov", "~> 0.10.0"
26
+ end
data/doc/CLX.html ADDED
@@ -0,0 +1,305 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: CLX
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!CLX.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (C)</a> &raquo;
35
+
36
+
37
+ <span class="title">CLX</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Module: CLX
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dt class="r1 last">Defined in:</dt>
82
+ <dd class="r1 last">lib/clx_api.rb<span class="defines">,<br />
83
+ lib/clx_api/api.rb,<br /> lib/clx_api/version.rb,<br /> lib/clx_api/http_client.rb,<br /> lib/clx_api/http_adapter.rb,<br /> lib/clx_api/exceptions/clx_exception.rb,<br /> lib/clx_api/exceptions/clx_api_exception.rb</span>
84
+ </dd>
85
+
86
+ </dl>
87
+ <div class="clear"></div>
88
+
89
+ <h2>Overview</h2><div class="docstring">
90
+ <div class="discussion">
91
+
92
+ <p>Main namespace</p>
93
+
94
+
95
+ </div>
96
+ </div>
97
+ <div class="tags">
98
+
99
+
100
+ </div><h2>Defined Under Namespace</h2>
101
+ <p class="children">
102
+
103
+
104
+
105
+
106
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="CLX/API.html" title="CLX::API (class)">API</a></span>, <span class='object_link'><a href="CLX/CLXAPIException.html" title="CLX::CLXAPIException (class)">CLXAPIException</a></span>, <span class='object_link'><a href="CLX/CLXException.html" title="CLX::CLXException (class)">CLXException</a></span>, <span class='object_link'><a href="CLX/HTTPAdapter.html" title="CLX::HTTPAdapter (class)">HTTPAdapter</a></span>, <span class='object_link'><a href="CLX/HTTPClient.html" title="CLX::HTTPClient (class)">HTTPClient</a></span>
107
+
108
+
109
+ </p>
110
+
111
+ <h2>Constant Summary</h2>
112
+
113
+ <dl class="constants">
114
+
115
+ <dt id="VERSION-constant" class="">VERSION =
116
+ <div class="docstring">
117
+ <div class="discussion">
118
+
119
+ <p>Version</p>
120
+
121
+
122
+ </div>
123
+ </div>
124
+ <div class="tags">
125
+
126
+
127
+ </div>
128
+ </dt>
129
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.0.1</span><span class='tstring_end'>&quot;</span></span></pre></dd>
130
+
131
+ </dl>
132
+
133
+
134
+
135
+
136
+
137
+ <h2>Class Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
138
+ <ul class="summary">
139
+
140
+ <li class="public ">
141
+ <span class="summary_signature">
142
+
143
+ <a href="#base_url-class_method" title="base_url (class method)">+ (Object) <strong>base_url</strong> </a>
144
+
145
+
146
+
147
+ </span>
148
+
149
+
150
+
151
+
152
+ <span class="note title readonly">readonly</span>
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+ <span class="summary_desc"><div class='inline'>
163
+ <p>REST server.</p>
164
+ </div></span>
165
+
166
+ </li>
167
+
168
+
169
+ <li class="public ">
170
+ <span class="summary_signature">
171
+
172
+ <a href="#paths-class_method" title="paths (class method)">+ (Object) <strong>paths</strong> </a>
173
+
174
+
175
+
176
+ </span>
177
+
178
+
179
+
180
+
181
+ <span class="note title readonly">readonly</span>
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+ <span class="summary_desc"><div class='inline'>
192
+ <p>API paths hash.</p>
193
+ </div></span>
194
+
195
+ </li>
196
+
197
+
198
+ </ul>
199
+
200
+
201
+
202
+
203
+
204
+ <div id="class_attr_details" class="attr_details">
205
+ <h2>Class Attribute Details</h2>
206
+
207
+
208
+ <span id=""></span>
209
+ <div class="method_details first">
210
+ <h3 class="signature first" id="base_url-class_method">
211
+
212
+ + (<tt>Object</tt>) <strong>base_url</strong> <span class="extras">(readonly)</span>
213
+
214
+
215
+
216
+
217
+
218
+ </h3><div class="docstring">
219
+ <div class="discussion">
220
+
221
+ <p>REST server</p>
222
+
223
+
224
+ </div>
225
+ </div>
226
+ <div class="tags">
227
+
228
+
229
+ </div><table class="source_code">
230
+ <tr>
231
+ <td>
232
+ <pre class="lines">
233
+
234
+
235
+ 15
236
+ 16
237
+ 17</pre>
238
+ </td>
239
+ <td>
240
+ <pre class="code"><span class="info file"># File 'lib/clx_api.rb', line 15</span>
241
+
242
+ <span class='kw'>def</span> <span class='id identifier rubyid_base_url'>base_url</span>
243
+ <span class='ivar'>@base_url</span>
244
+ <span class='kw'>end</span></pre>
245
+ </td>
246
+ </tr>
247
+ </table>
248
+ </div>
249
+
250
+
251
+ <span id=""></span>
252
+ <div class="method_details ">
253
+ <h3 class="signature " id="paths-class_method">
254
+
255
+ + (<tt>Object</tt>) <strong>paths</strong> <span class="extras">(readonly)</span>
256
+
257
+
258
+
259
+
260
+
261
+ </h3><div class="docstring">
262
+ <div class="discussion">
263
+
264
+ <p>API paths hash</p>
265
+
266
+
267
+ </div>
268
+ </div>
269
+ <div class="tags">
270
+
271
+
272
+ </div><table class="source_code">
273
+ <tr>
274
+ <td>
275
+ <pre class="lines">
276
+
277
+
278
+ 18
279
+ 19
280
+ 20</pre>
281
+ </td>
282
+ <td>
283
+ <pre class="code"><span class="info file"># File 'lib/clx_api.rb', line 18</span>
284
+
285
+ <span class='kw'>def</span> <span class='id identifier rubyid_paths'>paths</span>
286
+ <span class='ivar'>@paths</span>
287
+ <span class='kw'>end</span></pre>
288
+ </td>
289
+ </tr>
290
+ </table>
291
+ </div>
292
+
293
+ </div>
294
+
295
+
296
+ </div>
297
+
298
+ <div id="footer">
299
+ Generated on Mon May 25 12:34:49 2015 by
300
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
301
+ 0.8.7.6 (ruby-2.1.5).
302
+ </div>
303
+
304
+ </body>
305
+ </html>