visma_eaccounting 0.0.3 → 0.0.4

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: 7856b9f01600c672d20af36217c68ac8f9fe49abef0d50793da416ee0f190e2a
4
- data.tar.gz: 29ea3651d6d89bea0c422174c1e5151debf4d5a79837d5455c9380040b2fd42e
3
+ metadata.gz: 31c31a3c27db5787ba5cfff55ec685352ed73041421a4bc5b3b61e04de4ab260
4
+ data.tar.gz: 0a7c285b1d3fd8ccc171144dfeb07ed5a98828e35ebf2cb4fa3f3f225b1c8fc2
5
5
  SHA512:
6
- metadata.gz: 007fdcfc59f0e12b3d3f287f8becbfa683fddb63971cff508d792b7dcce4f25ae197b3510cdbac8af29a748d5db7fe1a001d8db9069597ddbf63bc0d1db09800
7
- data.tar.gz: f16b78b08b8c1645d6c6c45090c62a5338b1cf9addfdc914af580e442003996c7f959f77342b4b65a479928d05e2975a7b6e1ecdb818e9c909594c6652909d5e
6
+ metadata.gz: 54cf027c04471b559c245b293c97a6b045709dc2d7f2aa1a5aaa8cea708c434a17cb2822abd734e50a3c0744d99f9adae32aec04030ae5329adcfff4c2782d0a
7
+ data.tar.gz: 6da38f9abf1c80231b9f76179a7dcc56be30ea69a63d259788539eea6963488a221b5fdfba5d7a444fe638cb13ec92b8595a856cf77461a2bf24e272099718de
data/Gemfile CHANGED
@@ -1,12 +1,8 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  platforms :rbx do
4
- gem 'rubysl', '~> 2.2.0'
4
+ gem 'rubysl'
5
5
  gem 'rubinius-developer_tools'
6
6
  end
7
7
 
8
- group :development, :test do
9
- gem 'webmock', '~>1.24.0'
10
- end
11
-
12
8
  gemspec
data/README.markdown CHANGED
@@ -1,4 +1,4 @@
1
- # visma_eaccounting
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`, `upsert`, or `delete`) verb initiates the request. `upsert` lets you update a record, if it exists, or insert it otherwise where supported by Visma's API.
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
 
@@ -78,6 +78,14 @@ module VismaEaccounting
78
78
  @request_builder.token
79
79
  end
80
80
 
81
+ def api_environment
82
+ @request_builder.api_environment
83
+ end
84
+
85
+ def api_endpoint
86
+ @request_builder.api_endpoint
87
+ end
88
+
81
89
  def timeout
82
90
  @request_builder.timeout
83
91
  end
@@ -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 || self.class.api_environment || DEFAULT_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
@@ -1,3 +1,3 @@
1
1
  module VismaEaccounting
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -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 corret api url when setting sandbox environment" do
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/")
@@ -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', '>= 0.9.1')
24
- s.add_dependency('multi_json', '>= 1.11.0')
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 "rspec", "3.5.0"
28
- s.add_development_dependency 'webmock', '~> 1.21.0'
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.3
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: 2017-12-11 00:00:00.000000000 Z
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.9.1
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.9.1
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: 1.11.0
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: 1.11.0
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: 3.5.0
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: 3.5.0
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: 1.21.0
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: 1.21.0
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
- rubyforge_project: visma_eaccounting
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