visma_eaccounting 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -5
- data/README.markdown +5 -4
- data/lib/visma_eaccounting/api_request.rb +8 -0
- data/lib/visma_eaccounting/request.rb +1 -1
- data/lib/visma_eaccounting/version.rb +1 -1
- data/spec/visma_eaccounting/api_request_spec.rb +1 -1
- data/spec/visma_eaccounting/visma_eaccounting_spec.rb +1 -1
- data/visma_eaccounting.gemspec +4 -4
- metadata +15 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31c31a3c27db5787ba5cfff55ec685352ed73041421a4bc5b3b61e04de4ab260
|
4
|
+
data.tar.gz: 0a7c285b1d3fd8ccc171144dfeb07ed5a98828e35ebf2cb4fa3f3f225b1c8fc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54cf027c04471b559c245b293c97a6b045709dc2d7f2aa1a5aaa8cea708c434a17cb2822abd734e50a3c0744d99f9adae32aec04030ae5329adcfff4c2782d0a
|
7
|
+
data.tar.gz: 6da38f9abf1c80231b9f76179a7dcc56be30ea69a63d259788539eea6963488a221b5fdfba5d7a444fe638cb13ec92b8595a856cf77461a2bf24e272099718de
|
data/Gemfile
CHANGED
data/README.markdown
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Visma eAccounting Ruby API Wrapper
|
2
2
|
|
3
3
|
VismaEaccounting is an API wrapper for the Visma eAccounting [API](https://developer.vismaonline.com/).
|
4
4
|
|
@@ -36,7 +36,7 @@ visma_eaccounting.open_timeout = 30
|
|
36
36
|
You can read about `timeout` and `open_timeout` in the [Net::HTTP](https://ruby-doc.org/stdlib-2.3.3/libdoc/net/http/rdoc/Net/HTTP.html) doc.
|
37
37
|
|
38
38
|
Now you can make requests using the resources defined in [the Visma eAccounting's docs](https://developer.vismaonline.com/#APIReference). Resource IDs
|
39
|
-
are specified inline and a `CRUD` (`create`, `retrieve`, `update`,
|
39
|
+
are specified inline and a `CRUD` (`create`, `retrieve`, `update`, or `delete`) verb initiates the request.
|
40
40
|
|
41
41
|
You can specify `headers`, `params`, and `body` when calling a `CRUD` method. For example:
|
42
42
|
|
@@ -46,10 +46,11 @@ visma_eaccounting.customers.retrieve(headers: {"SomeHeader": "SomeHeaderValue"},
|
|
46
46
|
|
47
47
|
Of course, `body` is only supported on `create` and `update` calls. Those map to HTTP `POST` and `PUT` verbs respectively.
|
48
48
|
|
49
|
-
You can set `token`, `timeout`, `open_timeout`, `faraday_adapter`, `proxy`, `symbolize_keys`, `logger`, and `debug` globally:
|
49
|
+
You can set `token`, `api_environment`, `api_endpoint`, `timeout`, `open_timeout`, `faraday_adapter`, `proxy`, `symbolize_keys`, `logger`, and `debug` globally:
|
50
50
|
|
51
51
|
```ruby
|
52
52
|
VismaEaccounting::Request.token = "your_token"
|
53
|
+
VismaEaccounting::Request.api_environment = :sandbox
|
53
54
|
VismaEaccounting::Request.timeout = 15
|
54
55
|
VismaEaccounting::Request.open_timeout = 15
|
55
56
|
VismaEaccounting::Request.symbolize_keys = true
|
@@ -76,7 +77,7 @@ Visma's [API documentation](https://developer.vismaonline.com/#APIReference) is
|
|
76
77
|
|
77
78
|
## Environments
|
78
79
|
|
79
|
-
The default environment is ```:production```. To use the sandbox environment you can set ```:sandbox``` in constructor or globally. This will set the default ```api_endpoint``` URL.
|
80
|
+
The default environment is ```:production```. To use the sandbox environment you can set ```:sandbox``` in constructor or globally using the ```api_environment``` option. This will set the default ```api_endpoint``` URL.
|
80
81
|
|
81
82
|
## Debug Logging
|
82
83
|
|
@@ -10,7 +10,7 @@ module VismaEaccounting
|
|
10
10
|
@path_parts = []
|
11
11
|
@token = token || self.class.token
|
12
12
|
@token = @token.strip if @token
|
13
|
-
@api_environment = api_environment ||
|
13
|
+
@api_environment = api_environment || self.class.api_environment || DEFAULT_API_ENVIRONMENT
|
14
14
|
@api_endpoint = api_endpoint || self.class.api_endpoint
|
15
15
|
@timeout = timeout || self.class.timeout || DEFAULT_TIMEOUT
|
16
16
|
@open_timeout = open_timeout || self.class.open_timeout || DEFAULT_OPEN_TIMEOUT
|
@@ -6,7 +6,7 @@ describe VismaEaccounting::APIRequest do
|
|
6
6
|
|
7
7
|
before do
|
8
8
|
@visma_eaccounting = VismaEaccounting::Request.new(token: token)
|
9
|
-
@api_root = "https://eaccountingapi.vismaonline.com/v2
|
9
|
+
@api_root = "https://eaccountingapi.vismaonline.com/v2"
|
10
10
|
end
|
11
11
|
|
12
12
|
it "surfaces client request exceptions as a VismaEaccounting::APIError" do
|
@@ -139,7 +139,7 @@ describe VismaEaccounting do
|
|
139
139
|
expect(@request.send(:base_api_url)).to eq("https://eaccountingapi.vismaonline.com/v2/")
|
140
140
|
end
|
141
141
|
|
142
|
-
it "has
|
142
|
+
it "has correct api url when setting sandbox environment" do
|
143
143
|
@visma_eaccounting = VismaEaccounting::Request.new(api_environment: :sandbox)
|
144
144
|
@request = VismaEaccounting::APIRequest.new(builder: @visma_eaccounting)
|
145
145
|
expect(@request.send(:base_api_url)).to eq("https://eaccountingapi-sandbox.test.vismaonline.com/v2/")
|
data/visma_eaccounting.gemspec
CHANGED
@@ -20,11 +20,11 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
s.required_ruby_version = '>= 2.0.0'
|
22
22
|
|
23
|
-
s.add_dependency('faraday'
|
24
|
-
s.add_dependency('multi_json'
|
23
|
+
s.add_dependency('faraday')
|
24
|
+
s.add_dependency('multi_json')
|
25
25
|
|
26
26
|
s.add_development_dependency 'rake'
|
27
|
-
s.add_development_dependency
|
28
|
-
s.add_development_dependency 'webmock'
|
27
|
+
s.add_development_dependency 'rspec'
|
28
|
+
s.add_development_dependency 'webmock'
|
29
29
|
|
30
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: visma_eaccounting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Espen Antonsen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-02-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -17,28 +17,28 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0
|
20
|
+
version: '0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0
|
27
|
+
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: multi_json
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -57,30 +57,30 @@ dependencies:
|
|
57
57
|
name: rspec
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: webmock
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - "
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - "
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: '0'
|
84
84
|
description: A wrapper for Visma eAccounting API 2.0
|
85
85
|
email:
|
86
86
|
executables: []
|
@@ -126,8 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: '0'
|
128
128
|
requirements: []
|
129
|
-
|
130
|
-
rubygems_version: 2.7.3
|
129
|
+
rubygems_version: 3.0.2
|
131
130
|
signing_key:
|
132
131
|
specification_version: 4
|
133
132
|
summary: A wrapper for Visma eAccounting API 2.0
|