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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4035f9775d94fcc611e6f13b76f7a58f64d743f
4
- data.tar.gz: 4ce16c21c77d7147eb885ce1e69c9894d5101f59
3
+ metadata.gz: 6e56d8cd8858a9bc32a6b582a8127c7ef0d8f8ed
4
+ data.tar.gz: e5de0207e53a646183c8fc8e120b70eff11244b0
5
5
  SHA512:
6
- metadata.gz: fb280c4d2999e4969c60dc8d369982199a963bdb186ca4a6f483e0e98a24af9235f632a5c32f71dc1fe1b94f75fe7708648912f03dc7ae67a84035bc73c795fb
7
- data.tar.gz: b21246f429d9aa0e511a9d3b23ae34658565c704bb757595d5b183a20cf7ad17105f23baf43e066ff2c6494d70b6f1726d7ce992708a54d0c1b3d15beed2d102
6
+ metadata.gz: b265a3f2c9b3798938afd4cc2096a0afedeaaf6b9204f5505d0828fc2f254548ac0e89e02d010233416ce06649f29ec8cb177f52bf5c099291084f406103a7e7
7
+ data.tar.gz: 265be8f57288f9c614d8c83a49bec665135a5ef7ae753342a21eeef58e65eeea1e60bcce01f88ecf14bbc290608fabc570930fb57c43de8fc7b7731b97127e2b
@@ -1,3 +1,4 @@
1
1
  module SocialHubHttpUtility
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.14"
3
3
  end
4
+
@@ -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.6
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-08-23 00:00:00.000000000 Z
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.6.12
152
+ rubygems_version: 2.5.1
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: httpUtility