fattura24 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +2 -0
  3. data/Gemfile +8 -0
  4. data/LICENSE +21 -0
  5. data/README.md +186 -0
  6. data/Rakefile +16 -0
  7. data/docs/Fattura24.html +197 -0
  8. data/docs/Fattura24/Api.html +497 -0
  9. data/docs/Fattura24/Api/Response.html +371 -0
  10. data/docs/Fattura24/Configuration.html +176 -0
  11. data/docs/Fattura24/DocumentType.html +133 -0
  12. data/docs/Fattura24/Error.html +104 -0
  13. data/docs/Fattura24/InvalidParams.html +104 -0
  14. data/docs/Fattura24/MissingApiKey.html +157 -0
  15. data/docs/Fattura24/MissingInput.html +104 -0
  16. data/docs/Fattura24/NotSerializable.html +104 -0
  17. data/docs/Fattura24/Utils.html +232 -0
  18. data/docs/README_md.html +273 -0
  19. data/docs/created.rid +10 -0
  20. data/docs/css/fonts.css +167 -0
  21. data/docs/css/rdoc.css +619 -0
  22. data/docs/fonts/Lato-Light.ttf +0 -0
  23. data/docs/fonts/Lato-LightItalic.ttf +0 -0
  24. data/docs/fonts/Lato-Regular.ttf +0 -0
  25. data/docs/fonts/Lato-RegularItalic.ttf +0 -0
  26. data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
  27. data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
  28. data/docs/images/add.png +0 -0
  29. data/docs/images/arrow_up.png +0 -0
  30. data/docs/images/brick.png +0 -0
  31. data/docs/images/brick_link.png +0 -0
  32. data/docs/images/bug.png +0 -0
  33. data/docs/images/bullet_black.png +0 -0
  34. data/docs/images/bullet_toggle_minus.png +0 -0
  35. data/docs/images/bullet_toggle_plus.png +0 -0
  36. data/docs/images/date.png +0 -0
  37. data/docs/images/delete.png +0 -0
  38. data/docs/images/find.png +0 -0
  39. data/docs/images/loadingAnimation.gif +0 -0
  40. data/docs/images/macFFBgHack.png +0 -0
  41. data/docs/images/package.png +0 -0
  42. data/docs/images/page_green.png +0 -0
  43. data/docs/images/page_white_text.png +0 -0
  44. data/docs/images/page_white_width.png +0 -0
  45. data/docs/images/plugin.png +0 -0
  46. data/docs/images/ruby.png +0 -0
  47. data/docs/images/tag_blue.png +0 -0
  48. data/docs/images/tag_green.png +0 -0
  49. data/docs/images/transparent.png +0 -0
  50. data/docs/images/wrench.png +0 -0
  51. data/docs/images/wrench_orange.png +0 -0
  52. data/docs/images/zoom.png +0 -0
  53. data/docs/index.html +283 -0
  54. data/docs/js/darkfish.js +84 -0
  55. data/docs/js/navigation.js +105 -0
  56. data/docs/js/navigation.js.gz +0 -0
  57. data/docs/js/search.js +110 -0
  58. data/docs/js/search_index.js +1 -0
  59. data/docs/js/search_index.js.gz +0 -0
  60. data/docs/js/searcher.js +229 -0
  61. data/docs/js/searcher.js.gz +0 -0
  62. data/docs/table_of_contents.html +216 -0
  63. data/fattura24.gemspec +54 -0
  64. data/lib/fattura24.rb +28 -0
  65. data/lib/fattura24/api/client.rb +160 -0
  66. data/lib/fattura24/api/response.rb +70 -0
  67. data/lib/fattura24/configuration.rb +14 -0
  68. data/lib/fattura24/document_type.rb +15 -0
  69. data/lib/fattura24/errors.rb +20 -0
  70. data/lib/fattura24/utils.rb +38 -0
  71. data/lib/fattura24/version.rb +5 -0
  72. metadata +267 -0
@@ -0,0 +1,371 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class Fattura24::Api::Response - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "../../";
11
+ var index_rel_prefix = "../../";
12
+ </script>
13
+
14
+ <script src="../../js/navigation.js" defer></script>
15
+ <script src="../../js/search.js" defer></script>
16
+ <script src="../../js/search_index.js" defer></script>
17
+ <script src="../../js/searcher.js" defer></script>
18
+ <script src="../../js/darkfish.js" defer></script>
19
+
20
+ <link href="../../css/fonts.css" rel="stylesheet">
21
+ <link href="../../css/rdoc.css" rel="stylesheet">
22
+
23
+
24
+
25
+ <body id="top" role="document" class="class">
26
+ <nav role="navigation">
27
+ <div id="project-navigation">
28
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
29
+ <h2>
30
+ <a href="../../index.html" rel="home">Home</a>
31
+ </h2>
32
+
33
+ <div id="table-of-contents-navigation">
34
+ <a href="../../table_of_contents.html#pages">Pages</a>
35
+ <a href="../../table_of_contents.html#classes">Classes</a>
36
+ <a href="../../table_of_contents.html#methods">Methods</a>
37
+ </div>
38
+ </div>
39
+
40
+ <div id="search-section" role="search" class="project-section initially-hidden">
41
+ <form action="#" method="get" accept-charset="utf-8">
42
+ <div id="search-field-wrapper">
43
+ <input id="search-field" role="combobox" aria-label="Search"
44
+ aria-autocomplete="list" aria-controls="search-results"
45
+ type="text" name="search" placeholder="Search" spellcheck="false"
46
+ title="Type to search, Up and Down to navigate, Enter to load">
47
+ </div>
48
+
49
+ <ul id="search-results" aria-label="Search Results"
50
+ aria-busy="false" aria-expanded="false"
51
+ aria-atomic="false" class="initially-hidden"></ul>
52
+ </form>
53
+ </div>
54
+
55
+ </div>
56
+
57
+
58
+
59
+ <div id="class-metadata">
60
+
61
+ <div id="parent-class-section" class="nav-section">
62
+ <h3>Parent</h3>
63
+
64
+
65
+ <p class="link">Object
66
+
67
+ </div>
68
+
69
+
70
+
71
+ <!-- Method Quickref -->
72
+ <div id="method-list-section" class="nav-section">
73
+ <h3>Methods</h3>
74
+
75
+ <ul class="link-list" role="directory">
76
+
77
+ <li ><a href="#method-c-new">::new</a>
78
+
79
+ <li ><a href="#method-i-code">#code</a>
80
+
81
+ <li ><a href="#method-i-pdf-3F">#pdf?</a>
82
+
83
+ <li ><a href="#method-i-success-3F">#success?</a>
84
+
85
+ <li ><a href="#method-i-to_h">#to_h</a>
86
+
87
+ <li ><a href="#method-i-to_s">#to_s</a>
88
+
89
+ </ul>
90
+ </div>
91
+
92
+ </div>
93
+ </nav>
94
+
95
+ <main role="main" aria-labelledby="class-Fattura24::Api::Response">
96
+ <h1 id="class-Fattura24::Api::Response" class="class">
97
+ class Fattura24::Api::Response
98
+ </h1>
99
+
100
+ <section class="description">
101
+
102
+ <p>An instance of this class will be returned on every api call, wrapping the content of the response and providing helper methods to navigate it&#39;s content.</p>
103
+
104
+ </section>
105
+
106
+
107
+ <section id="5Buntitled-5D" class="documentation-section">
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ <section class="attribute-method-details" class="method-section">
116
+ <header>
117
+ <h3>Attributes</h3>
118
+ </header>
119
+
120
+
121
+ <div id="attribute-i-http_response" class="method-detail">
122
+ <div class="method-heading attribute-method-heading">
123
+ <span class="method-name">http_response</span><span
124
+ class="attribute-access-type">[R]</span>
125
+ </div>
126
+
127
+ <div class="method-description">
128
+
129
+ <p>When needed, you can directly access the underlying <a href="https://ruby-doc.org/stdlib-2.7.0/libdoc/net/http/rdoc/Net/HTTP.html">Net::HTTP</a> response by calling this method.</p>
130
+
131
+ </div>
132
+ </div>
133
+
134
+ </section>
135
+
136
+
137
+
138
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
139
+ <header>
140
+ <h3>Public Class Methods</h3>
141
+ </header>
142
+
143
+
144
+ <div id="method-c-new" class="method-detail ">
145
+
146
+ <div class="method-heading">
147
+ <span class="method-name">new</span><span
148
+ class="method-args">(http_response)</span>
149
+
150
+ <span class="method-click-advice">click to toggle source</span>
151
+
152
+ </div>
153
+
154
+
155
+ <div class="method-description">
156
+
157
+
158
+
159
+
160
+
161
+
162
+ <div class="method-source-code" id="new-source">
163
+ <pre><span class="ruby-comment"># File lib/fattura24/api/response.rb, line 16</span>
164
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">http_response</span>)
165
+ <span class="ruby-ivar">@http_response</span> = <span class="ruby-identifier">http_response</span>
166
+ <span class="ruby-keyword">end</span></pre>
167
+ </div>
168
+
169
+ </div>
170
+
171
+
172
+
173
+
174
+ </div>
175
+
176
+
177
+ </section>
178
+
179
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
180
+ <header>
181
+ <h3>Public Instance Methods</h3>
182
+ </header>
183
+
184
+
185
+ <div id="method-i-code" class="method-detail ">
186
+
187
+ <div class="method-heading">
188
+ <span class="method-name">code</span><span
189
+ class="method-args">()</span>
190
+
191
+ <span class="method-click-advice">click to toggle source</span>
192
+
193
+ </div>
194
+
195
+
196
+ <div class="method-description">
197
+
198
+ <p>Returns the <code>Integer</code> value of the underlying http request. It does not mean the request performed it&#39;s intended purpose. Make sure you use <a href="Response.html#method-i-to_s"><code>to_s</code></a> or <a href="Response.html#method-i-to_h"><code>to_h</code></a> to explore the actual body of the response.</p>
199
+
200
+
201
+
202
+
203
+ <div class="method-source-code" id="code-source">
204
+ <pre><span class="ruby-comment"># File lib/fattura24/api/response.rb, line 32</span>
205
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">code</span>
206
+ <span class="ruby-identifier">http_response</span>&amp;.<span class="ruby-identifier">code</span>.<span class="ruby-identifier">to_i</span>
207
+ <span class="ruby-keyword">end</span></pre>
208
+ </div>
209
+
210
+ </div>
211
+
212
+
213
+
214
+
215
+ </div>
216
+
217
+
218
+ <div id="method-i-pdf-3F" class="method-detail ">
219
+
220
+ <div class="method-heading">
221
+ <span class="method-name">pdf?</span><span
222
+ class="method-args">()</span>
223
+
224
+ <span class="method-click-advice">click to toggle source</span>
225
+
226
+ </div>
227
+
228
+
229
+ <div class="method-description">
230
+
231
+ <p>Returns <code>true</code> when the body of the request contains a pdf file.</p>
232
+
233
+
234
+
235
+
236
+ <div class="method-source-code" id="pdf-3F-source">
237
+ <pre><span class="ruby-comment"># File lib/fattura24/api/response.rb, line 38</span>
238
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pdf?</span>
239
+ <span class="ruby-identifier">http_response</span>&amp;.<span class="ruby-identifier">content_type</span>&amp;.<span class="ruby-identifier">underscore</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;application/pdf&#39;</span>
240
+ <span class="ruby-keyword">end</span></pre>
241
+ </div>
242
+
243
+ </div>
244
+
245
+
246
+
247
+
248
+ </div>
249
+
250
+
251
+ <div id="method-i-success-3F" class="method-detail ">
252
+
253
+ <div class="method-heading">
254
+ <span class="method-name">success?</span><span
255
+ class="method-args">()</span>
256
+
257
+ <span class="method-click-advice">click to toggle source</span>
258
+
259
+ </div>
260
+
261
+
262
+ <div class="method-description">
263
+
264
+ <p>Returns <code>true</code> when the http response is 200, <code>false</code> otherwise.</p>
265
+
266
+
267
+
268
+
269
+ <div class="method-source-code" id="success-3F-source">
270
+ <pre><span class="ruby-comment"># File lib/fattura24/api/response.rb, line 23</span>
271
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">success?</span>
272
+ <span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value">200</span>
273
+ <span class="ruby-keyword">end</span></pre>
274
+ </div>
275
+
276
+ </div>
277
+
278
+
279
+
280
+
281
+ </div>
282
+
283
+
284
+ <div id="method-i-to_h" class="method-detail ">
285
+
286
+ <div class="method-heading">
287
+ <span class="method-name">to_h</span><span
288
+ class="method-args">()</span>
289
+
290
+ <span class="method-click-advice">click to toggle source</span>
291
+
292
+ </div>
293
+
294
+
295
+ <div class="method-description">
296
+
297
+ <p>Returns an hash representation of the xml body of the response. Raises <a href="../NotSerializable.html">NotSerializable</a> in case of a binary (pdf file) content.</p>
298
+
299
+
300
+
301
+
302
+ <div class="method-source-code" id="to_h-source">
303
+ <pre><span class="ruby-comment"># File lib/fattura24/api/response.rb, line 46</span>
304
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_h</span>
305
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">pdf?</span>
306
+ <span class="ruby-identifier">raise</span>(
307
+ <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">NotSerializable</span>,
308
+ <span class="ruby-string">&#39;Cannot create hash from binary file&#39;</span>
309
+ )
310
+ <span class="ruby-keyword">end</span>
311
+
312
+ <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">from_xml</span>(<span class="ruby-identifier">http_response</span>&amp;.<span class="ruby-identifier">body</span>)
313
+ &amp;.<span class="ruby-identifier">deep_transform_keys</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
314
+ <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">underscore</span>.<span class="ruby-identifier">to_sym</span>
315
+ <span class="ruby-keyword">end</span>
316
+ <span class="ruby-keyword">end</span></pre>
317
+ </div>
318
+
319
+ </div>
320
+
321
+
322
+
323
+
324
+ </div>
325
+
326
+
327
+ <div id="method-i-to_s" class="method-detail ">
328
+
329
+ <div class="method-heading">
330
+ <span class="method-name">to_s</span><span
331
+ class="method-args">()</span>
332
+
333
+ <span class="method-click-advice">click to toggle source</span>
334
+
335
+ </div>
336
+
337
+
338
+ <div class="method-description">
339
+
340
+ <p>Returns the <code>String</code> body of this response. This can be both the original xml on most of the calls or the content of the pdf file when get_file is called.</p>
341
+
342
+
343
+
344
+
345
+ <div class="method-source-code" id="to_s-source">
346
+ <pre><span class="ruby-comment"># File lib/fattura24/api/response.rb, line 65</span>
347
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
348
+ <span class="ruby-identifier">http_response</span>&amp;.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">to_s</span>
349
+ <span class="ruby-keyword">end</span></pre>
350
+ </div>
351
+
352
+ </div>
353
+
354
+
355
+
356
+
357
+ </div>
358
+
359
+
360
+ </section>
361
+
362
+ </section>
363
+ </main>
364
+
365
+
366
+ <footer id="validator-badges" role="contentinfo">
367
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
368
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
369
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
370
+ </footer>
371
+
@@ -0,0 +1,176 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class Fattura24::Configuration - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "../";
11
+ var index_rel_prefix = "../";
12
+ </script>
13
+
14
+ <script src="../js/navigation.js" defer></script>
15
+ <script src="../js/search.js" defer></script>
16
+ <script src="../js/search_index.js" defer></script>
17
+ <script src="../js/searcher.js" defer></script>
18
+ <script src="../js/darkfish.js" defer></script>
19
+
20
+ <link href="../css/fonts.css" rel="stylesheet">
21
+ <link href="../css/rdoc.css" rel="stylesheet">
22
+
23
+
24
+
25
+ <body id="top" role="document" class="class">
26
+ <nav role="navigation">
27
+ <div id="project-navigation">
28
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
29
+ <h2>
30
+ <a href="../index.html" rel="home">Home</a>
31
+ </h2>
32
+
33
+ <div id="table-of-contents-navigation">
34
+ <a href="../table_of_contents.html#pages">Pages</a>
35
+ <a href="../table_of_contents.html#classes">Classes</a>
36
+ <a href="../table_of_contents.html#methods">Methods</a>
37
+ </div>
38
+ </div>
39
+
40
+ <div id="search-section" role="search" class="project-section initially-hidden">
41
+ <form action="#" method="get" accept-charset="utf-8">
42
+ <div id="search-field-wrapper">
43
+ <input id="search-field" role="combobox" aria-label="Search"
44
+ aria-autocomplete="list" aria-controls="search-results"
45
+ type="text" name="search" placeholder="Search" spellcheck="false"
46
+ title="Type to search, Up and Down to navigate, Enter to load">
47
+ </div>
48
+
49
+ <ul id="search-results" aria-label="Search Results"
50
+ aria-busy="false" aria-expanded="false"
51
+ aria-atomic="false" class="initially-hidden"></ul>
52
+ </form>
53
+ </div>
54
+
55
+ </div>
56
+
57
+
58
+
59
+ <div id="class-metadata">
60
+
61
+ <div id="parent-class-section" class="nav-section">
62
+ <h3>Parent</h3>
63
+
64
+
65
+ <p class="link">Object
66
+
67
+ </div>
68
+
69
+
70
+
71
+ <!-- Method Quickref -->
72
+ <div id="method-list-section" class="nav-section">
73
+ <h3>Methods</h3>
74
+
75
+ <ul class="link-list" role="directory">
76
+
77
+ <li ><a href="#method-c-new">::new</a>
78
+
79
+ </ul>
80
+ </div>
81
+
82
+ </div>
83
+ </nav>
84
+
85
+ <main role="main" aria-labelledby="class-Fattura24::Configuration">
86
+ <h1 id="class-Fattura24::Configuration" class="class">
87
+ class Fattura24::Configuration
88
+ </h1>
89
+
90
+ <section class="description">
91
+
92
+ </section>
93
+
94
+
95
+ <section id="5Buntitled-5D" class="documentation-section">
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ <section class="attribute-method-details" class="method-section">
104
+ <header>
105
+ <h3>Attributes</h3>
106
+ </header>
107
+
108
+
109
+ <div id="attribute-i-api_key" class="method-detail">
110
+ <div class="method-heading attribute-method-heading">
111
+ <span class="method-name">api_key</span><span
112
+ class="attribute-access-type">[RW]</span>
113
+ </div>
114
+
115
+ <div class="method-description">
116
+
117
+ <p>Set this attribute to your secret api key to interact with the api</p>
118
+
119
+ </div>
120
+ </div>
121
+
122
+ </section>
123
+
124
+
125
+
126
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
127
+ <header>
128
+ <h3>Public Class Methods</h3>
129
+ </header>
130
+
131
+
132
+ <div id="method-c-new" class="method-detail ">
133
+
134
+ <div class="method-heading">
135
+ <span class="method-name">new</span><span
136
+ class="method-args">()</span>
137
+
138
+ <span class="method-click-advice">click to toggle source</span>
139
+
140
+ </div>
141
+
142
+
143
+ <div class="method-description">
144
+
145
+
146
+
147
+
148
+
149
+
150
+ <div class="method-source-code" id="new-source">
151
+ <pre><span class="ruby-comment"># File lib/fattura24/configuration.rb, line 10</span>
152
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>
153
+ <span class="ruby-ivar">@api_key</span> = <span class="ruby-keyword">nil</span>
154
+ <span class="ruby-keyword">end</span></pre>
155
+ </div>
156
+
157
+ </div>
158
+
159
+
160
+
161
+
162
+ </div>
163
+
164
+
165
+ </section>
166
+
167
+ </section>
168
+ </main>
169
+
170
+
171
+ <footer id="validator-badges" role="contentinfo">
172
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
173
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
174
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
175
+ </footer>
176
+