elmas 2.6.0 → 3.0.0
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 +5 -5
- data/.ruby-version +1 -1
- data/Changelog.md +4 -0
- data/LICENSE +1 -1
- data/README.md +2 -44
- data/lib/elmas/oauth.rb +7 -0
- data/lib/elmas/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9bf17c014442114f64d14b2cc50b88279eba0b6249c7b08f5d9e7611cce0f078
|
4
|
+
data.tar.gz: 526d26398ef1c5fdfdbdd6f7430ae37d0530ef01d09cbfb78365ac44f2945120
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3854963c10a80a9ee649363f8b4530266a2befad8994557060f07385fad0fba45823380eb74c33386a03985f08327df9869b6e503ed3fe16e803e0a770583fc6
|
7
|
+
data.tar.gz: bf11fdb4d48fc87e9a5eb406fc7dd0befe11280d6270df113bd87e69d5edc492703176bbf8cc39c6e5acd9fcce4fc25c7d8500e33fca14cb96196f4b0a54bd8b
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.1
|
data/Changelog.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 3.0.0
|
2
|
+
- Deprecating auto authorize due to changes to login flow by Exact. https://support.exactonline.com/community/s/knowledge-base#All-All-HNO-Concept-general-security-gen-auth-totpc
|
3
|
+
- Upgrade Ruby Version.
|
4
|
+
|
1
5
|
## 2.6.0
|
2
6
|
- Add main atttribute to bank account (thanks @Korstiaan)
|
3
7
|
- Add address object (thanks @chicks)
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
# Elmas
|
7
7
|
|
8
|
-
Elmas means diamond, but in this case it's an API wrapper for [Exact Online](https://developers.exactonline.com/). This gem was created by [@Marthyn](https://github.com/marthyn), [Hoppinger](http://www.hoppinger.com) and a few people
|
8
|
+
Elmas means diamond, but in this case it's an API wrapper for [Exact Online](https://developers.exactonline.com/). This gem was created by [@Marthyn](https://github.com/marthyn), [Hoppinger](http://www.hoppinger.com) and a few people.
|
9
9
|
|
10
10
|
# DISCLAIMER
|
11
11
|
|
12
|
-
|
12
|
+
__As of 25th of May, 2FA will be mandatory for all Exact Online accounts. Therefor the auto authorize method with which you could simulate and App 2 App connection will not work anymore. Hoppinger is working on a new solution. The methods will stay available but probably won't work and will show a deprecation warning. [Read more about it here](https://support.exactonline.com/community/s/knowledge-base#All-All-HNO-Concept-general-security-gen-auth-totpc)__
|
13
13
|
|
14
14
|
### Contributers
|
15
15
|
|
@@ -59,48 +59,6 @@ Elmas.configure do |config|
|
|
59
59
|
end
|
60
60
|
```
|
61
61
|
|
62
|
-
If you only use the api within your app without exposing it to users you can chose
|
63
|
-
to automatically login with your credentials. So this is for example when you have a
|
64
|
-
rake task that shoots in invoices.
|
65
|
-
Do not use this when you let other users login. Build your own OAUTH flow and then set the access token
|
66
|
-
before the api request.
|
67
|
-
```ruby
|
68
|
-
Elmas.configure do |config|
|
69
|
-
config.access_token = Elmas.authorize(ENV['EXACT_USER_NAME'], ENV['EXACT_PASSWORD']).access_token
|
70
|
-
end
|
71
|
-
```
|
72
|
-
Now you're authorized you can set your current division
|
73
|
-
```ruby
|
74
|
-
Elmas.configure do |config|
|
75
|
-
config.division = Elmas.authorize_division
|
76
|
-
end
|
77
|
-
```
|
78
|
-
|
79
|
-
So combining all of this results in
|
80
|
-
```ruby
|
81
|
-
Elmas.configure do |config|
|
82
|
-
config.client_id = ENV['CLIENT_ID']
|
83
|
-
config.client_secret = ENV['CLIENT_SECRET']
|
84
|
-
config.redirect_uri = ENV['REDIRECT_URI']
|
85
|
-
config.access_token = Elmas.authorize(ENV['EXACT_USER_NAME'], ENV['EXACT_PASSWORD']).access_token
|
86
|
-
config.division = Elmas.authorize_division
|
87
|
-
end
|
88
|
-
```
|
89
|
-
|
90
|
-
You should make sure that when you do a request you're authorized. So build in something like the
|
91
|
-
following code into your application, that checks wether you're authorized and otherwise authorizes
|
92
|
-
again.
|
93
|
-
```ruby
|
94
|
-
#The client will now be authorized for 10 minutes,
|
95
|
-
# if there are requests the time will be reset,
|
96
|
-
# otherwise authorization should be called again.
|
97
|
-
unless Elmas.authorized?
|
98
|
-
Elmas.configure do |config|
|
99
|
-
config.access_token = Elmas.authorize(ENV['EXACT_USER_NAME'], ENV['EXACT_PASSWORD']).access_token
|
100
|
-
end
|
101
|
-
end
|
102
|
-
```
|
103
|
-
|
104
62
|
### Logger
|
105
63
|
|
106
64
|
The default logger is STDOUT. A custom logger can be be configured.
|
data/lib/elmas/oauth.rb
CHANGED
@@ -8,10 +8,15 @@ require File.expand_path("../utils", __FILE__)
|
|
8
8
|
require File.expand_path("../response", __FILE__)
|
9
9
|
|
10
10
|
# from https://developers.exactonline.com/#Example retrieve access token.html
|
11
|
+
|
12
|
+
# This whole class is going to be replaced due to Exact Online's new policies.
|
13
|
+
# https://support.exactonline.com/community/s/knowledge-base#All-All-HNO-Concept-general-security-gen-auth-totpc
|
14
|
+
|
11
15
|
module Elmas
|
12
16
|
# rubocop:disable Metrics/ModuleLength
|
13
17
|
module OAuth
|
14
18
|
def authorize(user_name, password, options = {})
|
19
|
+
warn "[DEPRECATION] `authorize` is deprecated. Please implement your own authorization methods instead."
|
15
20
|
agent = Mechanize.new
|
16
21
|
|
17
22
|
login(agent, user_name, password, options)
|
@@ -22,6 +27,7 @@ module Elmas
|
|
22
27
|
end
|
23
28
|
|
24
29
|
def refresh_authorization
|
30
|
+
warn "[DEPRECATION] `refresh_authorization` is deprecated. Please implement your own authorization methods instead."
|
25
31
|
OauthResponse.new(get_refresh_token(refresh_token)).tap do |response|
|
26
32
|
Elmas.configure do |config|
|
27
33
|
config.access_token = response.access_token
|
@@ -43,6 +49,7 @@ module Elmas
|
|
43
49
|
end
|
44
50
|
|
45
51
|
def auto_authorize
|
52
|
+
warn "[DEPRECATION] `auto_authorize` is deprecated. Please implement your own authorization methods instead."
|
46
53
|
Elmas.configure do |config|
|
47
54
|
config.redirect_uri = ENV["REDIRECT_URI"]
|
48
55
|
config.client_id = ENV["CLIENT_ID"]
|
data/lib/elmas/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elmas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marthyn
|
@@ -350,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
350
350
|
version: '0'
|
351
351
|
requirements: []
|
352
352
|
rubyforge_project:
|
353
|
-
rubygems_version: 2.
|
353
|
+
rubygems_version: 2.7.6
|
354
354
|
signing_key:
|
355
355
|
specification_version: 4
|
356
356
|
summary: API wrapper for Exact Online
|