osc_ruby 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 +4 -4
- data/lib/osc_ruby/client.rb +22 -1
- data/lib/osc_ruby/configuration.rb +4 -0
- data/lib/osc_ruby/version.rb +1 -1
- data/osc_ruby-0.0.3.gem +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b8d71f6076e1f7227e4677c44199d028aacec67
|
4
|
+
data.tar.gz: 1c8bab16bfce033bfa3610552fd6acfd0b52c965
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d45bd2c316d5f62078017f02f60e8bc4426c7d7ce7561a7579c7ba87b15b06f2679dd985a34cc3bbd18f47140cb48013fd172796c86bd0c203b5949b77a1454
|
7
|
+
data.tar.gz: 6de4026da3243b24b46f9174c980d2487ea13529b851356534620e4fbc0267da29dbd9236ed48125958d2e5b8f884e7e61d2f2440fbf0efc9fe131dcef725b13
|
data/lib/osc_ruby/client.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'net/http'
|
2
|
+
require 'openssl'
|
2
3
|
|
3
4
|
require 'osc_ruby/version'
|
4
5
|
require 'osc_ruby/configuration'
|
@@ -7,6 +8,9 @@ module OSCRuby
|
|
7
8
|
|
8
9
|
class Client
|
9
10
|
# The top-level class that handles configuration and connection to the Oracle Service Cloud REST API.
|
11
|
+
|
12
|
+
# @return [Configuration] Config instance
|
13
|
+
attr_reader :config
|
10
14
|
|
11
15
|
def initialize
|
12
16
|
raise ArgumentError, "block not given" unless block_given?
|
@@ -14,6 +18,10 @@ module OSCRuby
|
|
14
18
|
@config = OSCRuby::Configuration.new
|
15
19
|
yield config
|
16
20
|
|
21
|
+
uri = basic_auth(config)
|
22
|
+
|
23
|
+
connect(config,uri)
|
24
|
+
|
17
25
|
end
|
18
26
|
|
19
27
|
def basic_auth(config)
|
@@ -23,6 +31,19 @@ module OSCRuby
|
|
23
31
|
def service_cloud_interface(config)
|
24
32
|
@url = 'https://' + config.interface + '/services/rest/connect/v1.3/'
|
25
33
|
end
|
26
|
-
|
34
|
+
|
35
|
+
def connect(config,uri)
|
36
|
+
Net::HTTP.start(uri.host, uri.port,
|
37
|
+
:use_ssl => uri.scheme == 'https') do |http|
|
38
|
+
|
39
|
+
request = Net::HTTP::Get.new uri.request_uri
|
40
|
+
request.basic_auth config.username, config.password
|
41
|
+
|
42
|
+
response = http.request request # Net::HTTPResponse object
|
43
|
+
|
44
|
+
puts response
|
45
|
+
puts response.body
|
46
|
+
end
|
47
|
+
end
|
27
48
|
end
|
28
49
|
end
|
data/lib/osc_ruby/version.rb
CHANGED
data/osc_ruby-0.0.3.gem
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osc_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajan Davis
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- lib/osc_ruby/client.rb
|
71
71
|
- lib/osc_ruby/configuration.rb
|
72
72
|
- lib/osc_ruby/version.rb
|
73
|
+
- osc_ruby-0.0.3.gem
|
73
74
|
- osc_ruby.gemspec
|
74
75
|
- spec/core/client_spec.rb
|
75
76
|
- spec/core/configuration_spec.rb
|