blackstack-core 1.2.9 → 1.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/example01.rb +19 -0
- data/lib/extend_string.rb +2 -2
- data/lib/functions.rb +83 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c14f6619a24dc2278ac2ec596ca3ed4356962a26e9c4fc2b1872a837d4511273
|
4
|
+
data.tar.gz: f3a58ee1f1e87f0ccf0b6af5e9a2b4c14c1070b1144b3f2ca56802ce94a82f3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e190d673b3815bb5a32c7a270aaf9157b120c9f8a71e351aa6c355e80a6e61ff2af492a9d14e88d1d2b8fb0f3cd2e927404897b8b1ef9e8e0db7ff093f89e1c
|
7
|
+
data.tar.gz: 11efe2a841688d8d9af06410d3466aa0ab4bd82c4880447cd7ab6199974fbfc3c1cf2395e96634ca06ef8106d2501cdebe6985b5a93f00f6db4422cc42963eb0
|
data/examples/example01.rb
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
require_relative '../lib/blackstack-core'
|
2
2
|
|
3
|
+
# inform if it is a personal email address, and who is hosting that email
|
4
|
+
a = [
|
5
|
+
'jloftus@qsd.fm',
|
6
|
+
'edg@egadesign.net',
|
7
|
+
'ghorn@strtrade.com',
|
8
|
+
'rbaker@luxurylakeoconee.com',
|
9
|
+
'sabbie.wijaya@gmail.com',
|
10
|
+
'stlbodj@swbell.net',
|
11
|
+
'OKnott@knottmechanical.com',
|
12
|
+
'ctekwani@gmail.com',
|
13
|
+
'billy@altgrouplv.com',
|
14
|
+
'bhaney@kingcastling.com',
|
15
|
+
]
|
16
|
+
a.each { |s|
|
17
|
+
print "'#{s}'.personal_email?... "
|
18
|
+
puts "#{s.personal_email?.to_s} (handler: #{s.mail_handler})"
|
19
|
+
}
|
20
|
+
exit(0)
|
21
|
+
|
3
22
|
# returns true if the string meets all the security requirements for a password
|
4
23
|
puts ""
|
5
24
|
puts "Passwords"
|
data/lib/extend_string.rb
CHANGED
@@ -26,13 +26,13 @@ class String
|
|
26
26
|
# raise an exception if `email` is not a valid email address.
|
27
27
|
# return if the email domain is gmail, hotmail, outlook, yahoo, comcast, aol, msn or sbcglobal.
|
28
28
|
def personal_email?
|
29
|
-
BlackStack::Netting.isPersonalEmail?(self.to_s)
|
29
|
+
return BlackStack::Netting.isPersonalEmail?(self.to_s)
|
30
30
|
end
|
31
31
|
|
32
32
|
# raise an exception if `email` is not a valid email address.
|
33
33
|
# return an array with the companies who are hosting an email address, by running the linux command `host`.
|
34
34
|
def mail_handler
|
35
|
-
BlackStack::Netting.getMailHandler(self.to_s)
|
35
|
+
return BlackStack::Netting.getMailHandler(self.to_s)
|
36
36
|
end
|
37
37
|
|
38
38
|
|
data/lib/functions.rb
CHANGED
@@ -1,5 +1,87 @@
|
|
1
1
|
|
2
2
|
module BlackStack
|
3
|
+
module API
|
4
|
+
# API connection parameters
|
5
|
+
@@api_key = nil # Api-key of the client who will be the owner of a process.
|
6
|
+
@@api_protocol = nil # Protocol, HTTP or HTTPS, of the BlackStack server where this process will be registered.
|
7
|
+
@@api_domain = nil # Domain of the BlackStack server where this process will be registered.
|
8
|
+
@@api_port = nil # Port of the BlackStack server where this process will be registered.
|
9
|
+
@@api_less_secure_port = nil # Port of the BlackStack server where this process will be registered.
|
10
|
+
|
11
|
+
# API connection getters and setters
|
12
|
+
def self.api_key()
|
13
|
+
@@api_key
|
14
|
+
end
|
15
|
+
def self.api_protocol
|
16
|
+
@@api_protocol
|
17
|
+
end
|
18
|
+
def self.api_domain
|
19
|
+
@@api_domain
|
20
|
+
end
|
21
|
+
def self.api_port
|
22
|
+
@@api_port
|
23
|
+
end
|
24
|
+
def self.api_less_secure_port
|
25
|
+
@@api_less_secure_port
|
26
|
+
end
|
27
|
+
def self.api_url()
|
28
|
+
"#{BlackStack::API.api_protocol}://#{BlackStack::API.api_domain}:#{BlackStack::API.api_port}"
|
29
|
+
end
|
30
|
+
def self.api_less_secure_url()
|
31
|
+
"http://#{BlackStack::API.api_domain}:#{BlackStack::API.api_less_secure_port}"
|
32
|
+
end
|
33
|
+
def self.set_api_key(s)
|
34
|
+
# validate: the parameter s is required
|
35
|
+
raise 'The parameter s is required' unless s
|
36
|
+
|
37
|
+
# validate: the parameter s must be a string
|
38
|
+
raise 'The parameter s must be a string' unless s.is_a?(String)
|
39
|
+
|
40
|
+
# map values
|
41
|
+
@@api_key = s
|
42
|
+
end
|
43
|
+
def self.set_api_url(h)
|
44
|
+
# validate: the parameter h is requred
|
45
|
+
raise "The parameter h is required." if h.nil?
|
46
|
+
|
47
|
+
# validate: the parameter h must be a hash
|
48
|
+
raise "The parameter h must be a hash" unless h.is_a?(Hash)
|
49
|
+
|
50
|
+
# validate: the :api_key key is required
|
51
|
+
raise 'The key :api_key is required' unless h.has_key?(:api_key)
|
52
|
+
|
53
|
+
# validate: the :api_protocol key is required
|
54
|
+
raise 'The key :api_protocol is required' unless h.has_key?(:api_domain)
|
55
|
+
|
56
|
+
# validate: the :api_domain key is required
|
57
|
+
raise 'The key :api_domain is required' unless h.has_key?(:api_domain)
|
58
|
+
|
59
|
+
# validate: the :api_port key is required
|
60
|
+
raise 'The key :api_port is required' unless h.has_key?(:api_port)
|
61
|
+
|
62
|
+
# validate: the :api_key key is a string
|
63
|
+
raise 'The key :api_key must be a string' unless h[:api_key].is_a?(String)
|
64
|
+
|
65
|
+
# validate: the :api_protocol key is a string
|
66
|
+
raise 'The key :api_protocol must be a string' unless h[:api_protocol].is_a?(String)
|
67
|
+
|
68
|
+
# validate: the :api_domain key is a string
|
69
|
+
raise 'The key :api_domain must be a string' unless h[:api_domain].is_a?(String)
|
70
|
+
|
71
|
+
# validate: the :api_port key is an integer, or a string that can be converted to an integer
|
72
|
+
raise 'The key :api_port must be an integer' unless h[:api_port].is_a?(Integer) || (h[:api_port].is_a?(String) && h[:api_port].to_i.to_s == h[:api_port])
|
73
|
+
|
74
|
+
# validate: the :api_less_secure_port key is an integer, or a string that can be converted to an integer
|
75
|
+
raise 'The key :api_less_secure_port must be an integer' unless h[:api_less_secure_port].is_a?(Integer) || (h[:api_less_secure_port].is_a?(String) && h[:api_less_secure_port].to_i.to_s == h[:api_less_secure_port])
|
76
|
+
|
77
|
+
# map the values
|
78
|
+
@@api_key = h[:api_key]
|
79
|
+
@@api_protocol = h[:api_protocol]
|
80
|
+
@@api_domain = h[:api_domain]
|
81
|
+
@@api_port = h[:api_port].to_i
|
82
|
+
@@api_less_secure_port = h[:api_less_secure_port].to_i
|
83
|
+
end
|
84
|
+
end # module API
|
3
85
|
|
4
86
|
# -----------------------------------------------------------------------------------------
|
5
87
|
# PRY Supporting Functions
|
@@ -844,7 +926,7 @@ module BlackStack
|
|
844
926
|
# extract the domain from the email
|
845
927
|
domain = value.split('@').last
|
846
928
|
#
|
847
|
-
domain
|
929
|
+
return domain=~/gmail\.com/ || domain=~/hotmail\.com/ || domain=~/outlook\.com/ || domain=~/yahoo\.com/ || domain=~/comcast\.com/ || domain=~/aol\.com/ || domain=~/msn\.com/ || domain=~/sbcglobal\.net/ ? true : false
|
848
930
|
end
|
849
931
|
|
850
932
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blackstack-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Daniel Sardi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: content_spinning
|