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,104 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class Fattura24::MissingInput - 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"><a href="Error.html">Fattura24::Error</a>
66
+
67
+ </div>
68
+
69
+
70
+
71
+
72
+ </div>
73
+ </nav>
74
+
75
+ <main role="main" aria-labelledby="class-Fattura24::MissingInput">
76
+ <h1 id="class-Fattura24::MissingInput" class="class">
77
+ class Fattura24::MissingInput
78
+ </h1>
79
+
80
+ <section class="description">
81
+
82
+ </section>
83
+
84
+
85
+ <section id="5Buntitled-5D" class="documentation-section">
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ </section>
96
+ </main>
97
+
98
+
99
+ <footer id="validator-badges" role="contentinfo">
100
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
101
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
102
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
103
+ </footer>
104
+
@@ -0,0 +1,104 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class Fattura24::NotSerializable - 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"><a href="Error.html">Fattura24::Error</a>
66
+
67
+ </div>
68
+
69
+
70
+
71
+
72
+ </div>
73
+ </nav>
74
+
75
+ <main role="main" aria-labelledby="class-Fattura24::NotSerializable">
76
+ <h1 id="class-Fattura24::NotSerializable" class="class">
77
+ class Fattura24::NotSerializable
78
+ </h1>
79
+
80
+ <section class="description">
81
+
82
+ </section>
83
+
84
+
85
+ <section id="5Buntitled-5D" class="documentation-section">
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ </section>
96
+ </main>
97
+
98
+
99
+ <footer id="validator-badges" role="contentinfo">
100
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
101
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
102
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
103
+ </footer>
104
+
@@ -0,0 +1,232 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>module Fattura24::Utils - 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="module">
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
+
62
+
63
+
64
+ <!-- Method Quickref -->
65
+ <div id="method-list-section" class="nav-section">
66
+ <h3>Methods</h3>
67
+
68
+ <ul class="link-list" role="directory">
69
+
70
+ <li ><a href="#method-c-crush">::crush</a>
71
+
72
+ <li ><a href="#method-c-crush_array">::crush_array</a>
73
+
74
+ <li ><a href="#method-c-crush_hash">::crush_hash</a>
75
+
76
+ </ul>
77
+ </div>
78
+
79
+ </div>
80
+ </nav>
81
+
82
+ <main role="main" aria-labelledby="module-Fattura24::Utils">
83
+ <h1 id="module-Fattura24::Utils" class="module">
84
+ module Fattura24::Utils
85
+ </h1>
86
+
87
+ <section class="description">
88
+
89
+ </section>
90
+
91
+
92
+ <section id="5Buntitled-5D" class="documentation-section">
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
103
+ <header>
104
+ <h3>Public Class Methods</h3>
105
+ </header>
106
+
107
+
108
+ <div id="method-c-crush" class="method-detail ">
109
+
110
+ <div class="method-heading">
111
+ <span class="method-name">crush</span><span
112
+ class="method-args">(obj)</span>
113
+
114
+ <span class="method-click-advice">click to toggle source</span>
115
+
116
+ </div>
117
+
118
+
119
+ <div class="method-description">
120
+
121
+ <p>This function deeply removes any nil object/value from objects.</p>
122
+
123
+
124
+
125
+
126
+ <div class="method-source-code" id="crush-source">
127
+ <pre><span class="ruby-comment"># File lib/fattura24/utils.rb, line 8</span>
128
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">crush</span>(<span class="ruby-identifier">obj</span>)
129
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">crush_hash</span>(<span class="ruby-identifier">obj</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
130
+
131
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">crush_array</span>(<span class="ruby-identifier">obj</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
132
+
133
+ <span class="ruby-identifier">obj</span>
134
+ <span class="ruby-keyword">end</span></pre>
135
+ </div>
136
+
137
+ </div>
138
+
139
+
140
+
141
+
142
+ </div>
143
+
144
+
145
+ <div id="method-c-crush_array" class="method-detail ">
146
+
147
+ <div class="method-heading">
148
+ <span class="method-name">crush_array</span><span
149
+ class="method-args">(array)</span>
150
+
151
+ <span class="method-click-advice">click to toggle source</span>
152
+
153
+ </div>
154
+
155
+
156
+ <div class="method-description">
157
+
158
+ <p>Deeply removes any nil value from arrays.</p>
159
+
160
+
161
+
162
+
163
+ <div class="method-source-code" id="crush_array-source">
164
+ <pre><span class="ruby-comment"># File lib/fattura24/utils.rb, line 18</span>
165
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">crush_array</span>(<span class="ruby-identifier">array</span>)
166
+ <span class="ruby-identifier">r</span> = <span class="ruby-identifier">array</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span>
167
+ <span class="ruby-identifier">crush</span>(<span class="ruby-identifier">obj</span>)
168
+ <span class="ruby-keyword">end</span>.<span class="ruby-identifier">compact</span>
169
+
170
+ <span class="ruby-identifier">r</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">r</span>
171
+ <span class="ruby-keyword">end</span></pre>
172
+ </div>
173
+
174
+ </div>
175
+
176
+
177
+
178
+
179
+ </div>
180
+
181
+
182
+ <div id="method-c-crush_hash" class="method-detail ">
183
+
184
+ <div class="method-heading">
185
+ <span class="method-name">crush_hash</span><span
186
+ class="method-args">(hash)</span>
187
+
188
+ <span class="method-click-advice">click to toggle source</span>
189
+
190
+ </div>
191
+
192
+
193
+ <div class="method-description">
194
+
195
+ <p>Deeply removes any nil value from hashes.</p>
196
+
197
+
198
+
199
+
200
+ <div class="method-source-code" id="crush_hash-source">
201
+ <pre><span class="ruby-comment"># File lib/fattura24/utils.rb, line 28</span>
202
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">crush_hash</span>(<span class="ruby-identifier">hash</span>)
203
+ <span class="ruby-identifier">r</span> = <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">each_with_object</span>({}) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>), <span class="ruby-identifier">h</span><span class="ruby-operator">|</span>
204
+ <span class="ruby-keyword">if</span> (<span class="ruby-identifier">crushed_v</span> = <span class="ruby-identifier">crush</span>(<span class="ruby-identifier">v</span>))
205
+ <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">crushed_v</span>
206
+ <span class="ruby-keyword">end</span>
207
+ <span class="ruby-keyword">end</span>
208
+
209
+ <span class="ruby-identifier">r</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">r</span>
210
+ <span class="ruby-keyword">end</span></pre>
211
+ </div>
212
+
213
+ </div>
214
+
215
+
216
+
217
+
218
+ </div>
219
+
220
+
221
+ </section>
222
+
223
+ </section>
224
+ </main>
225
+
226
+
227
+ <footer id="validator-badges" role="contentinfo">
228
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
229
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
230
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
231
+ </footer>
232
+
@@ -0,0 +1,273 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>README - 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="file">
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
+ <div class="nav-section">
59
+ <h3>Table of Contents</h3>
60
+
61
+ <ul class="link-list" role="directory">
62
+ <li><a href="#label-Fattura24">Fattura24</a>
63
+ <li><a href="#label-Installation">Installation</a>
64
+ <li><a href="#label-Usage">Usage</a>
65
+ <li><a href="#label-Api+calls">Api calls</a>
66
+ <li><a href="#label-TestKey-2C+GetTemplate-2C+GetPdc-2C+GetNumerator">TestKey, GetTemplate, GetPdc, GetNumerator</a>
67
+ <li><a href="#label-SaveCustomer">SaveCustomer</a>
68
+ <li><a href="#label-SaveDocument">SaveDocument</a>
69
+ <li><a href="#label-GetFile">GetFile</a>
70
+ <li><a href="#label-GetProduct">GetProduct</a>
71
+ <li><a href="#label-Development">Development</a>
72
+ <li><a href="#label-Release+of+a+new+version">Release of a new version</a>
73
+ <li><a href="#label-Contributing">Contributing</a>
74
+ <li><a href="#label-License">License</a>
75
+ </ul>
76
+ </div>
77
+
78
+
79
+ <div id="project-metadata">
80
+ <div id="fileindex-section" class="nav-section">
81
+ <h3>Pages</h3>
82
+
83
+ <ul class="link-list">
84
+
85
+ <li><a href="./README_md.html">README</a>
86
+
87
+ </ul>
88
+ </div>
89
+
90
+ </div>
91
+ </nav>
92
+
93
+ <main role="main" aria-label="Page README.md">
94
+
95
+ <h1 id="label-Fattura24"><a href="Fattura24.html"><code>Fattura24</code></a><span><a href="#label-Fattura24">&para;</a> <a href="#top">&uarr;</a></span></h1>
96
+
97
+ <p><a href="https://travis-ci.org/snada/fattura24"><img src="https://travis-ci.org/snada/fattura24.svg?branch=master"></a> <a href="https://codeclimate.com/github/snada/fattura24/maintainability"><img src="https://api.codeclimate.com/v1/badges/8db0d6f2c8e567f09319/maintainability"></a> <a href="https://codeclimate.com/github/snada/fattura24/test_coverage"><img src="https://api.codeclimate.com/v1/badges/8db0d6f2c8e567f09319/test_coverage"></a></p>
98
+
99
+ <p>Simple, lightweight and with minimal dependencies ruby 2 wrapper for the <a href="https://www.fattura24.com/">Fattura24</a> apis.</p>
100
+
101
+ <p>Tested and developed on rubies 2.4+.</p>
102
+
103
+ <h2 id="label-Installation">Installation<span><a href="#label-Installation">&para;</a> <a href="#top">&uarr;</a></span></h2>
104
+
105
+ <p>Add this line to your application&#39;s Gemfile:</p>
106
+
107
+ <pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-string">&#39;fattura24&#39;</span>
108
+ </pre>
109
+
110
+ <p>And then execute:</p>
111
+
112
+ <pre>$ bundle</pre>
113
+
114
+ <p>Or install it yourself as:</p>
115
+
116
+ <pre>$ gem install fattura24</pre>
117
+
118
+ <h2 id="label-Usage">Usage<span><a href="#label-Usage">&para;</a> <a href="#top">&uarr;</a></span></h2>
119
+
120
+ <p>First, configure the module by adding your api key.</p>
121
+
122
+ <pre class="ruby"><span class="ruby-constant">Fattura24</span>.<span class="ruby-identifier">configure</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">configuration</span><span class="ruby-operator">|</span>
123
+ <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">api_key</span> = <span class="ruby-string">&#39;your_secret_key&#39;</span>
124
+ <span class="ruby-keyword">end</span>
125
+ </pre>
126
+
127
+ <p>Once set, you can call the api methods to get the responses you need.</p>
128
+
129
+ <pre class="ruby"><span class="ruby-comment"># This method checks if your key is valid</span>
130
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">Api</span>.<span class="ruby-identifier">test_key</span>
131
+
132
+ <span class="ruby-comment"># Check for possible network errors, returns true on ok (200) responses</span>
133
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">success?</span>
134
+
135
+ <span class="ruby-comment"># Call .to_h to get a hash version of the xml response</span>
136
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">to_h</span>[<span class="ruby-value">:returnCode</span>]
137
+
138
+ <span class="ruby-comment"># If you need more info, check the raw Net::HTTP response object</span>
139
+ <span class="ruby-identifier">raw_response</span> = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">http_response</span>
140
+ </pre>
141
+
142
+ <h3 id="label-Api+calls">Api calls<span><a href="#label-Api+calls">&para;</a> <a href="#top">&uarr;</a></span></h3>
143
+
144
+ <p>You can take inspiration on the params to provide to your calls by visiting the <a href="https://www.fattura24.com/api-documentazione/">official documentation</a>. Generally speaking, this library will translate the structure of your hash to an equivalent xml document camelizing all of your keys.</p>
145
+
146
+ <h4 id="label-TestKey-2C+GetTemplate-2C+GetPdc-2C+GetNumerator">TestKey, GetTemplate, GetPdc, GetNumerator<span><a href="#label-TestKey-2C+GetTemplate-2C+GetPdc-2C+GetNumerator">&para;</a> <a href="#top">&uarr;</a></span></h4>
147
+
148
+ <p>All of these calls don&#39;t require any argument. Simply call them and inspect their response:</p>
149
+
150
+ <pre class="ruby"><span class="ruby-identifier">r</span> = <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">Api</span>.<span class="ruby-identifier">test_key</span>
151
+ <span class="ruby-identifier">r</span> = <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">Api</span>.<span class="ruby-identifier">get_template</span>
152
+ <span class="ruby-identifier">r</span> = <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">Api</span>.<span class="ruby-identifier">get_pdc</span>
153
+ <span class="ruby-identifier">r</span> = <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">Api</span>.<span class="ruby-identifier">get_numerator</span>
154
+
155
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">to_h</span>
156
+ </pre>
157
+
158
+ <h4 id="label-SaveCustomer">SaveCustomer<span><a href="#label-SaveCustomer">&para;</a> <a href="#top">&uarr;</a></span></h4>
159
+
160
+ <pre class="ruby"><span class="ruby-identifier">r</span> = <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">Api</span>.<span class="ruby-identifier">save_customer</span>(
161
+ <span class="ruby-value">customer_name:</span> <span class="ruby-string">&#39;John Doe&#39;</span>,
162
+ <span class="ruby-value">customer_address:</span> <span class="ruby-string">&#39;100 Yonge Street&#39;</span>,
163
+ <span class="ruby-value">customer_city:</span> <span class="ruby-string">&#39;Toronto&#39;</span>,
164
+ <span class="ruby-value">customer_country:</span> <span class="ruby-string">&#39;CA&#39;</span>,
165
+ <span class="ruby-value">customer_fiscal_code:</span> <span class="ruby-string">&#39;Set this for persons&#39;</span>,
166
+ <span class="ruby-value">customer_vat_code:</span> <span class="ruby-string">&#39;vat&#39;</span>,
167
+ <span class="ruby-value">customer_email:</span> <span class="ruby-string">&#39;some@email.com&#39;</span>,
168
+ <span class="ruby-value">fe_customer_pec:</span> <span class="ruby-string">&#39;a@pec.com&#39;</span>
169
+ )
170
+ </pre>
171
+
172
+ <h4 id="label-SaveDocument">SaveDocument<span><a href="#label-SaveDocument">&para;</a> <a href="#top">&uarr;</a></span></h4>
173
+
174
+ <pre class="ruby"><span class="ruby-identifier">r</span> = <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">Api</span>.<span class="ruby-identifier">save_document</span>(
175
+ <span class="ruby-value">document_type:</span> <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">DocumentType</span><span class="ruby-operator">::</span><span class="ruby-constant">ELECTRONIC_INVOICE</span>,
176
+ <span class="ruby-value">customer_name:</span> <span class="ruby-string">&#39;John Doe&#39;</span>,
177
+ <span class="ruby-value">customer_fiscal_code:</span> <span class="ruby-string">&#39;NDASFN89A27L219Y&#39;</span>,
178
+ <span class="ruby-value">customer_address:</span> <span class="ruby-string">&#39;100 Yonge Street&#39;</span>,
179
+ <span class="ruby-value">customer_city:</span> <span class="ruby-string">&#39;Toronto&#39;</span>,
180
+ <span class="ruby-value">customer_country:</span> <span class="ruby-string">&#39;CA&#39;</span>,
181
+ <span class="ruby-value">payments:</span> [
182
+ {
183
+ <span class="ruby-value">date:</span> <span class="ruby-string">&#39;2020-04-27&#39;</span>,
184
+ <span class="ruby-value">amount:</span> <span class="ruby-string">&#39;100&#39;</span>,
185
+ <span class="ruby-value">paid:</span> <span class="ruby-string">&#39;true&#39;</span>
186
+ }
187
+ ],
188
+ <span class="ruby-value">rows:</span> [
189
+ {
190
+ <span class="ruby-value">code:</span> <span class="ruby-string">&#39;001&#39;</span>,
191
+ <span class="ruby-value">description:</span> <span class="ruby-string">&#39;Element description&#39;</span>,
192
+ <span class="ruby-value">qty:</span> <span class="ruby-string">&#39;1&#39;</span>,
193
+ <span class="ruby-value">price:</span> <span class="ruby-string">&#39;100&#39;</span>
194
+ }
195
+ ],
196
+ <span class="ruby-value">id_template:</span> <span class="ruby-string">&#39;65&#39;</span>,
197
+ <span class="ruby-value">send_email:</span> <span class="ruby-string">&#39;true&#39;</span>,
198
+ <span class="ruby-value">object:</span> <span class="ruby-string">&#39;test&#39;</span>,
199
+ <span class="ruby-value">total:</span> <span class="ruby-value">100</span>,
200
+ <span class="ruby-value">total_without_tax:</span> <span class="ruby-value">100</span>,
201
+ <span class="ruby-value">vat_amount:</span> <span class="ruby-value">0</span>
202
+ )
203
+ </pre>
204
+
205
+ <h4 id="label-GetFile">GetFile<span><a href="#label-GetFile">&para;</a> <a href="#top">&uarr;</a></span></h4>
206
+
207
+ <pre class="ruby"><span class="ruby-identifier">r</span> = <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">Api</span>.<span class="ruby-identifier">get_file</span>(<span class="ruby-string">&#39;1234567&#39;</span>)
208
+
209
+ <span class="ruby-comment"># true if response content is actually a file</span>
210
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">pdf?</span>
211
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">write</span>(<span class="ruby-string">&#39;invoice.pdf&#39;</span>, <span class="ruby-identifier">r</span>.<span class="ruby-identifier">to_s</span>)
212
+ <span class="ruby-keyword">end</span>
213
+ </pre>
214
+
215
+ <h4 id="label-GetProduct">GetProduct<span><a href="#label-GetProduct">&para;</a> <a href="#top">&uarr;</a></span></h4>
216
+
217
+ <pre class="ruby"><span class="ruby-comment"># gets all products</span>
218
+ <span class="ruby-identifier">r</span> = <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">Api</span>.<span class="ruby-identifier">get_product</span>
219
+
220
+ <span class="ruby-comment"># filters by code</span>
221
+ <span class="ruby-identifier">r</span> = <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">Api</span>.<span class="ruby-identifier">get_product</span>(<span class="ruby-value">code:</span> <span class="ruby-string">&#39;some_code&#39;</span>)
222
+
223
+ <span class="ruby-comment"># filters by category</span>
224
+ <span class="ruby-identifier">r</span> = <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">Api</span>.<span class="ruby-identifier">get_product</span>(<span class="ruby-value">category:</span> <span class="ruby-string">&#39;some_category&#39;</span>)
225
+
226
+ <span class="ruby-comment"># combines both</span>
227
+ <span class="ruby-identifier">r</span> = <span class="ruby-constant">Fattura24</span><span class="ruby-operator">::</span><span class="ruby-constant">Api</span>.<span class="ruby-identifier">get_product</span>({
228
+ <span class="ruby-value">code:</span> <span class="ruby-string">&#39;some_code&#39;</span>,
229
+ <span class="ruby-value">category:</span> <span class="ruby-string">&#39;some_category&#39;</span>
230
+ })
231
+ </pre>
232
+
233
+ <h2 id="label-Development">Development<span><a href="#label-Development">&para;</a> <a href="#top">&uarr;</a></span></h2>
234
+
235
+ <p>After checking out the repo, run <code>bundle</code> to install dependencies. You can run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
236
+
237
+ <p>To install this gem onto your local machine, run <code>bundle exec rake install</code>.</p>
238
+
239
+ <p>To run tests and linting, simply run <code>bundle exec rake</code>.</p>
240
+
241
+ <p>When you edit something, include appropriate docs and rebuild them by running <code>bundle exec rake rdoc</code>.</p>
242
+
243
+ <p>If you have docker installed, you can test against all of the supported ruby versions by running:</p>
244
+
245
+ <pre>$ make build</pre>
246
+
247
+ <p>That will build the required docker images, and then you can run tests with:</p>
248
+
249
+ <pre>$ make</pre>
250
+
251
+ <h3 id="label-Release+of+a+new+version">Release of a new version<span><a href="#label-Release+of+a+new+version">&para;</a> <a href="#top">&uarr;</a></span></h3>
252
+
253
+ <p>To release a new version, update the version number in <code>lib/fattura24/version.rb</code>. Make sure version tests are still satisfied. Then run <code>bundle exec rake release</code>, which will create a git tag for the version, push git commits and tags, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>.</p>
254
+
255
+ <h2 id="label-Contributing">Contributing<span><a href="#label-Contributing">&para;</a> <a href="#top">&uarr;</a></span></h2>
256
+
257
+ <p>Everyone is welcome to contribute. This project tries to follow the git-flow branching model. Open a branch named <code>feature/&lt;name&gt;</code> and make a PR against <code>develop</code>.</p>
258
+
259
+ <p>Please, make sure you include appropriate unit tests to the codebase (also check coverage) and that your code satisfies rubocop checks.</p>
260
+
261
+ <h2 id="label-License">License<span><a href="#label-License">&para;</a> <a href="#top">&uarr;</a></span></h2>
262
+
263
+ <p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
264
+ </main>
265
+
266
+
267
+
268
+ <footer id="validator-badges" role="contentinfo">
269
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
270
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
271
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
272
+ </footer>
273
+