fakturownia_api 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 +37 -4
- data/lib/fakturownia/api/invoice.rb +5 -0
- data/lib/fakturownia/client.rb +1 -0
- data/lib/fakturownia/version.rb +1 -1
- data/spec/api/invoice_spec.rb +8 -0
- data/spec/client_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cefc739c7f5b142dd7b16d725656aa1ad896bade
|
4
|
+
data.tar.gz: 1e6e2560411f84515b1231980ccffe171c39acc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 047acfb8f4ac09d15c2e64e49862f66719c01ea8fe305d9f3b3c9308377ce37165dd738dd90607fd191008cc03ef2ab210dce746359207292c81b8a61f07b305
|
7
|
+
data.tar.gz: 041f81857e15e0563f02628ddb6ef600fad71c9e021eb8df1334ae3c7b40fcef7435b46b3ed6ab5ef95b8ca4f57fd338a9e6a413ccfaadc6c48c1e78b934b7a8
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Ruby wrapper around API of invoice service fakturownia.pl
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem '
|
10
|
+
gem 'fakturownia_api'
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
@@ -16,16 +16,49 @@ And then execute:
|
|
16
16
|
|
17
17
|
Or install it yourself as:
|
18
18
|
|
19
|
-
$ gem install
|
19
|
+
$ gem install fakturownia_api
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
Create a client with `api_token` and `subdomain`:
|
24
|
+
|
25
|
+
client = Fakturownia::Client.new(api_token: 'YOUR_TOKEN', subdomain: 'YOUR_DOMAIN')
|
26
|
+
|
27
|
+
|
28
|
+
### Invoices
|
29
|
+
|
30
|
+
Create invoice with ([full list of available options](https://github.com/fakturownia/api/)):
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
invoice = {
|
34
|
+
buyer_name: 'Name',
|
35
|
+
buyer_tax_no: ''
|
36
|
+
positions: [
|
37
|
+
{name: 'Product 1', total_price_gross: 10.0, quantity: 2},
|
38
|
+
{name: 'Product 2', total_price_gross: 20.0, quantity: 4}
|
39
|
+
]
|
40
|
+
}
|
41
|
+
|
42
|
+
client.invoice.create(ruby_hash)
|
43
|
+
```
|
44
|
+
|
45
|
+
Download invoice as PDF
|
46
|
+
|
47
|
+
client.invoice.show(id, format: :pdf)
|
48
|
+
|
49
|
+
Change invoice state
|
50
|
+
|
51
|
+
client.invoice.change_status(id, 'paid')
|
52
|
+
|
53
|
+
|
54
|
+
## TODO
|
55
|
+
|
56
|
+
Currently only invoice resource is supported.
|
24
57
|
|
25
58
|
## Contributing
|
26
59
|
|
27
60
|
1. Fork it ( https://github.com/[my-github-username]/fakturownia/fork )
|
28
61
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
62
|
+
3. Commit your changes and tests (`git commit -am 'Add some feature'`)
|
30
63
|
4. Push to the branch (`git push origin my-new-feature`)
|
31
64
|
5. Create a new Pull Request
|
data/lib/fakturownia/client.rb
CHANGED
data/lib/fakturownia/version.rb
CHANGED
data/spec/api/invoice_spec.rb
CHANGED
@@ -41,4 +41,12 @@ describe Fakturownia::Api::Invoice do
|
|
41
41
|
subject.delete(123)
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
describe "#change_status" do
|
46
|
+
it "should perform POST request on connection at /invoices/ID/change_status" do
|
47
|
+
expect(connection).to receive(:post).with('/invoices/123/change_status',
|
48
|
+
invoice: {status: 'paid'})
|
49
|
+
subject.change_status(123, 'paid')
|
50
|
+
end
|
51
|
+
end
|
44
52
|
end
|
data/spec/client_spec.rb
CHANGED
@@ -19,4 +19,11 @@ describe Fakturownia::Client do
|
|
19
19
|
subject.invoice
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
describe '#invoices' do
|
24
|
+
it 'is an alias of #invoice' do
|
25
|
+
expect(subject.invoices).to be_instance_of(subject.invoice.class)
|
26
|
+
expect(subject.invoices.client).to be(subject.invoice.client)
|
27
|
+
end
|
28
|
+
end
|
22
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fakturownia_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shelly Cloud team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|