blackstack-core 1.2.10 → 1.2.11

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/functions.rb +82 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f9ada61d055548918448b48e7cf02f31226fefb8721d35b381a796f215df7f4
4
- data.tar.gz: a28cc19fc248d0263ab165218003b225cb25311d3e985ccc2ae1523c79049837
3
+ metadata.gz: c14f6619a24dc2278ac2ec596ca3ed4356962a26e9c4fc2b1872a837d4511273
4
+ data.tar.gz: f3a58ee1f1e87f0ccf0b6af5e9a2b4c14c1070b1144b3f2ca56802ce94a82f3d
5
5
  SHA512:
6
- metadata.gz: 733b6b5f3de03db04524a025b8759f1ed2060bb1bab93f232a4926ea83e352fea8f5fff3c15935c2220bdcb207a7b4cde1877ef26a97042729d431aff96a1e52
7
- data.tar.gz: a9e8dde42397c2364e4b8e74c271adc3d8697481ce79a09c9cc104f519c6383aa864b2d1604cec8028fcb50fca5526214afc30bd0138b8a7097d92d6a5a93d7b
6
+ metadata.gz: 5e190d673b3815bb5a32c7a270aaf9157b120c9f8a71e351aa6c355e80a6e61ff2af492a9d14e88d1d2b8fb0f3cd2e927404897b8b1ef9e8e0db7ff093f89e1c
7
+ data.tar.gz: 11efe2a841688d8d9af06410d3466aa0ab4bd82c4880447cd7ab6199974fbfc3c1cf2395e96634ca06ef8106d2501cdebe6985b5a93f00f6db4422cc42963eb0
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
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.10
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-07-31 00:00:00.000000000 Z
11
+ date: 2023-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: content_spinning