osc_ruby 0.0.11 → 0.0.12
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/lib/osc_ruby/connect.rb +7 -1
- data/lib/osc_ruby/version.rb +1 -1
- data/spec/core/connect_spec.rb +21 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c7dd0579b731eb4a3d8ce7fbaac6a305a202e00
|
4
|
+
data.tar.gz: 545781e8fca36fa6824b5ad2857387ed4239a1a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 057334b04a1f44cec42354b230da28f9f2e826a61d20aaf657ee60789ab7046ef7f1c7a43f3020c80796448e24380a192aa823b85374a3a281a57e2865c9fea0
|
7
|
+
data.tar.gz: 45b2fefa8a5581fa216458bc965de4d270488c8c73e578d55b1653395c8ed8b99e3d33495b17dd60e4190e132e9ab8533b0231608f1c318dc152600f59891584
|
data/lib/osc_ruby/connect.rb
CHANGED
@@ -13,8 +13,10 @@ module OSCRuby
|
|
13
13
|
|
14
14
|
if client.nil?
|
15
15
|
raise ArgumentError, "Client must have some configuration set; please create an instance of OSCRuby::Client with configuration settings"
|
16
|
+
elsif !resource_url.nil?
|
17
|
+
@final_config = generate_url_and_config(client,resource_url)
|
16
18
|
else
|
17
|
-
@final_config = generate_url_and_config(client)
|
19
|
+
@final_config = generate_url_and_config(client,nil)
|
18
20
|
end
|
19
21
|
|
20
22
|
@uri = @final_config['site_url']
|
@@ -40,6 +42,10 @@ module OSCRuby
|
|
40
42
|
|
41
43
|
@config = client.config
|
42
44
|
|
45
|
+
if !resource_url.nil?
|
46
|
+
@resource_url = resource_url
|
47
|
+
end
|
48
|
+
|
43
49
|
@url = "https://" + @config.interface + ".custhelp.com/services/rest/connect/v1.3/#{resource_url}"
|
44
50
|
|
45
51
|
@final_uri = URI(@url)
|
data/lib/osc_ruby/version.rb
CHANGED
data/spec/core/connect_spec.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'core/spec_helper'
|
2
2
|
require 'json'
|
3
|
+
require 'uri'
|
3
4
|
|
4
5
|
describe OSCRuby::Connect do
|
5
6
|
|
@@ -31,6 +32,26 @@ describe OSCRuby::Connect do
|
|
31
32
|
end.not_to raise_error
|
32
33
|
end
|
33
34
|
|
35
|
+
it 'should take an optional resource_url parameter' do
|
36
|
+
|
37
|
+
expect do
|
38
|
+
|
39
|
+
OSCRuby::Connect.generate_url_and_config(client, 'accounts')
|
40
|
+
|
41
|
+
end.not_to raise_error
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should change the final configured url if the resource_url parameter is specified' do
|
45
|
+
|
46
|
+
test = OSCRuby::Connect.generate_url_and_config(client, 'accounts')
|
47
|
+
|
48
|
+
interface = client.config.interface
|
49
|
+
|
50
|
+
expect(test['site_url']).to eq(URI("https://#{interface}.custhelp.com/services/rest/connect/v1.3/accounts"))
|
51
|
+
|
52
|
+
expect(test['site_url']).to be_an(URI::HTTPS)
|
53
|
+
end
|
54
|
+
|
34
55
|
it 'should raise an error if client is nil' do
|
35
56
|
|
36
57
|
expect do
|