idoklad 0.0.1 → 0.0.2
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/README.md +51 -0
- data/idoklad.gemspec +1 -1
- data/lib/idoklad/api_request.rb +12 -1
- data/lib/idoklad/issued_invoices.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b044099c69076a54c725f4be4802a742d3b59e4
|
4
|
+
data.tar.gz: 8562c172bd25cc59b373d6be6f39b3360f01f1ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37c99ef6fc1182794a7f23bedf3228ba5fe2b73fa3d90edbb8061c4561ddbc023739d89383f0576f31bae100d9d8d44fe3f0807ed7326768e4ce7c0077a7b5b3
|
7
|
+
data.tar.gz: 220c0c946585e963debb2be4e380d401fa55e8c32abafeb67469397253c65b2e3fea0305ec0c2113788825a7bc79db390848f6e25d5dbaa466f89a45fba16b77
|
data/README.md
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
# iDoklad
|
2
|
+
|
3
|
+
This is a ruby gem for Czech accounting cloud system [iDoklad.cz](http://idoklad.cz) api.
|
4
|
+
|
5
|
+
You can find official iDoklad.cz api documentation on https://app.idoklad.cz/developer.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
To install gem write in console:
|
10
|
+
|
11
|
+
> gem install idoklad
|
12
|
+
|
13
|
+
Or in Gemfile:
|
14
|
+
|
15
|
+
gem 'idoklad'
|
16
|
+
|
17
|
+
## Configuration
|
18
|
+
|
19
|
+
To get gem working you must create an iDoklad initializer file and insert **client_id** and **client_secret** values which you can obtain in [iDoklad.cz administration](https://app.idoklad.cz/Setting/LogonUser).
|
20
|
+
Create *config/initializers/idoklad.rb* file with following content:
|
21
|
+
|
22
|
+
# config/initializers/idoklad.rb
|
23
|
+
|
24
|
+
require 'idoklad'
|
25
|
+
Idoklad.configure do |c|
|
26
|
+
c.client_id = **INSERT_YOUR_CLIENT_ID**
|
27
|
+
c.client_secret = **INSERT_YOUR_CLIENT_SECRET**
|
28
|
+
end
|
29
|
+
|
30
|
+
Of course replace **\*\*INSERT_YOUR_CLIENT_ID\*\*** and **\*\*INSERT_YOUR_CLIENT_SECRET\*\*** with proper values.
|
31
|
+
|
32
|
+
## Functionality
|
33
|
+
|
34
|
+
- [Getting List of Invoices](#getting-list-of-invoices)
|
35
|
+
- [Getting the Default Invoice](#getting-default-invoice)
|
36
|
+
|
37
|
+
### Getting List of Invoices
|
38
|
+
|
39
|
+
It returns the list of all issued invoices:
|
40
|
+
|
41
|
+
@result = Idoklad::IssuedInvoices.get_list
|
42
|
+
|
43
|
+
### Getting Default Invoice
|
44
|
+
|
45
|
+
Returns an empty invoice with initial values according to the agenda settings. Good for issuing new invoice.
|
46
|
+
|
47
|
+
@result = Idoklad::IssuedInvoices.get_default
|
48
|
+
|
49
|
+
## Contribution
|
50
|
+
|
51
|
+
The functionality is being added as I find it required. If you want to contribute or you want me to add some functionality, just [write me](http://coderocket.co).
|
data/idoklad.gemspec
CHANGED
data/lib/idoklad/api_request.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module Idoklad::ApiRequest
|
2
4
|
|
3
5
|
def self.get(path)
|
@@ -8,5 +10,14 @@ module Idoklad::ApiRequest
|
|
8
10
|
http.use_ssl = true
|
9
11
|
http.get(uri.request_uri, {'Authorization' => "Bearer #{@token}"})
|
10
12
|
end
|
11
|
-
|
13
|
+
|
14
|
+
def self.post(path, object)
|
15
|
+
@token ||= Idoklad::Auth.get_token
|
16
|
+
|
17
|
+
uri = URI.parse("#{Idoklad::API_URL}#{path}")
|
18
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
19
|
+
http.use_ssl = true
|
20
|
+
http.post(uri.request_uri, JSON.generate(object), {'Authorization' => "Bearer #{@token}", 'Content-type' => 'application/json'})
|
21
|
+
end
|
22
|
+
|
12
23
|
end
|