fakturoid 0.3.0 → 0.5.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.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop.yml +20 -0
- data/.github/workflows/tests.yml +27 -0
- data/.rubocop.yml +57 -12
- data/.ruby-version +1 -1
- data/CHANGELOG.md +37 -0
- data/Gemfile +3 -1
- data/README.md +173 -31
- data/fakturoid.gemspec +1 -1
- data/lib/fakturoid/api/arguments.rb +3 -1
- data/lib/fakturoid/api/http_methods.rb +2 -0
- data/lib/fakturoid/api.rb +4 -2
- data/lib/fakturoid/client/account.rb +3 -1
- data/lib/fakturoid/client/bank_account.rb +3 -1
- data/lib/fakturoid/client/event.rb +4 -2
- data/lib/fakturoid/client/expense.rb +11 -5
- data/lib/fakturoid/client/generator.rb +6 -4
- data/lib/fakturoid/client/inventory_items.rb +59 -0
- data/lib/fakturoid/client/inventory_moves.rb +36 -0
- data/lib/fakturoid/client/invoice.rb +18 -10
- data/lib/fakturoid/client/number_format.rb +11 -0
- data/lib/fakturoid/client/subject.rb +10 -4
- data/lib/fakturoid/client/todo.rb +3 -1
- data/lib/fakturoid/client/user.rb +4 -2
- data/lib/fakturoid/client.rb +14 -9
- data/lib/fakturoid/config.rb +14 -2
- data/lib/fakturoid/connection.rb +11 -3
- data/lib/fakturoid/railtie.rb +2 -0
- data/lib/fakturoid/request.rb +5 -2
- data/lib/fakturoid/response.rb +21 -19
- data/lib/fakturoid/version.rb +3 -1
- data/lib/fakturoid.rb +14 -12
- data/test/api_test.rb +12 -10
- data/test/config_test.rb +23 -21
- data/test/request_test.rb +8 -6
- data/test/response_test.rb +68 -66
- data/test/test_helper.rb +8 -6
- metadata +12 -7
- data/.circleci/config.yml +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0bd9fc1b14ec03436ce4475e0a3c07a3c1bf5a4c6bb2f0feb0f9f311b2552b6
|
4
|
+
data.tar.gz: c66ecd117726d0e857949499d1a2562f7637645ae477b154715ed33580f3a4b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: affec1b4c502b6689af925a8944868a444e3d47e00e575c9ec63f45ca98f56a6c72c68771432527153ba3f0b799add0c32fabed54bf6f5fd0fb1f48ceeac152f
|
7
|
+
data.tar.gz: fbbcea0fd540d7ece9b88237749d3c2b50218bd5320daaf21dc543c0bc2adabe389229e190f8ca09a712db98d09f5ef02816298ee7c87c914b5f74174c551f5f
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-ruby
|
2
|
+
# https://github.com/actions/starter-workflows/blob/main/ci/ruby.yml
|
3
|
+
|
4
|
+
name: Rubocop
|
5
|
+
on: [push, pull_request]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v3
|
12
|
+
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 3.0
|
17
|
+
bundler-cache: true
|
18
|
+
|
19
|
+
- name: Rubocop
|
20
|
+
run: bundle exec rubocop
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-ruby
|
2
|
+
# https://github.com/actions/starter-workflows/blob/main/ci/ruby.yml
|
3
|
+
|
4
|
+
name: Tests
|
5
|
+
on: [push, pull_request]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
ruby-version: ['2.6', '2.7', '3.0']
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
|
18
|
+
- name: Set up Ruby
|
19
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
20
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
24
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
25
|
+
|
26
|
+
- name: Run tests
|
27
|
+
run: bundle exec rake
|
data/.rubocop.yml
CHANGED
@@ -1,35 +1,80 @@
|
|
1
|
-
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 3.2
|
3
|
+
SuggestExtensions: false
|
4
|
+
NewCops: disable
|
5
|
+
Exclude:
|
6
|
+
- 'Rakefile'
|
7
|
+
- 'fakturoid.gemspec'
|
8
|
+
- 'vendor/**/*'
|
9
|
+
|
10
|
+
Style/Documentation:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Layout/LineLength:
|
2
14
|
Enabled: false
|
3
15
|
|
4
16
|
Metrics/ClassLength:
|
5
17
|
Exclude:
|
6
18
|
- 'test/**/*'
|
7
19
|
|
8
|
-
|
20
|
+
Metrics/BlockLength:
|
21
|
+
Exclude:
|
22
|
+
- 'test/**/*'
|
23
|
+
|
24
|
+
Layout/AccessModifierIndentation:
|
9
25
|
EnforcedStyle: outdent
|
10
26
|
|
11
|
-
|
27
|
+
Layout/CaseIndentation:
|
12
28
|
IndentOneStep: true
|
13
29
|
|
14
30
|
Style/SignalException:
|
15
31
|
EnforcedStyle: only_raise
|
16
32
|
|
17
|
-
|
33
|
+
Layout/TrailingWhitespace:
|
18
34
|
Enabled: false
|
19
35
|
|
20
36
|
Style/ClassAndModuleChildren:
|
21
37
|
Exclude:
|
22
38
|
- 'test/**/*'
|
23
39
|
|
24
|
-
|
25
|
-
|
26
|
-
- '<'
|
27
|
-
- '='
|
40
|
+
Metrics/PerceivedComplexity:
|
41
|
+
Enabled: false
|
28
42
|
|
29
|
-
|
43
|
+
Metrics/MethodLength:
|
30
44
|
Enabled: false
|
31
45
|
|
32
|
-
|
46
|
+
Metrics/AbcSize:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Metrics/CyclomaticComplexity:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
Style/NegatedIf:
|
33
53
|
Exclude:
|
34
|
-
- '
|
35
|
-
|
54
|
+
- 'lib/fakturoid/response.rb'
|
55
|
+
|
56
|
+
Naming/MemoizedInstanceVariableName:
|
57
|
+
Exclude:
|
58
|
+
- 'lib/fakturoid/api.rb'
|
59
|
+
|
60
|
+
Layout/EmptyLineAfterGuardClause:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Layout/EmptyLineBetweenDefs:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Style/HashSyntax:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
Style/RescueStandardError:
|
70
|
+
Exclude:
|
71
|
+
- 'test/response_test.rb'
|
72
|
+
|
73
|
+
Style/TrivialAccessors:
|
74
|
+
Enabled: false
|
75
|
+
|
76
|
+
Style/StringLiterals:
|
77
|
+
EnforcedStyle: double_quotes
|
78
|
+
|
79
|
+
Style/SymbolArray:
|
80
|
+
Enabled: false
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
3.2.0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,40 @@
|
|
1
|
+
## 0.5.0
|
2
|
+
|
3
|
+
- Add support for inventory items and moves.
|
4
|
+
|
5
|
+
## 0.4.0
|
6
|
+
|
7
|
+
- Fix Faraday v1.x deprecations.
|
8
|
+
- Add support for Faraday v2.x.
|
9
|
+
- Add support form number formats endpoint
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
number_formats = Fakturoid::Client::NumberFormat.invoices
|
13
|
+
```
|
14
|
+
|
15
|
+
- Add support for `until`, `updated_until` and `custom_id`
|
16
|
+
params to invoice index action methods
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
invoices = Fakturoid::Client::Invoice.all(since: "2022-03-01T00:00:00+01:00", until: "2022-03-31T23:59:59+01:00")
|
20
|
+
invoices = Fakturoid::Client::Invoice.regular(updated_since: "2022-03-01T00:00:00+01:00", updated_until: "2022-03-31T23:59:59+01:00")
|
21
|
+
proformas = Fakturoid::Client::Invoice.proforma(custom_id: "custom-123")
|
22
|
+
```
|
23
|
+
|
24
|
+
- Add support for `custom_id` param to expense index action method
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
Fakturoid::Client::Expense.all(custom_id: "custom-123")
|
28
|
+
```
|
29
|
+
|
30
|
+
- Add support for pagination to search endpoints
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
Fakturoid::Client::Invoice.search("apples", page: 3)
|
34
|
+
Fakturoid::Client::Expense.search("computers", page: 2)
|
35
|
+
Fakturoid::Client::Subject.search("apple", page: 2)
|
36
|
+
```
|
37
|
+
|
1
38
|
## 0.3.0
|
2
39
|
|
3
40
|
- Add support for `variable_symbol` and `bank_account_id` param in invoice `fire` method.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
# Fakturoid
|
2
2
|
|
3
3
|
The Fakturoid gem is ruby library for API communication with web based invoicing service [www.fakturoid.cz](https://fakturoid.cz).
|
4
|
-
Fakturoid [API documentation](
|
4
|
+
Fakturoid [API documentation](https://fakturoid.docs.apiary.io/).
|
5
5
|
|
6
6
|
[](http://badge.fury.io/rb/fakturoid)
|
7
|
-
[](https://github.com/fakturoid/fakturoid-ruby/actions/workflows/tests.yml)
|
8
|
+
[](https://github.com/fakturoid/fakturoid-ruby/actions/workflows/rubocop.yml)
|
8
9
|
|
9
10
|
## Installation
|
10
11
|
|
11
12
|
Add this line to your application's Gemfile:
|
12
13
|
|
13
14
|
```ruby
|
14
|
-
gem
|
15
|
+
gem "fakturoid"
|
15
16
|
```
|
16
17
|
|
17
18
|
And then run:
|
@@ -24,10 +25,10 @@ Fakturoid gem is configured within config block placed in `config/initializers/f
|
|
24
25
|
|
25
26
|
```ruby
|
26
27
|
Fakturoid.configure do |config|
|
27
|
-
config.email =
|
28
|
-
config.api_key =
|
29
|
-
config.account =
|
30
|
-
config.user_agent =
|
28
|
+
config.email = "yourfakturoid@email.com"
|
29
|
+
config.api_key = "fasdff823fdasWRFKW843ladfjklasdf834"
|
30
|
+
config.account = "applecorp" # former subdomain (first part of URL)
|
31
|
+
config.user_agent = "Name of your app (your@email.com)"
|
31
32
|
end
|
32
33
|
```
|
33
34
|
|
@@ -35,7 +36,7 @@ end
|
|
35
36
|
|
36
37
|
### Account resource
|
37
38
|
|
38
|
-
To get
|
39
|
+
To get information about your account in Fakturoid run following code:
|
39
40
|
|
40
41
|
```ruby
|
41
42
|
response = Fakturoid::Client::Account.current
|
@@ -46,11 +47,11 @@ response.body # contains hash with returned body
|
|
46
47
|
Accessing content of returned body:
|
47
48
|
|
48
49
|
```ruby
|
49
|
-
response.body[
|
50
|
+
response.body["name"] # return name of your company
|
50
51
|
response.name # alternative way of getting the name of your company
|
51
52
|
```
|
52
53
|
|
53
|
-
For the list of all returned account fields see the [Account API documentation](
|
54
|
+
For the list of all returned account fields see the [Account API documentation](https://fakturoid.docs.apiary.io/#reference/account)
|
54
55
|
|
55
56
|
### User resource
|
56
57
|
|
@@ -72,7 +73,17 @@ If you want to get information about one user which belongs to account use:
|
|
72
73
|
response = Fakturoid::Client::User.find(user_id)
|
73
74
|
```
|
74
75
|
|
75
|
-
For the list of all returned user fields see the [Users API documentation](
|
76
|
+
For the list of all returned user fields see the [Users API documentation](https://fakturoid.docs.apiary.io/#reference/users)
|
77
|
+
|
78
|
+
### Number Format resource
|
79
|
+
|
80
|
+
For the list of invoice number formats which belong to the current account:
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
response = Fakturoid::Client::NumberFormat.invoices
|
84
|
+
```
|
85
|
+
|
86
|
+
For the list of all returned user fields see the [Number formats API documentation](https://fakturoid.docs.apiary.io/#reference/number-formats)
|
76
87
|
|
77
88
|
### Subject resource
|
78
89
|
|
@@ -85,7 +96,7 @@ response = Fakturoid::Client::Subject.all(page: 2)
|
|
85
96
|
Fulltext search subjects:
|
86
97
|
|
87
98
|
```ruby
|
88
|
-
response = Fakturoid::Client::Subject.search(
|
99
|
+
response = Fakturoid::Client::Subject.search("Client name")
|
89
100
|
```
|
90
101
|
|
91
102
|
To find one subject use:
|
@@ -97,13 +108,13 @@ response = Fakturoid::Client::Subject.find(subject_id)
|
|
97
108
|
You can create new subject with:
|
98
109
|
|
99
110
|
```ruby
|
100
|
-
response = Fakturoid::Client::Subject.create(name:
|
111
|
+
response = Fakturoid::Client::Subject.create(name: "New client")
|
101
112
|
```
|
102
113
|
|
103
114
|
To update subject use following code:
|
104
115
|
|
105
116
|
```ruby
|
106
|
-
response = Fakturoid::Client::Subject.update(subject_id, name:
|
117
|
+
response = Fakturoid::Client::Subject.update(subject_id, name: "Updated client")
|
107
118
|
```
|
108
119
|
|
109
120
|
Delete subject:
|
@@ -112,7 +123,7 @@ Delete subject:
|
|
112
123
|
Fakturoid::Client::Subject.delete subject_id
|
113
124
|
```
|
114
125
|
|
115
|
-
For the list of all subject fields and options see the [Subjects API documentation](
|
126
|
+
For the list of all subject fields and options see the [Subjects API documentation](https://fakturoid.docs.apiary.io/#reference/subjects)
|
116
127
|
|
117
128
|
### Invoice resource
|
118
129
|
|
@@ -125,7 +136,7 @@ response = Fakturoid::Client::Invoice.all(page: 2)
|
|
125
136
|
Fulltext search invoices:
|
126
137
|
|
127
138
|
```ruby
|
128
|
-
response = Fakturoid::Client::Invoice.search(
|
139
|
+
response = Fakturoid::Client::Invoice.search("Client name")
|
129
140
|
```
|
130
141
|
|
131
142
|
To find one invoice use:
|
@@ -139,8 +150,8 @@ To download invoice in PDF format you can use following code:
|
|
139
150
|
```ruby
|
140
151
|
response = Fakturoid::Client::Invoice.download_pdf(invoice_id)
|
141
152
|
|
142
|
-
File.open
|
143
|
-
f.write
|
153
|
+
File.open("/path/to/file.pdf", "wb") do |f|
|
154
|
+
f.write(response.body)
|
144
155
|
end
|
145
156
|
```
|
146
157
|
|
@@ -152,9 +163,9 @@ invoice = {
|
|
152
163
|
lines: [
|
153
164
|
{
|
154
165
|
quantity: 5,
|
155
|
-
unit_name:
|
156
|
-
name:
|
157
|
-
unit_price:
|
166
|
+
unit_name: "kg",
|
167
|
+
name: "Sand",
|
168
|
+
unit_price: "100",
|
158
169
|
vat_rate: 21
|
159
170
|
}
|
160
171
|
]
|
@@ -165,16 +176,16 @@ response = Fakturoid::Client::Invoice.create(invoice)
|
|
165
176
|
Invoice actions (eg. pay invoice):
|
166
177
|
|
167
178
|
```ruby
|
168
|
-
response = Fakturoid::Client::Invoice.fire(invoice_id,
|
179
|
+
response = Fakturoid::Client::Invoice.fire(invoice_id, "pay")
|
169
180
|
```
|
170
181
|
|
171
|
-
Send invoice with customized message (for more information see [the API Documentation](
|
182
|
+
Send invoice with customized message (for more information see [the API Documentation](https://fakturoid.docs.apiary.io/#reference/messages)):
|
172
183
|
|
173
184
|
```ruby
|
174
185
|
message = {
|
175
|
-
email:
|
176
|
-
email_copy:
|
177
|
-
subject:
|
186
|
+
email: "testemail@testemail.cz",
|
187
|
+
email_copy: "some@emailcopy.cz",
|
188
|
+
subject: "I have an invoice for you",
|
178
189
|
message: "Hi,\n\nyou can find invoice no. #no# on the following page #link#\n\nHave a nice day"
|
179
190
|
}
|
180
191
|
|
@@ -185,7 +196,7 @@ response.status_code # => 201
|
|
185
196
|
To update invoice use following code:
|
186
197
|
|
187
198
|
```ruby
|
188
|
-
response = Fakturoid::Client::Invoice.update(invoice_id, number:
|
199
|
+
response = Fakturoid::Client::Invoice.update(invoice_id, number: "2015-0015")
|
189
200
|
```
|
190
201
|
|
191
202
|
Delete invoice:
|
@@ -194,7 +205,141 @@ Delete invoice:
|
|
194
205
|
response = Fakturoid::Client::Invoice.delete(invoice_id)
|
195
206
|
```
|
196
207
|
|
197
|
-
For the list of all invoice fields and options see the [Invoices API documentation](
|
208
|
+
For the list of all invoice fields and options see the [Invoices API documentation](https://fakturoid.docs.apiary.io/#reference/invoices)
|
209
|
+
|
210
|
+
### InventoryItem resource
|
211
|
+
|
212
|
+
To get all inventory items:
|
213
|
+
|
214
|
+
```ruby
|
215
|
+
response = Fakturoid::Client::InventoryItems.all
|
216
|
+
```
|
217
|
+
|
218
|
+
To filter inventory items by certain SKU code:
|
219
|
+
|
220
|
+
```ruby
|
221
|
+
response = Fakturoid::Client::InventoryItems.all(sku: 'SKU1234')
|
222
|
+
```
|
223
|
+
|
224
|
+
To search inventory items (searches in `name`, `article_number` and `sku`):
|
225
|
+
|
226
|
+
```ruby
|
227
|
+
response = Fakturoid::Client::InventoryItems.search('Item name')
|
228
|
+
```
|
229
|
+
|
230
|
+
To get all archived inventory items:
|
231
|
+
|
232
|
+
```ruby
|
233
|
+
response = Fakturoid::Client::InventoryItems.archived
|
234
|
+
```
|
235
|
+
|
236
|
+
To get a single inventory item:
|
237
|
+
|
238
|
+
```ruby
|
239
|
+
response = Fakturoid::Client::InventoryItems.find(inventory_item_id)
|
240
|
+
```
|
241
|
+
|
242
|
+
To create an inventory item:
|
243
|
+
|
244
|
+
```ruby
|
245
|
+
inventory_item = {
|
246
|
+
name: "Item name",
|
247
|
+
sku: "SKU1234",
|
248
|
+
track_quantity: true,
|
249
|
+
quantity: 100,
|
250
|
+
native_purchase_price: 500,
|
251
|
+
native_retail_price: 1000
|
252
|
+
}
|
253
|
+
response = Fakturoid::Client::InventoryItems.create(inventory_item)
|
254
|
+
```
|
255
|
+
|
256
|
+
To update an inventory item:
|
257
|
+
|
258
|
+
```ruby
|
259
|
+
response = Fakturoid::Client::InventoryItems.update(inventory_item_id, name: "Another name")
|
260
|
+
```
|
261
|
+
|
262
|
+
To archive an inventory item:
|
263
|
+
|
264
|
+
```ruby
|
265
|
+
response = Fakturoid::Client::InventoryItems.archive(inventory_item_id)
|
266
|
+
```
|
267
|
+
|
268
|
+
To unarchive an inventory item:
|
269
|
+
|
270
|
+
```ruby
|
271
|
+
response = Fakturoid::Client::InventoryItems.unarchive(inventory_item_id)
|
272
|
+
```
|
273
|
+
|
274
|
+
To delete an inventory item:
|
275
|
+
|
276
|
+
```ruby
|
277
|
+
response = Fakturoid::Client::InventoryItems.delete(inventory_item_id)
|
278
|
+
```
|
279
|
+
|
280
|
+
### InventoryMove resource
|
281
|
+
|
282
|
+
To get get all inventory moves across all inventory items:
|
283
|
+
|
284
|
+
```ruby
|
285
|
+
response = Fakturoid::Client::InventoryMoves.all
|
286
|
+
```
|
287
|
+
|
288
|
+
To get inventory moves for a single inventory item:
|
289
|
+
|
290
|
+
```ruby
|
291
|
+
response = Fakturoid::Client::InventoryMoves.all(inventory_item_id: inventory_item_id)
|
292
|
+
```
|
293
|
+
|
294
|
+
To get a single inventory move:
|
295
|
+
|
296
|
+
```ruby
|
297
|
+
response = Fakturoid::Client::InventoryMoves.find(inventory_item_id, inventory_move_id)
|
298
|
+
```
|
299
|
+
|
300
|
+
To create a stock-in inventory move:
|
301
|
+
|
302
|
+
```ruby
|
303
|
+
response = Fakturoid::Client::InventoryMoves.create(
|
304
|
+
inventory_item_id,
|
305
|
+
direction: "in",
|
306
|
+
moved_on: Date.today,
|
307
|
+
quantity_change: 5,
|
308
|
+
purchase_price: "249.99",
|
309
|
+
purchase_currency: "CZK",
|
310
|
+
private_note: "Bought with discount"
|
311
|
+
)
|
312
|
+
```
|
313
|
+
|
314
|
+
To create a stock-out inventory move:
|
315
|
+
|
316
|
+
```ruby
|
317
|
+
response = Fakturoid::Client::InventoryMoves.create(
|
318
|
+
inventory_item_id,
|
319
|
+
direction: "out",
|
320
|
+
moved_on: Date.today,
|
321
|
+
quantity_change: "1.5",
|
322
|
+
retail_price: 50,
|
323
|
+
retail_currency: "EUR",
|
324
|
+
native_retail_price: "1250"
|
325
|
+
)
|
326
|
+
```
|
327
|
+
|
328
|
+
To update an inventory move:
|
329
|
+
|
330
|
+
```ruby
|
331
|
+
inventory_move = {
|
332
|
+
private_note: "Text"
|
333
|
+
# Plus other fields if necessary
|
334
|
+
}
|
335
|
+
response = Fakturoid::Client::InventoryMoves.update(inventory_item_id, inventory_move_id, inventory_move)
|
336
|
+
```
|
337
|
+
|
338
|
+
To delete an inventory move:
|
339
|
+
|
340
|
+
```ruby
|
341
|
+
response = Fakturoid::Client::InventoryMoves.delete(inventory_item_id, inventory_move_id)
|
342
|
+
```
|
198
343
|
|
199
344
|
## Handling error responses
|
200
345
|
|
@@ -258,6 +403,3 @@ The Fakturoid gem raises exceptions if error response is returned from the serve
|
|
258
403
|
</tr>
|
259
404
|
</tbody>
|
260
405
|
</table>
|
261
|
-
|
262
|
-
## Thanks
|
263
|
-
Development was supported by [eBallance Creative s.r.o.](http://www.eballance.cz)
|
data/fakturoid.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'fakturoid/version'
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "fakturoid"
|
8
8
|
s.version = Fakturoid::VERSION
|
9
|
-
s.authors = ["Eda Riedl", "Lukáš Konarovský", "Oldřich Vetešník"]
|
9
|
+
s.authors = ["Eda Riedl", "Lukáš Konarovský", "Oldřich Vetešník", "Kamil Hanus"]
|
10
10
|
s.email = ["podpora@fakturoid.cz"]
|
11
11
|
s.summary = %q{Ruby client for web based invoicing service www.fakturoid.cz}
|
12
12
|
s.description = %q{Ruby client for web based invoicing service www.fakturoid.cz}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fakturoid
|
2
4
|
class Api
|
3
5
|
module Arguments
|
@@ -11,7 +13,7 @@ module Fakturoid
|
|
11
13
|
end
|
12
14
|
|
13
15
|
def validate_search_query(query)
|
14
|
-
raise ArgumentError,
|
16
|
+
raise ArgumentError, "Query parameter is required" if query.nil? || query.empty?
|
15
17
|
true
|
16
18
|
end
|
17
19
|
end
|
data/lib/fakturoid/api.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fakturoid
|
2
4
|
module Client
|
3
5
|
class Event < Fakturoid::Api
|
4
6
|
def self.all(params = {})
|
5
7
|
request_params = permit_params(params, :page, :since, :subject_id) || {}
|
6
8
|
|
7
|
-
get_request(
|
9
|
+
get_request("events.json", request_params: request_params)
|
8
10
|
end
|
9
11
|
|
10
12
|
def self.paid(params = {})
|
11
13
|
request_params = permit_params(params, :page, :since, :subject_id) || {}
|
12
14
|
|
13
|
-
get_request(
|
15
|
+
get_request("events/paid.json", request_params: request_params)
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fakturoid
|
2
4
|
module Client
|
3
5
|
class Expense < Fakturoid::Api
|
4
6
|
def self.all(params = {})
|
5
|
-
request_params = permit_params(params, :page, :since, :updated_since, :number, :variable_symbol, :status, :subject_id) || {}
|
7
|
+
request_params = permit_params(params, :page, :since, :updated_since, :number, :variable_symbol, :status, :subject_id, :custom_id) || {}
|
6
8
|
|
7
|
-
get_request(
|
9
|
+
get_request("expenses.json", request_params: request_params)
|
8
10
|
end
|
9
11
|
|
10
12
|
def self.find(id)
|
@@ -12,9 +14,13 @@ module Fakturoid
|
|
12
14
|
get_request("expenses/#{id}.json")
|
13
15
|
end
|
14
16
|
|
15
|
-
def self.search(query)
|
17
|
+
def self.search(query, params = {})
|
16
18
|
validate_search_query(query)
|
17
|
-
|
19
|
+
|
20
|
+
request_params = permit_params(params, :page)
|
21
|
+
request_params[:query] = query
|
22
|
+
|
23
|
+
get_request("expenses/search.json", request_params: request_params)
|
18
24
|
end
|
19
25
|
|
20
26
|
def self.fire(id, event, params = {})
|
@@ -26,7 +32,7 @@ module Fakturoid
|
|
26
32
|
end
|
27
33
|
|
28
34
|
def self.create(payload = {})
|
29
|
-
post_request(
|
35
|
+
post_request("expenses.json", payload: payload)
|
30
36
|
end
|
31
37
|
|
32
38
|
def self.update(id, payload = {})
|