outreach_gem 1.0.37 → 1.0.46

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
  SHA256:
3
- metadata.gz: 0adfa6265cb32513f8145f00db9446dbe4d27522a1e40514eb7e36d408834434
4
- data.tar.gz: e99b5322e266b594cf4937204798e05795684aa2f2e489a01cf52a01e2272243
3
+ metadata.gz: e11f82793f407e9bb46d76302832203a30e7380104b757bf579fa46e486d3952
4
+ data.tar.gz: c3d7aca57c254fd66027ffc6c567fd559e862df9643977d9591520b932614870
5
5
  SHA512:
6
- metadata.gz: f4a2170f0fb0ff51c2ef81f363d88ec316d9a29f7123799f657e8f8206d275bf8be6d7a6aa8a836ead80bd436978046127147993dcbd2cc3fb74b035ab7ff294
7
- data.tar.gz: d3f245f548a27362e91eb5de8b8d41bbfa83466c6e6e172122395e2878bca61124e6160aaac0f5672fdc633b5a014c8016691771b5adfa40932946aae6279f86
6
+ metadata.gz: 1ad71aac9d4f6de54ce180454c58684453c050270e97655edce4ff48ae758e6e628f64a490904f2b1e59e0e7f1480907a8e3d7c687acc48a06a93f87575f400f
7
+ data.tar.gz: 3c8ddfa553e8a9dd0502c29597c4dafd2200c5aa2089ebee40adac7b6b501a280f63bab42325c0ffb92d1393da6f27eb277dc4fd13c3c843912af3e6e68613b6
@@ -1,10 +1,19 @@
1
1
  class Helpers
2
2
 
3
+ # Used to retrieve the last character of a string
4
+ # @param string [String] The string that is used to retrieve the last character
5
+ # @return [String] The last character of the string
6
+ # @raise [TypeError] if the string is of the wrong type
3
7
  def self.getLastCharacter(string)
4
8
  raise TypeError unless string.is_a? String
5
9
  return string[-1]
6
10
  end
7
11
 
12
+ # Remove the last character of a string if the character is a given definition
13
+ # @param string [String] The string to remove a character from
14
+ # @param character [String] The character to remove from the string
15
+ # @return [String] The newly edited string with the removed character
16
+ # @raise [TypeError] if the character is of the wrong type
8
17
  def self.removeLastCharacterIf(string, character)
9
18
  raise TypeError unless character.is_a? String
10
19
 
@@ -12,6 +21,11 @@ class Helpers
12
21
  return string
13
22
  end
14
23
 
24
+ # Remove the multiple last character of a string if the character is a given definition
25
+ # @param string [String] The string to remove a character from
26
+ # @param characters [String] The character to remove from the string
27
+ # @return [String] The newly edited string with the removed character
28
+ # @raise [TypeError] if the character is of the wrong type
15
29
  def self.removeMultipleLastCharacterIf(string, characters)
16
30
  raise TypeError unless characters.is_a? Array
17
31
 
@@ -22,6 +36,12 @@ class Helpers
22
36
  return string
23
37
  end
24
38
 
39
+ # Replace all characters in a string given a pattern and a replacement string
40
+ # @param string [String] The string to remove a character from
41
+ # @param pattern [String] The pattern to be taken into account when analyzing the string
42
+ # @param replacement [String] The replacement string to use when the pattern is found
43
+ # @return [String] The newly edited string with the replacement and pattern applied to it
44
+ # @raise [TypeError] if the string, pattern or the replacement is of the wrong type
25
45
  def self.replaceAllCharacter(string, pattern, replacement)
26
46
  raise TypeError unless string.is_a? String
27
47
  raise TypeError unless pattern.is_a? String
@@ -3,8 +3,19 @@ require 'json'
3
3
 
4
4
  require_relative 'resttype'
5
5
 
6
+ # Class used to perform HTTP Post and Get operations over the HTTP protocol
6
7
  class RestClient
7
8
 
9
+ # Initalize the object to perform the operations
10
+ # @param uri [String] The URL to perform the request against
11
+ # @param headers [Hash] Object that resembles the following structure
12
+ # {
13
+ # 'Content-Type' => 'application/json'
14
+ # }
15
+ # @param rest_type [resttype] Module that defines the type of operation that we are about to perform
16
+ # @param ssl [Boolean] True -> SSL is enabled. False -> SSL is disabled
17
+ # @param params [Hash] Is an object that represents the query string parameters to assign to the URL within the give
18
+ # restful invocation {'state' => 'started'}
8
19
  def initialize(uri, headers, rest_type, ssl, params)
9
20
  @uri = URI(uri)
10
21
  @http = Net::HTTP.new(@uri.host, @uri.port)
@@ -30,42 +41,66 @@ class RestClient
30
41
 
31
42
  end
32
43
 
44
+ # Return the URI of the web request
45
+ # @return [String] URL
33
46
  def getURI()
34
47
  return @uri.to_s
35
48
  end
36
49
 
50
+ # Return the URL's HOST
51
+ # @return [String] the URL's HOST
37
52
  def getHost()
38
53
  return @uri.host
39
54
  end
40
55
 
56
+ # Return the URL's PORT
57
+ # @return [Number] the URL's PORT
41
58
  def getPort()
42
59
  return @uri.port
43
60
  end
44
61
 
62
+ # Return the URL's PATH (URI)
63
+ # @return [String] the URL's URI
45
64
  def getPath()
46
65
  return @uri.path
47
66
  end
48
67
 
68
+ # Return the URL's Query string params
69
+ # @return [String] the URL's query string params
49
70
  def getQuery()
50
71
  return @uri.query
51
72
  end
52
73
 
74
+ # Set the URL's Query string params
75
+ # @param params [Hash] The params for the URL
53
76
  def setQueryStringParams(params)
54
77
  @uri.query = URI.encode_www_form( params )
55
78
  end
56
79
 
80
+ # Set the URL's Body
81
+ # @param content [Hash] The body of the web request.
82
+ # An example of this is the following data:
83
+ # {"action":"coreui_Repository",
84
+ # "method":"update"
85
+ # }.to_json
57
86
  def setBody(content)
58
87
  @req.body = content
59
88
  end
60
89
 
90
+ # Return the body that the webrequest is about the send
91
+ # @return [Hash] JSON body of the web request
61
92
  def getBody()
62
93
  return @req.body
63
94
  end
64
95
 
96
+ # Perform the HTTP Post request with the given information set within the object
97
+ # @return [HTTPResponse] Object containing all of the response information
65
98
  def post()
66
99
  return @http.request(@req)
67
100
  end
68
101
 
102
+ # Perform the HTTP GET request with the given information set within the object
103
+ # @return [HTTPResponse] Object containing all of the response information
69
104
  def get()
70
105
  return @http.request(@req)
71
106
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outreach_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.37
4
+ version: 1.0.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrique Legault