billomat 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.editorconfig +30 -0
- data/.simplecov +3 -0
- data/.travis.yml +9 -5
- data/README.md +32 -12
- data/billomat.gemspec +23 -20
- data/lib/billomat/configuration.rb +1 -1
- data/lib/billomat/gateway.rb +16 -8
- data/lib/billomat/models/base.rb +1 -1
- data/lib/billomat/version.rb +1 -1
- metadata +17 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f45599f6cc7b2c78849f97556c4420e757fdf05f7c2556d78c519cf6ae2410f3
|
4
|
+
data.tar.gz: e9d465ffa1069c9cedb125a8f03ac15b5f47bebd72e7b606c2385d32d6cca8ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18f1e4f613bc73b4ee1b38fad96cc91430f01387950f32982edc27d2529108834f4d9425070c60df440a86d337007e77c21a3738a7c1b74586948a78f4e02237
|
7
|
+
data.tar.gz: 723a5490133704e97565d2d4b515a4273c78ce2b3a913dfb7f2c0d972343c568234c283f5cc78e446352db1e9f0647ee2b2a4da9c81eadb6381bec3e8d94a6c8
|
data/.editorconfig
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# http://editorconfig.org
|
2
|
+
root = true
|
3
|
+
|
4
|
+
[*]
|
5
|
+
indent_style = space
|
6
|
+
indent_size = 2
|
7
|
+
end_of_line = lf
|
8
|
+
charset = utf-8
|
9
|
+
trim_trailing_whitespace = true
|
10
|
+
insert_final_newline = true
|
11
|
+
|
12
|
+
[*.md]
|
13
|
+
trim_trailing_whitespace = true
|
14
|
+
|
15
|
+
[*.json]
|
16
|
+
indent_style = space
|
17
|
+
indent_size = 2
|
18
|
+
|
19
|
+
[*.yml]
|
20
|
+
indent_style = space
|
21
|
+
indent_size = 2
|
22
|
+
|
23
|
+
[Makefile]
|
24
|
+
trim_trailing_whitespace = true
|
25
|
+
indent_style = tab
|
26
|
+
indent_size = 4
|
27
|
+
|
28
|
+
[*.sh]
|
29
|
+
indent_style = space
|
30
|
+
indent_size = 2
|
data/.simplecov
ADDED
data/.travis.yml
CHANGED
@@ -1,14 +1,18 @@
|
|
1
|
+
sudo: false
|
2
|
+
|
1
3
|
env:
|
2
4
|
global:
|
3
5
|
- CC_TEST_REPORTER_ID=a77802032cccc178727a1df1ff1f283a8255959f9a175f20b73b8231ca35da2f
|
4
|
-
|
6
|
+
|
5
7
|
language: ruby
|
6
8
|
rvm:
|
7
|
-
- 2.
|
8
|
-
- 2.1
|
9
|
-
- 2.2
|
10
|
-
- 2.3
|
9
|
+
- 2.5
|
11
10
|
- 2.4
|
11
|
+
- 2.3
|
12
|
+
- 2.2
|
13
|
+
- 2.1
|
14
|
+
- 2.0
|
15
|
+
|
12
16
|
before_install: gem install bundler -v 1.15.1
|
13
17
|
before_script:
|
14
18
|
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
data/README.md
CHANGED
@@ -4,8 +4,17 @@
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/billomat.svg)](https://badge.fury.io/rb/billomat)
|
5
5
|
[![Maintainability](https://api.codeclimate.com/v1/badges/49baf848f42a2e5b95db/maintainability)](https://codeclimate.com/github/hausgold/billomat/maintainability)
|
6
6
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/49baf848f42a2e5b95db/test_coverage)](https://codeclimate.com/github/hausgold/billomat/test_coverage)
|
7
|
+
[![API docs](https://img.shields.io/badge/docs-API-blue.svg)](https://www.rubydoc.info/gems/billomat)
|
7
8
|
|
8
|
-
This gem provides a Ruby API for [billomat.com](https://billomat.com) - an
|
9
|
+
This gem provides a Ruby API for [billomat.com](https://billomat.com) - an
|
10
|
+
online accounting service.
|
11
|
+
|
12
|
+
- [Installation](#installation)
|
13
|
+
- [Usage](#usage)
|
14
|
+
- [Configuration](#configuration)
|
15
|
+
- [Basic usage](#basic-usage)
|
16
|
+
- [Development](#development)
|
17
|
+
- [Contributing](#contributing)
|
9
18
|
|
10
19
|
## Installation
|
11
20
|
|
@@ -37,9 +46,18 @@ or inside an initializer.
|
|
37
46
|
|
38
47
|
```ruby
|
39
48
|
Billomat.configure do |config|
|
40
|
-
|
41
|
-
config.
|
42
|
-
|
49
|
+
# Subdomain, e.g. example.billomat.net
|
50
|
+
config.subdomain = 'example'
|
51
|
+
# API key
|
52
|
+
config.api_key = '4aefdc...'
|
53
|
+
# timeout in seconds
|
54
|
+
config.timeout = 5
|
55
|
+
|
56
|
+
# You can also configure a registerd app to increase your
|
57
|
+
# API call limit as described here:
|
58
|
+
# https://www.billomat.com/en/api/basics/rate-limiting/
|
59
|
+
config.app_id = '12345'
|
60
|
+
config.app_secret = 'c3df...'
|
43
61
|
end
|
44
62
|
```
|
45
63
|
|
@@ -67,17 +85,19 @@ client.delete
|
|
67
85
|
=> true
|
68
86
|
```
|
69
87
|
|
70
|
-
### Documentation
|
71
|
-
|
72
|
-
The RubyDoc is available [here](http://www.rubydoc.info/gems/billomat).
|
73
|
-
|
74
|
-
|
75
88
|
## Development
|
76
89
|
|
77
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
90
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
91
|
+
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
92
|
+
prompt that will allow you to experiment.
|
78
93
|
|
79
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To
|
94
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
95
|
+
release a new version, update the version number in `version.rb`, and then run
|
96
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
97
|
+
git commits and tags, and push the `.gem` file to
|
98
|
+
[rubygems.org](https://rubygems.org).
|
80
99
|
|
81
100
|
## Contributing
|
82
101
|
|
83
|
-
Bug reports and pull requests are welcome on GitHub at
|
102
|
+
Bug reports and pull requests are welcome on GitHub at
|
103
|
+
https://github.com/hausgold/billomat.
|
data/billomat.gemspec
CHANGED
@@ -1,40 +1,43 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
5
|
+
require 'billomat/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'billomat'
|
8
9
|
spec.version = Billomat::VERSION
|
9
10
|
spec.licenses = ['MIT']
|
10
|
-
spec.authors = [
|
11
|
-
spec.email = [
|
11
|
+
spec.authors = ['Henning Vogt']
|
12
|
+
spec.email = ['henning.vogt@hausgold.de']
|
12
13
|
|
13
|
-
spec.summary =
|
14
|
-
spec.homepage =
|
14
|
+
spec.summary = 'Wrapper for the Billomat API'
|
15
|
+
spec.homepage = 'https://github.com/hausgold/billomat'
|
15
16
|
|
16
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the
|
17
|
-
#
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the
|
18
|
+
# 'allowed_push_host'
|
19
|
+
# to allow pushing to a single host or delete this section to allow pushing
|
20
|
+
# to any host.
|
18
21
|
if spec.respond_to?(:metadata)
|
19
|
-
spec.metadata[
|
22
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
20
23
|
else
|
21
|
-
raise
|
22
|
-
|
24
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
25
|
+
'public gem pushes.'
|
23
26
|
end
|
24
27
|
|
25
|
-
spec.files
|
28
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
29
|
f.match(%r{^(test|spec|features)/})
|
27
30
|
end
|
28
31
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
-
spec.require_paths = [
|
32
|
+
spec.require_paths = ['lib']
|
30
33
|
|
31
34
|
spec.required_ruby_version = '>= 2.0'
|
32
35
|
|
33
36
|
spec.add_dependency 'rest-client', '~> 2.0', '>= 2.0.2'
|
34
37
|
|
35
|
-
spec.add_development_dependency
|
36
|
-
spec.add_development_dependency
|
37
|
-
spec.add_development_dependency
|
38
|
-
spec.add_development_dependency
|
39
|
-
spec.add_development_dependency
|
38
|
+
spec.add_development_dependency 'bundler', '~> 1.15'
|
39
|
+
spec.add_development_dependency 'pry', '~> 0.11'
|
40
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
41
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
42
|
+
spec.add_development_dependency 'simplecov', '~> 0.15'
|
40
43
|
end
|
data/lib/billomat/gateway.rb
CHANGED
@@ -33,18 +33,22 @@ module Billomat
|
|
33
33
|
# Executes the API call
|
34
34
|
# @return [Hash] The response body
|
35
35
|
def run
|
36
|
-
resp =
|
36
|
+
resp = response
|
37
|
+
|
38
|
+
raise GatewayError, resp.body if resp.code > 299
|
39
|
+
return nil if resp.body.empty?
|
40
|
+
|
41
|
+
JSON.parse(resp.body)
|
42
|
+
end
|
43
|
+
|
44
|
+
def response
|
45
|
+
RestClient::Request.execute(
|
37
46
|
method: method,
|
38
47
|
url: url,
|
39
48
|
timeout: timeout,
|
40
49
|
headers: headers,
|
41
50
|
payload: body.to_json
|
42
51
|
)
|
43
|
-
|
44
|
-
raise GatewayError, resp.body if resp.code > 299
|
45
|
-
return nil if resp.body.empty?
|
46
|
-
|
47
|
-
JSON.parse(resp.body)
|
48
52
|
end
|
49
53
|
|
50
54
|
# @return [String] The complete URL for the request
|
@@ -62,11 +66,15 @@ module Billomat
|
|
62
66
|
{
|
63
67
|
'Accept' => 'application/json',
|
64
68
|
'Content-Type' => 'application/json',
|
65
|
-
'X-BillomatApiKey' => config.api_key
|
66
|
-
|
69
|
+
'X-BillomatApiKey' => config.api_key,
|
70
|
+
'X-AppId' => config.app_id,
|
71
|
+
'X-AppSecret' => config.app_secret
|
72
|
+
}.reject { |_, val| val.nil? }
|
67
73
|
end
|
68
74
|
|
69
75
|
# @return [Billomat::Configuration] The global gem configuration
|
76
|
+
#
|
77
|
+
# :reek:UtilityFunction because it's a shorthand
|
70
78
|
def config
|
71
79
|
Billomat.configuration
|
72
80
|
end
|
data/lib/billomat/models/base.rb
CHANGED
data/lib/billomat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: billomat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Vogt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -45,61 +45,61 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '1.15'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: pry
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '0.11'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '0.11'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '10.0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '10.0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: rspec
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0
|
81
|
+
version: '3.0'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0
|
88
|
+
version: '3.0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
90
|
+
name: simplecov
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '0.
|
95
|
+
version: '0.15'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '0.
|
102
|
+
version: '0.15'
|
103
103
|
description:
|
104
104
|
email:
|
105
105
|
- henning.vogt@hausgold.de
|
@@ -107,8 +107,10 @@ executables: []
|
|
107
107
|
extensions: []
|
108
108
|
extra_rdoc_files: []
|
109
109
|
files:
|
110
|
+
- ".editorconfig"
|
110
111
|
- ".gitignore"
|
111
112
|
- ".rspec"
|
113
|
+
- ".simplecov"
|
112
114
|
- ".travis.yml"
|
113
115
|
- Gemfile
|
114
116
|
- LICENSE
|
@@ -159,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
161
|
version: '0'
|
160
162
|
requirements: []
|
161
163
|
rubyforge_project:
|
162
|
-
rubygems_version: 2.6
|
164
|
+
rubygems_version: 2.7.6
|
163
165
|
signing_key:
|
164
166
|
specification_version: 4
|
165
167
|
summary: Wrapper for the Billomat API
|