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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0feb037e85b52731732c639ec90277417840ac7
4
- data.tar.gz: f2ce6405b249a71076262794cd7d0fa24e384562
3
+ metadata.gz: cefc739c7f5b142dd7b16d725656aa1ad896bade
4
+ data.tar.gz: 1e6e2560411f84515b1231980ccffe171c39acc0
5
5
  SHA512:
6
- metadata.gz: 7bc2c5ca4fea74cfcefc410bf12b713bfff60a09b5a80ba9e065f22c0379382a2035b5fd7e53a732a6eb5fdc61c54f7cfdb050bf3f9e215fc69e2fc2f18afd30
7
- data.tar.gz: 0cac2d26746d53a5ff522be8b7d98a0d01bb7f35ec10f91f7ad6276028955c43dcded68fde295f571a8767a40324f880f48599431199a3603fcf105b39a9be86
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 'fakturownia'
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 fakturownia
19
+ $ gem install fakturownia_api
20
20
 
21
21
  ## Usage
22
22
 
23
- TODO: Write usage instructions here
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
@@ -20,6 +20,11 @@ module Fakturownia
20
20
  def delete(id)
21
21
  connection.delete("/invoices/#{id}")
22
22
  end
23
+
24
+ def change_status(id, status)
25
+ connection.post("/invoices/#{id}/change_status",
26
+ invoice: {status: status})
27
+ end
23
28
  end
24
29
  end
25
30
  end
@@ -12,5 +12,6 @@ module Fakturownia
12
12
  def invoice
13
13
  Fakturownia::Api::Invoice.new(self)
14
14
  end
15
+ alias_method :invoices, :invoice
15
16
  end
16
17
  end
@@ -1,3 +1,3 @@
1
1
  module Fakturownia
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -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
@@ -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.1
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-02-01 00:00:00.000000000 Z
11
+ date: 2015-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client