superfaktura 0.9.1 → 0.9.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
  SHA256:
3
- metadata.gz: 98f14939657dd3c7ddb4d39714b8b0b39e101e988d84a9d011e6931f25ae122f
4
- data.tar.gz: cea7cf5b52c8092f862b391f3bbb9dc818f673bc3693fe6d2901165ebf85d4ed
3
+ metadata.gz: e1196382e70ffb52f16a2b82e485a8f61841e8b2ed294fb22de9b5b67bf66576
4
+ data.tar.gz: da4b88a9952576ae7c98482ea75b7ba1a1c2352857fa7e5915a7000cbe0af3d9
5
5
  SHA512:
6
- metadata.gz: 463af4001e8d10bd019dc0e92b33f9aec0e4863485ad0e720df8b3ad7a886caabe134415b4908e7952f0bc51c782d4a40483dc23b2691644982b81284502e4be
7
- data.tar.gz: a8a1d0c3b20573366c1919cb5719ecb6a1042e18132e8e4f0e747b1e934709f8b9b7ef227b2c157514f26815a4f7d39c3a015f021f4661d0f8d8d0e2b06a1c68
6
+ metadata.gz: a55ee100119c8fbd5db1b8a82fd264752d5beec0199c166815271d0fcb3d1c713a6539febfbd3568e445a954653101fb14719227b1b5c787354b48b40c0e6729
7
+ data.tar.gz: 421e6169ff940ef83f7003dd88603ec07bdbf82e058bfe42b4f75aeae534b1a810c0dbce905280533f15b80fb6f181bcb42f1056be32be5688f53c6c545522b8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superfaktura (0.9.1)
4
+ superfaktura (0.9.2)
5
5
  faraday (~> 1)
6
6
  faraday_middleware (~> 1)
7
7
 
data/changelog.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.2
4
+ Adds download invoice option + locales mapper
5
+
3
6
  ## 0.9.1
4
7
  Adds api status check
5
8
 
data/lib/superfaktura.rb CHANGED
@@ -4,8 +4,9 @@ require 'faraday_middleware'
4
4
 
5
5
  require 'superfaktura/version'
6
6
  require 'superfaktura/configuration'
7
+ require 'superfaktura/locales'
7
8
  require 'superfaktura/base_api'
8
- require 'superfaktura/create_invoice'
9
+ require 'superfaktura/invoices'
9
10
  require 'superfaktura/check_connection'
10
11
 
11
12
  module Superfaktura
@@ -17,7 +17,7 @@ module Superfaktura
17
17
  request.headers['Authorization'] = "SFAPI email=#{Superfaktura.config.email}&apikey=#{Superfaktura.config.token}"
18
18
 
19
19
  request.url(uri)
20
- request.body = "data=#{payload.to_json}"
20
+ request.body = "data=#{payload.to_json}" if payload
21
21
  end
22
22
  raise Superfaktura::Error, response.body['error_message'] unless response.body['error'].zero?
23
23
 
@@ -28,7 +28,7 @@ module Superfaktura
28
28
  request(path, 'POST', payload)
29
29
  end
30
30
 
31
- def self.get(path, payload)
31
+ def self.get(path, payload = nil)
32
32
  request(path, 'GET', payload)
33
33
  end
34
34
  end
@@ -0,0 +1,11 @@
1
+ module Superfaktura
2
+ class Invoices < BaseApi
3
+ def self.create(attributes)
4
+ post('/invoices/create', attributes)
5
+ end
6
+
7
+ def self.download(id, locale: :en)
8
+ get("/#{Superfaktura::Locales.iso2_to_iso3(locale)}/invoices/pdf/#{id}")
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,23 @@
1
+ module Superfaktura
2
+ class Locales
3
+ LANGUAGES = {
4
+ en: 'eng',
5
+ sk: 'slo',
6
+ hu: 'hun',
7
+ cs: 'cze',
8
+ de: 'deu',
9
+ hr: 'hrv',
10
+ it: 'ita',
11
+ pl: 'pol',
12
+ ro: 'rom',
13
+ ru: 'rus',
14
+ sl: 'slv',
15
+ es: 'spa',
16
+ uk: 'ukr'
17
+ }.freeze
18
+
19
+ def self.iso2_to_iso3(iso2)
20
+ LANGUAGES[iso2.to_sym] || 'eng'
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module Superfaktura
2
- VERSION = '0.9.1'.freeze
2
+ VERSION = '0.9.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superfaktura
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lubomir Vnenk
@@ -149,6 +149,8 @@ files:
149
149
  - lib/superfaktura/check_connection.rb
150
150
  - lib/superfaktura/configuration.rb
151
151
  - lib/superfaktura/create_invoice.rb
152
+ - lib/superfaktura/invoices.rb
153
+ - lib/superfaktura/locales.rb
152
154
  - lib/superfaktura/version.rb
153
155
  - superfaktura.gemspec
154
156
  homepage: https://github.com/lubosch/superfaktura