liteguard 0.2.20260314

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8f23791b98c679f5725e164d63279b9b4b9119c997a00239fdf7b2cdef79cc75
4
+ data.tar.gz: e8747b2ff6273315d5ec0eb9c8e420f4ff7543b0c40e358cf45eeec39e6f2854
5
+ SHA512:
6
+ metadata.gz: e9555143d0eaaa6776dc6081efb0303a5fee8957a27bbc804f9464325debb5fd16d87e0cf91815194a043081128038becfee9620c453d00fbcaaab287fa60136
7
+ data.tar.gz: afd0bfa6f21f799c2d5e04452c5711f7cce44af23ec8c8f061274f3c98edc362e0ec05ac0737b5b382898482649476c53dd7ad269b3266155536752c8c7bacdd
data/LICENSE ADDED
@@ -0,0 +1,158 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submit" means any form of electronic, verbal, or
51
+ written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source control systems, and issue tracking systems that are managed by,
54
+ or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and included
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or any
81
+ Contribution embodied within the Work constitutes direct or contributory
82
+ patent infringement, then any patent licenses granted to You under
83
+ this License for that Work shall terminate as of the date such
84
+ litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative
92
+ Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, You must include a readable copy of the
105
+ attribution notices contained within such NOTICE file, in
106
+ at least one of the following places: within a NOTICE text
107
+ file distributed as part of the Derivative Works; within
108
+ the Source form or documentation, if provided along with the
109
+ Derivative Works; or, within a display generated by the
110
+ Derivative Works, if and wherever such third-party notices
111
+ normally appear. The contents of the NOTICE file are for
112
+ informational purposes only and do not modify the License.
113
+ You may add Your own attribution notices within Derivative
114
+ Works that You distribute, alongside or as an addendum to
115
+ the NOTICE text from the Work, provided that such additional
116
+ attribution notices cannot be construed as modifying the License.
117
+
118
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
119
+ any Contribution intentionally submitted for inclusion in the Work
120
+ by You to the Licensor shall be under the terms and conditions of
121
+ this License, without any additional terms or conditions.
122
+
123
+ 6. Trademarks. This License does not grant permission to use the trade
124
+ names, trademarks, service marks, or product names of the Licensor,
125
+ except as required for reasonable and customary use in describing the
126
+ origin of the Work and reproducing the content of the NOTICE file.
127
+
128
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed
129
+ to in writing, Licensor provides the Work (and each Contributor
130
+ provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES
131
+ OR CONDITIONS OF ANY KIND.
132
+
133
+ 8. Limitation of Liability. In no event and under no legal theory shall
134
+ any Contributor be liable to You for damages, including any direct,
135
+ indirect, special, incidental, or exemplary damages of any character
136
+ arising as a result of this License or out of the use or inability to
137
+ use the Work.
138
+
139
+ 9. Accepting Warranty or Additional Liability. While redistributing the
140
+ Work or Derivative Works thereof, You may choose to offer, and charge
141
+ a fee for, acceptance of support, warranty, indemnity, or other
142
+ liability obligations and/or rights consistent with this License.
143
+
144
+ END OF TERMS AND CONDITIONS
145
+
146
+ Copyright 2024 Liteguard
147
+
148
+ Licensed under the Apache License, Version 2.0 (the "License");
149
+ you may not use this file except in compliance with the License.
150
+ You may obtain a copy of the License at
151
+
152
+ http://www.apache.org/licenses/LICENSE-2.0
153
+
154
+ Unless required by applicable law or agreed to in writing, software
155
+ distributed under the License is distributed on an "AS IS" BASIS,
156
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
157
+ See the License for the specific language governing permissions and
158
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # Liteguard Ruby SDK
2
+
3
+ [![Ruby SDK](https://github.com/liteguard/liteguard/actions/workflows/test-ruby.yml/badge.svg)](https://github.com/liteguard/liteguard/actions/workflows/test-ruby.yml)
4
+ [![Gem Version](https://img.shields.io/gem/v/liteguard)](https://rubygems.org/gems/liteguard)
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ gem install liteguard
10
+ ```
11
+
12
+ Or add to your `Gemfile`:
13
+
14
+ ```ruby
15
+ gem "liteguard"
16
+ ```
17
+
18
+ Requires Ruby 3.1+.
19
+
20
+ ## Quick Start
21
+
22
+ ```ruby
23
+ require "liteguard"
24
+
25
+ client = Liteguard::Client.new(
26
+ "pckid-...",
27
+ environment: "production"
28
+ )
29
+ client.start
30
+
31
+ scope = client.create_scope(user_id: "user-123", plan: "pro")
32
+
33
+ if scope.open?("payments.checkout")
34
+ # ...
35
+ end
36
+
37
+ client.shutdown
38
+ ```
39
+
40
+ ## Primary API
41
+
42
+ - `Liteguard::Client.new(project_client_key_id, **options)` creates a client.
43
+ - `client.start` fetches the initial bundle and starts refresh and flush workers.
44
+ - `client.create_scope(**properties)` creates an immutable scope.
45
+ - `scope.open?(name, **options)` evaluates locally.
46
+ - `scope.execute_if_open(name, **options) { ... }` measures guarded work.
47
+ - `scope.bind_protected_context(**protected_context)` derives a protected scope.
48
+ - `client.flush` flushes buffered telemetry.
49
+ - `client.shutdown` flushes and stops background work.
50
+
51
+ ## Notes
52
+
53
+ - Evaluation is local after the initial bundle fetch.
54
+ - Prefer explicit client and scope usage.
55
+ - Unadopted guards default open and emit no signals.
56
+
57
+ ## Development
58
+
59
+ ```bash
60
+ make test-ruby
61
+ ```
62
+
63
+ ## License
64
+
65
+ Apache 2.0 — see [LICENSE](https://github.com/liteguard/liteguard/blob/main/LICENSE).
66
+