connect_wise_rest 0.4.1 → 0.5.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/connect_wise_rest.gemspec +1 -1
- data/lib/connect_wise_rest.rb +1 -0
- data/lib/connect_wise_rest/client.rb +20 -16
- data/lib/connect_wise_rest/error.rb +3 -0
- data/lib/connect_wise_rest/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2f0f3fdbdbb40bd8b9f825cb46e4f85d10f5b9270868ff6018b7dd67b858c069
|
4
|
+
data.tar.gz: 805b98ddfdd17433f63442695149c6469d2d60070e59eba04c0a1e3242057d65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d85b164ff6e0910205f1118784efb2bf8773ac2c4425e8422e6c6be84dc4760a9a3116173cb8dcedbc6885f17c42b31899d779b3ac2c1318cfd5258c1f157046
|
7
|
+
data.tar.gz: f128174486933efba430c623e52d2d7967073118dc2ff34bdaf813501561b9032fb8a031c7e0f819a8bccc20ff75de74753db0ae4fa25740342dda83c1a262d2
|
data/connect_wise_rest.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = 'connect_wise_rest'
|
8
8
|
spec.version = ConnectWiseRest::VERSION
|
9
9
|
spec.authors = ['Kevin Pheasey']
|
10
|
-
spec.email = ['kevin@
|
10
|
+
spec.email = ['kevin@kpsoftware.io']
|
11
11
|
|
12
12
|
spec.summary = %q{REST client wrapper for Connect Wise.}
|
13
13
|
spec.description = %q{A dead simple REST client wrapper for Connect Wise.}
|
data/lib/connect_wise_rest.rb
CHANGED
@@ -5,10 +5,10 @@ module ConnectWiseRest
|
|
5
5
|
attr_reader :resource
|
6
6
|
|
7
7
|
DEFAULT_OPTIONS = ConnectWiseRest.configuration.to_hash.merge(
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
{
|
9
|
+
timeout: 300,
|
10
|
+
query: { 'page' => 1, 'pageSize' => 75 }
|
11
|
+
}
|
12
12
|
)
|
13
13
|
|
14
14
|
def initialize(resource, options = {})
|
@@ -31,17 +31,19 @@ module ConnectWiseRest
|
|
31
31
|
|
32
32
|
def response
|
33
33
|
@response ||= HTTParty.get(url, request_options)
|
34
|
+
rescue StandardError => e
|
35
|
+
raise ConnectionError.new(e.message)
|
34
36
|
end
|
35
37
|
|
36
38
|
def request_options
|
37
39
|
request_options = {
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
headers: { 'Accept' => 'application/json' },
|
41
|
+
query: self.options[:query],
|
42
|
+
timeout: options[:timeout],
|
43
|
+
basic_auth: {
|
44
|
+
username: "#{options[:company_id]}+#{options[:public_key]}",
|
45
|
+
password: options[:private_key]
|
46
|
+
}
|
45
47
|
}
|
46
48
|
|
47
49
|
request_options[:debug_output] = options[:logger] if options[:debug] && options[:logger]
|
@@ -76,11 +78,13 @@ module ConnectWiseRest
|
|
76
78
|
private
|
77
79
|
|
78
80
|
def raise_error(response)
|
79
|
-
if response.parsed_response
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
msg = if response.parsed_response
|
82
|
+
"#{response.parsed_response['code']}: #{response.parsed_response['message']}"
|
83
|
+
else
|
84
|
+
response.body
|
85
|
+
end
|
86
|
+
|
87
|
+
raise ConnectionError.new(msg)
|
84
88
|
end
|
85
89
|
end
|
86
90
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: connect_wise_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Pheasey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0.13'
|
55
55
|
description: A dead simple REST client wrapper for Connect Wise.
|
56
56
|
email:
|
57
|
-
- kevin@
|
57
|
+
- kevin@kpsoftware.io
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- lib/connect_wise_rest.rb
|
72
72
|
- lib/connect_wise_rest/client.rb
|
73
73
|
- lib/connect_wise_rest/configuration.rb
|
74
|
+
- lib/connect_wise_rest/error.rb
|
74
75
|
- lib/connect_wise_rest/report.rb
|
75
76
|
- lib/connect_wise_rest/version.rb
|
76
77
|
homepage: https://github.com/MSPCFO/connect_wise_rest
|
@@ -93,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
94
|
version: '0'
|
94
95
|
requirements: []
|
95
96
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.7.8
|
97
98
|
signing_key:
|
98
99
|
specification_version: 4
|
99
100
|
summary: REST client wrapper for Connect Wise.
|