fortnox-api 0.6.2 → 0.6.3
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 +4 -4
- data/.travis.yml +18 -18
- data/fortnox-api.gemspec +1 -1
- data/lib/fortnox/api/mappers/base/from_json.rb +5 -0
- data/lib/fortnox/api/types/sized.rb +16 -3
- data/lib/fortnox/api/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0367007a797c6a5e054927933fb9e4cb9e897b1
|
4
|
+
data.tar.gz: 280be6192fd9f9d9678b02c18f84d1da45dcb969
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55041f7e183aa01f3757feaf79135bd415665983f5475186a41cf2199dbf8be2933f4fe1a705b6d839eb60883a9f1a4aa2777c19324bcc7b41a654a64a5d3599
|
7
|
+
data.tar.gz: a1e060065d65878d653dcd34f7b78dfff30ef341617e05653853a7af5f524a4e3261be7c03708e7c8ebad182bffcdcf17ecb48214e6ded8033d8fd2acdc5eb69
|
data/.travis.yml
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
env:
|
2
2
|
global:
|
3
|
-
|
3
|
+
- CC_TEST_REPORTER_ID=397c19af63ca3467cff6fd640b0460b691f687118332b5989f530d28f82adcb8
|
4
4
|
language: ruby
|
5
5
|
rvm:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
6
|
+
- 2.3.0
|
7
|
+
- 2.3.1
|
8
|
+
- 2.3.2
|
9
|
+
- 2.3.3
|
10
|
+
- 2.3.4
|
11
|
+
- 2.3.5
|
12
|
+
- 2.3.6
|
13
|
+
- 2.4.0
|
14
|
+
- 2.4.1
|
15
|
+
- 2.4.2
|
16
|
+
- 2.4.3
|
17
|
+
- 2.5.0
|
18
18
|
addons:
|
19
19
|
code_climate:
|
20
20
|
repo_token: 397c19af63ca3467cff6fd640b0460b691f687118332b5989f530d28f82adcb8
|
@@ -22,10 +22,10 @@ notifications:
|
|
22
22
|
slack: my-codeworks:fwKO4YfipnmNKJQL3cRSEoKB
|
23
23
|
email: false
|
24
24
|
before_script:
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
26
|
+
- chmod +x ./cc-test-reporter
|
27
|
+
- ./cc-test-reporter before-build
|
28
28
|
script:
|
29
|
-
|
29
|
+
- bundle exec rspec
|
30
30
|
after_script:
|
31
|
-
|
31
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/fortnox-api.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
|
25
25
|
|
26
26
|
spec.required_ruby_version = '>= 2.3'
|
27
27
|
spec.add_dependency 'dry-struct', '~> 0.1'
|
28
|
-
spec.add_dependency 'dry-types', '~> 0.8'
|
28
|
+
spec.add_dependency 'dry-types', '~> 0.8', '< 0.13.0'
|
29
29
|
# TODO: Temporary lockdown. See issue #103 for more info.
|
30
30
|
spec.add_dependency 'httparty', '~> 0.14.0'
|
31
31
|
|
@@ -73,12 +73,17 @@ module Fortnox
|
|
73
73
|
def default_key_from_json_transform(key)
|
74
74
|
key = key.to_s
|
75
75
|
key = camelcase_to_underscore(key) unless key =~ /\A[A-Z]+\z/
|
76
|
+
key = strip_at_symbol(key) if key =~ /\A@.*\z/
|
76
77
|
key.downcase.to_sym
|
77
78
|
end
|
78
79
|
|
79
80
|
def camelcase_to_underscore(key)
|
80
81
|
key.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z])([A-Z])/, '\1_\2')
|
81
82
|
end
|
83
|
+
|
84
|
+
def strip_at_symbol(key)
|
85
|
+
key.gsub(/\A@/, '')
|
86
|
+
end
|
82
87
|
end
|
83
88
|
end
|
84
89
|
end
|
@@ -21,9 +21,22 @@ module Fortnox
|
|
21
21
|
end
|
22
22
|
|
23
23
|
module Float
|
24
|
-
def self.[](low, high)
|
25
|
-
|
26
|
-
|
24
|
+
def self.[](low = nil, high = nil, from: nil, to: nil, range: nil)
|
25
|
+
if !from.nil? && !to.nil?
|
26
|
+
# Legacy
|
27
|
+
Types::Strict::Float.constrained(gteq: low, lteq: high).optional.constructor do |value|
|
28
|
+
value.to_f unless value.nil?
|
29
|
+
end
|
30
|
+
elsif range
|
31
|
+
# Legacy
|
32
|
+
Types::Strict::Float.constrained(gteq: low, lteq: high).optional.constructor do |value|
|
33
|
+
value.to_f unless value.nil?
|
34
|
+
end
|
35
|
+
else
|
36
|
+
# Legacy
|
37
|
+
Types::Strict::Float.constrained(gteq: low, lteq: high).optional.constructor do |value|
|
38
|
+
value.to_f unless value.nil?
|
39
|
+
end
|
27
40
|
end
|
28
41
|
end
|
29
42
|
end
|
data/lib/fortnox/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fortnox-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Schubert Erlandsson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-06-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: dry-struct
|
@@ -33,6 +33,9 @@ dependencies:
|
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: '0.8'
|
36
|
+
- - "<"
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 0.13.0
|
36
39
|
type: :runtime
|
37
40
|
prerelease: false
|
38
41
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -40,6 +43,9 @@ dependencies:
|
|
40
43
|
- - "~>"
|
41
44
|
- !ruby/object:Gem::Version
|
42
45
|
version: '0.8'
|
46
|
+
- - "<"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.13.0
|
43
49
|
- !ruby/object:Gem::Dependency
|
44
50
|
name: httparty
|
45
51
|
requirement: !ruby/object:Gem::Requirement
|