socialHub_httpUtility 1.0.6 → 1.0.14
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/socialHub_httpUtility/version.rb +2 -1
- data/lib/socialHub_httpUtility.rb +31 -3
- data/socialHub_httpUtility.gemspec +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e56d8cd8858a9bc32a6b582a8127c7ef0d8f8ed
|
4
|
+
data.tar.gz: e5de0207e53a646183c8fc8e120b70eff11244b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b265a3f2c9b3798938afd4cc2096a0afedeaaf6b9204f5505d0828fc2f254548ac0e89e02d010233416ce06649f29ec8cb177f52bf5c099291084f406103a7e7
|
7
|
+
data.tar.gz: 265be8f57288f9c614d8c83a49bec665135a5ef7ae753342a21eeef58e65eeea1e60bcce01f88ecf14bbc290608fabc570930fb57c43de8fc7b7731b97127e2b
|
@@ -1,20 +1,44 @@
|
|
1
1
|
require "socialHub_httpUtility/version"
|
2
|
+
require "socialHub_httpUtility/configuration"
|
2
3
|
|
3
4
|
module SocialHubHttpUtility
|
5
|
+
|
6
|
+
class << self
|
7
|
+
attr_accessor :configuration
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.configuration
|
11
|
+
@configuration ||= Configuration.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.reset
|
15
|
+
@configuration = Configuration.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.configure
|
19
|
+
yield(configuration)
|
20
|
+
end
|
4
21
|
|
5
22
|
def self.get_http_request(domain, path, params, headers, distination_service)
|
23
|
+
|
24
|
+
if(configuration.service_name)
|
25
|
+
puts "service name from the ruby gem is"
|
26
|
+
puts configuration.service_name
|
27
|
+
end
|
28
|
+
|
6
29
|
url = domain+path
|
7
30
|
http_end_index = url.index(':')
|
8
31
|
http_type = url[0 , http_end_index]
|
9
|
-
puts "http Type ",http_type
|
10
32
|
uri = URI.parse(url)
|
11
33
|
uri.query = URI.encode_www_form( params)
|
12
34
|
http = Net::HTTP.new(uri.host, uri.port)
|
13
35
|
http.use_ssl = (http_type == 'https')
|
14
36
|
request = Net::HTTP::Get.new(uri.request_uri)
|
37
|
+
|
15
38
|
headers.each do |key,value|
|
16
39
|
request.add_field(key, value)
|
17
40
|
end
|
41
|
+
|
18
42
|
if(!headers.key?("request-id"))
|
19
43
|
request.add_field("request-id",SecureRandom.uuid)
|
20
44
|
end
|
@@ -29,7 +53,6 @@ module SocialHubHttpUtility
|
|
29
53
|
metadata = {}
|
30
54
|
begin
|
31
55
|
res = http.request(request)
|
32
|
-
puts "resppppponse body" , res.body
|
33
56
|
case res
|
34
57
|
when Net::HTTPSuccess then
|
35
58
|
metadata["statusCode"] = 1
|
@@ -75,6 +98,12 @@ module SocialHubHttpUtility
|
|
75
98
|
end
|
76
99
|
|
77
100
|
def self.post_http_request(domain, path, params, headers, distination_service)
|
101
|
+
|
102
|
+
if(configuration.service_name)
|
103
|
+
puts "service name from the ruby gem is"
|
104
|
+
puts configuration.service_name
|
105
|
+
end
|
106
|
+
|
78
107
|
url = domain+path
|
79
108
|
http_end_index = url.index(':')
|
80
109
|
http_type = url[0 , http_end_index]
|
@@ -95,7 +124,6 @@ module SocialHubHttpUtility
|
|
95
124
|
metadata = {}
|
96
125
|
begin
|
97
126
|
res = http.post(uri.path, post_data, headers)
|
98
|
-
puts "resppppponse body" , res.body
|
99
127
|
case res
|
100
128
|
when Net::HTTPSuccess then
|
101
129
|
metadata["statusCode"] = 1
|
@@ -3,6 +3,7 @@ lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require 'socialHub_httpUtility/version'
|
5
5
|
|
6
|
+
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = "socialHub_httpUtility"
|
8
9
|
spec.version = SocialHubHttpUtility::VERSION
|
@@ -17,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
17
18
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
19
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
20
|
|
20
|
-
|
21
|
+
spec.files = ["lib/socialHub_httpUtility" , "lib/socialHub_httpUtility/configuration"]
|
21
22
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
22
23
|
f.match(%r{^(test|spec|features)/})
|
23
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socialHub_httpUtility
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AbdAllah Elabasery
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
151
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.
|
152
|
+
rubygems_version: 2.5.1
|
153
153
|
signing_key:
|
154
154
|
specification_version: 4
|
155
155
|
summary: httpUtility
|