fios 0.1.0

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: f5ff8ffbda61ee750118e319d3110463fe4576d9a90dc012d63e3ff49b5c2087
4
+ data.tar.gz: 381c885fb7ce89220177ccb6ef939589c1ee92f47c0472dcf8f3e3799e7cba31
5
+ SHA512:
6
+ metadata.gz: a26e8780e628d7d60db56a6a567d463daba8362d7060de4ad6c313032801a184b06034aaebc7e75fef11c9f58f203128939aa4f286f295f51115734fac9a3c82
7
+ data.tar.gz: 382d2090dd248d4c690ec8d7529c37af7d4cf70c66e6ebc12a5aac4c246143bbd5dc171724bf7f7bdaf2c2ce9b6dbf820814bb0f917ceedd15a351e9499f2af3
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.2
3
+
4
+ Style/StringLiterals:
5
+ EnforcedStyle: double_quotes
6
+
7
+ Style/StringLiteralsInInterpolation:
8
+ EnforcedStyle: double_quotes
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2026-02-01
4
+
5
+ - Initial release
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in fios.gemspec
6
+ gemspec
7
+
8
+ gem "irb"
9
+ gem "rake", "~> 13.0"
10
+
11
+ gem "rspec", "~> 3.0"
12
+
13
+ gem "rubocop", "~> 1.21"
data/Gemfile.lock ADDED
@@ -0,0 +1,271 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fios (0.1.0)
5
+ rails (>= 6.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ action_text-trix (2.1.16)
11
+ railties
12
+ actioncable (8.1.2)
13
+ actionpack (= 8.1.2)
14
+ activesupport (= 8.1.2)
15
+ nio4r (~> 2.0)
16
+ websocket-driver (>= 0.6.1)
17
+ zeitwerk (~> 2.6)
18
+ actionmailbox (8.1.2)
19
+ actionpack (= 8.1.2)
20
+ activejob (= 8.1.2)
21
+ activerecord (= 8.1.2)
22
+ activestorage (= 8.1.2)
23
+ activesupport (= 8.1.2)
24
+ mail (>= 2.8.0)
25
+ actionmailer (8.1.2)
26
+ actionpack (= 8.1.2)
27
+ actionview (= 8.1.2)
28
+ activejob (= 8.1.2)
29
+ activesupport (= 8.1.2)
30
+ mail (>= 2.8.0)
31
+ rails-dom-testing (~> 2.2)
32
+ actionpack (8.1.2)
33
+ actionview (= 8.1.2)
34
+ activesupport (= 8.1.2)
35
+ nokogiri (>= 1.8.5)
36
+ rack (>= 2.2.4)
37
+ rack-session (>= 1.0.1)
38
+ rack-test (>= 0.6.3)
39
+ rails-dom-testing (~> 2.2)
40
+ rails-html-sanitizer (~> 1.6)
41
+ useragent (~> 0.16)
42
+ actiontext (8.1.2)
43
+ action_text-trix (~> 2.1.15)
44
+ actionpack (= 8.1.2)
45
+ activerecord (= 8.1.2)
46
+ activestorage (= 8.1.2)
47
+ activesupport (= 8.1.2)
48
+ globalid (>= 0.6.0)
49
+ nokogiri (>= 1.8.5)
50
+ actionview (8.1.2)
51
+ activesupport (= 8.1.2)
52
+ builder (~> 3.1)
53
+ erubi (~> 1.11)
54
+ rails-dom-testing (~> 2.2)
55
+ rails-html-sanitizer (~> 1.6)
56
+ activejob (8.1.2)
57
+ activesupport (= 8.1.2)
58
+ globalid (>= 0.3.6)
59
+ activemodel (8.1.2)
60
+ activesupport (= 8.1.2)
61
+ activerecord (8.1.2)
62
+ activemodel (= 8.1.2)
63
+ activesupport (= 8.1.2)
64
+ timeout (>= 0.4.0)
65
+ activestorage (8.1.2)
66
+ actionpack (= 8.1.2)
67
+ activejob (= 8.1.2)
68
+ activerecord (= 8.1.2)
69
+ activesupport (= 8.1.2)
70
+ marcel (~> 1.0)
71
+ activesupport (8.1.2)
72
+ base64
73
+ bigdecimal
74
+ concurrent-ruby (~> 1.0, >= 1.3.1)
75
+ connection_pool (>= 2.2.5)
76
+ drb
77
+ i18n (>= 1.6, < 2)
78
+ json
79
+ logger (>= 1.4.2)
80
+ minitest (>= 5.1)
81
+ securerandom (>= 0.3)
82
+ tzinfo (~> 2.0, >= 2.0.5)
83
+ uri (>= 0.13.1)
84
+ ast (2.4.3)
85
+ base64 (0.3.0)
86
+ bigdecimal (4.0.1)
87
+ builder (3.3.0)
88
+ concurrent-ruby (1.3.6)
89
+ connection_pool (3.0.2)
90
+ crass (1.0.6)
91
+ date (3.5.1)
92
+ diff-lcs (1.6.2)
93
+ drb (2.2.3)
94
+ erb (6.0.1)
95
+ erubi (1.13.1)
96
+ globalid (1.3.0)
97
+ activesupport (>= 6.1)
98
+ i18n (1.14.8)
99
+ concurrent-ruby (~> 1.0)
100
+ io-console (0.8.2)
101
+ irb (1.16.0)
102
+ pp (>= 0.6.0)
103
+ rdoc (>= 4.0.0)
104
+ reline (>= 0.4.2)
105
+ json (2.18.0)
106
+ language_server-protocol (3.17.0.5)
107
+ lint_roller (1.1.0)
108
+ logger (1.7.0)
109
+ loofah (2.25.0)
110
+ crass (~> 1.0.2)
111
+ nokogiri (>= 1.12.0)
112
+ mail (2.9.0)
113
+ logger
114
+ mini_mime (>= 0.1.1)
115
+ net-imap
116
+ net-pop
117
+ net-smtp
118
+ marcel (1.1.0)
119
+ mini_mime (1.1.5)
120
+ minitest (6.0.1)
121
+ prism (~> 1.5)
122
+ net-imap (0.6.2)
123
+ date
124
+ net-protocol
125
+ net-pop (0.1.2)
126
+ net-protocol
127
+ net-protocol (0.2.2)
128
+ timeout
129
+ net-smtp (0.5.1)
130
+ net-protocol
131
+ nio4r (2.7.5)
132
+ nokogiri (1.19.0-aarch64-linux-gnu)
133
+ racc (~> 1.4)
134
+ nokogiri (1.19.0-aarch64-linux-musl)
135
+ racc (~> 1.4)
136
+ nokogiri (1.19.0-arm-linux-gnu)
137
+ racc (~> 1.4)
138
+ nokogiri (1.19.0-arm-linux-musl)
139
+ racc (~> 1.4)
140
+ nokogiri (1.19.0-arm64-darwin)
141
+ racc (~> 1.4)
142
+ nokogiri (1.19.0-x86_64-darwin)
143
+ racc (~> 1.4)
144
+ nokogiri (1.19.0-x86_64-linux-gnu)
145
+ racc (~> 1.4)
146
+ nokogiri (1.19.0-x86_64-linux-musl)
147
+ racc (~> 1.4)
148
+ parallel (1.27.0)
149
+ parser (3.3.10.1)
150
+ ast (~> 2.4.1)
151
+ racc
152
+ pp (0.6.3)
153
+ prettyprint
154
+ prettyprint (0.2.0)
155
+ prism (1.9.0)
156
+ psych (5.3.1)
157
+ date
158
+ stringio
159
+ racc (1.8.1)
160
+ rack (3.2.4)
161
+ rack-session (2.1.1)
162
+ base64 (>= 0.1.0)
163
+ rack (>= 3.0.0)
164
+ rack-test (2.2.0)
165
+ rack (>= 1.3)
166
+ rackup (2.3.1)
167
+ rack (>= 3)
168
+ rails (8.1.2)
169
+ actioncable (= 8.1.2)
170
+ actionmailbox (= 8.1.2)
171
+ actionmailer (= 8.1.2)
172
+ actionpack (= 8.1.2)
173
+ actiontext (= 8.1.2)
174
+ actionview (= 8.1.2)
175
+ activejob (= 8.1.2)
176
+ activemodel (= 8.1.2)
177
+ activerecord (= 8.1.2)
178
+ activestorage (= 8.1.2)
179
+ activesupport (= 8.1.2)
180
+ bundler (>= 1.15.0)
181
+ railties (= 8.1.2)
182
+ rails-dom-testing (2.3.0)
183
+ activesupport (>= 5.0.0)
184
+ minitest
185
+ nokogiri (>= 1.6)
186
+ rails-html-sanitizer (1.6.2)
187
+ loofah (~> 2.21)
188
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
189
+ railties (8.1.2)
190
+ actionpack (= 8.1.2)
191
+ activesupport (= 8.1.2)
192
+ irb (~> 1.13)
193
+ rackup (>= 1.0.0)
194
+ rake (>= 12.2)
195
+ thor (~> 1.0, >= 1.2.2)
196
+ tsort (>= 0.2)
197
+ zeitwerk (~> 2.6)
198
+ rainbow (3.1.1)
199
+ rake (13.3.1)
200
+ rdoc (7.1.0)
201
+ erb
202
+ psych (>= 4.0.0)
203
+ tsort
204
+ regexp_parser (2.11.3)
205
+ reline (0.6.3)
206
+ io-console (~> 0.5)
207
+ rspec (3.13.2)
208
+ rspec-core (~> 3.13.0)
209
+ rspec-expectations (~> 3.13.0)
210
+ rspec-mocks (~> 3.13.0)
211
+ rspec-core (3.13.6)
212
+ rspec-support (~> 3.13.0)
213
+ rspec-expectations (3.13.5)
214
+ diff-lcs (>= 1.2.0, < 2.0)
215
+ rspec-support (~> 3.13.0)
216
+ rspec-mocks (3.13.7)
217
+ diff-lcs (>= 1.2.0, < 2.0)
218
+ rspec-support (~> 3.13.0)
219
+ rspec-support (3.13.7)
220
+ rubocop (1.84.0)
221
+ json (~> 2.3)
222
+ language_server-protocol (~> 3.17.0.2)
223
+ lint_roller (~> 1.1.0)
224
+ parallel (~> 1.10)
225
+ parser (>= 3.3.0.2)
226
+ rainbow (>= 2.2.2, < 4.0)
227
+ regexp_parser (>= 2.9.3, < 3.0)
228
+ rubocop-ast (>= 1.49.0, < 2.0)
229
+ ruby-progressbar (~> 1.7)
230
+ unicode-display_width (>= 2.4.0, < 4.0)
231
+ rubocop-ast (1.49.0)
232
+ parser (>= 3.3.7.2)
233
+ prism (~> 1.7)
234
+ ruby-progressbar (1.13.0)
235
+ securerandom (0.4.1)
236
+ stringio (3.2.0)
237
+ thor (1.5.0)
238
+ timeout (0.6.0)
239
+ tsort (0.2.0)
240
+ tzinfo (2.0.6)
241
+ concurrent-ruby (~> 1.0)
242
+ unicode-display_width (3.2.0)
243
+ unicode-emoji (~> 4.1)
244
+ unicode-emoji (4.2.0)
245
+ uri (1.1.1)
246
+ useragent (0.16.11)
247
+ websocket-driver (0.8.0)
248
+ base64
249
+ websocket-extensions (>= 0.1.0)
250
+ websocket-extensions (0.1.5)
251
+ zeitwerk (2.7.4)
252
+
253
+ PLATFORMS
254
+ aarch64-linux-gnu
255
+ aarch64-linux-musl
256
+ arm-linux-gnu
257
+ arm-linux-musl
258
+ arm64-darwin
259
+ x86_64-darwin
260
+ x86_64-linux-gnu
261
+ x86_64-linux-musl
262
+
263
+ DEPENDENCIES
264
+ fios!
265
+ irb
266
+ rake (~> 13.0)
267
+ rspec (~> 3.0)
268
+ rubocop (~> 1.21)
269
+
270
+ BUNDLED WITH
271
+ 2.7.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Fios
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/fios`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ ```bash
14
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15
+ ```
16
+
17
+ If bundler is not being used to manage dependencies, install the gem by executing:
18
+
19
+ ```bash
20
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fios. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/fios/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Fios project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/fios/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "fios"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ require "irb"
11
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/fios.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/fios/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "fios"
7
+ spec.version = Fios::VERSION
8
+ spec.authors = ["Mark Harbison"]
9
+ spec.email = ["mark@tyne-solutions.com"]
10
+
11
+ spec.summary = "Fios."
12
+ spec.description = "Fios."
13
+ spec.homepage = "https://github.com/CodeTectonics/fios"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 3.2.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
20
+
21
+ spec.files = `git ls-files`.split("\n")
22
+ spec.test_files = `git ls-files -- spec/*`.split("\n")
23
+ spec.require_paths = ["lib"]
24
+
25
+ # Uncomment to register a new dependency of your gem
26
+ # spec.add_dependency "example-gem", "~> 1.0"
27
+ spec.add_dependency "rails", ">= 6.1"
28
+
29
+ # For more information and examples about making a new gem, check out our
30
+ # guide at: https://bundler.io/guides/creating_gem.html
31
+ end
@@ -0,0 +1,22 @@
1
+ module Fios
2
+ module Adapters
3
+ class ActiveRecordAdapter
4
+ include Fios::Adapters::Base
5
+
6
+ def self.adapter_key
7
+ :active_record
8
+ end
9
+
10
+ def initialize(dataset)
11
+ @dataset = dataset
12
+ @definition = Fios::Definitions::Registry.fetch(dataset.slug)
13
+ end
14
+
15
+ # TODO
16
+ def fetch(filters:, limit:)
17
+ view = @definition.source
18
+ # build SQL using filters + metadata
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ module Fios
2
+ module Adapters
3
+ module Base
4
+ extend ActiveSupport::Concern
5
+
6
+ attr_accessor :dataset, :definition
7
+
8
+ class_methods do
9
+ def adapter_key
10
+ raise NotImplementedError
11
+ end
12
+ end
13
+
14
+ def fetch(filters:, limit:)
15
+ raise NotImplementedError
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ module Fios
2
+ module Adapters
3
+ class Registry
4
+ mattr_accessor :adapters, default: {}
5
+
6
+ def self.register(klass)
7
+ key = klass.adapter_key.to_sym
8
+ raise "Duplicate dataset adapter key: #{key}" if @adapters.key?(key)
9
+ @adapters[key] = klass
10
+ end
11
+
12
+ def self.fetch(key)
13
+ @adapters.fetch(key.to_sym) do
14
+ raise KeyError, "Unknown dataset adapter: #{key}"
15
+ end
16
+ end
17
+
18
+ def self.clear!
19
+ @adapters = {}
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,170 @@
1
+ module Fios
2
+ module Builders
3
+ class ChartBuilder
4
+ def self.build(chart)
5
+ chart_config = chart.configuration || {}
6
+ dataset = Dataset.find(chart_config['dataset_id'])
7
+ dataset_class = Fios::Services::DatasetFetcher.fetch(dataset)
8
+
9
+ query = dataset_class.all
10
+ query = add_select_clause(query, chart_config)
11
+ query = add_where_clause(query, chart_config)
12
+ query = add_group_clause(query, chart_config)
13
+ parse_query_results(query, chart)
14
+ end
15
+
16
+ def self.parse_query_results(query, chart)
17
+ data = query.to_a
18
+
19
+ {
20
+ 'chart': {
21
+ 'type': chart.configuration['chart_type']
22
+ },
23
+
24
+ 'title': {
25
+ 'text': chart.name
26
+ },
27
+
28
+ 'xAxis': {
29
+ 'categories': parse_category_data(data, chart.configuration)
30
+ },
31
+
32
+ 'yAxis': {
33
+ 'title': {
34
+ 'text': nil
35
+ }
36
+ },
37
+
38
+ 'series': parse_series_data(data, chart.configuration)
39
+ }
40
+ end
41
+
42
+ def self.parse_category_data(data, chart_config)
43
+ x_axis_attr = chart_config['x_axis']['attr']
44
+
45
+ dataset = Dataset.find(chart_config['dataset_id'])
46
+ dataset_class = Fios::Services::DatasetFetcher.fetch(dataset)
47
+
48
+ translatable = dataset_class.translated_columns.include?(x_axis_attr.to_sym)
49
+ data.map do |row|
50
+ return row[x_axis_attr] unless translatable
51
+
52
+ I18n.t(row[x_axis_attr], default: row[x_axis_attr])
53
+ end
54
+ end
55
+
56
+ def self.parse_series_data(data, chart_config)
57
+ return [] if data.empty?
58
+
59
+ attrs = data[0].attribute_names
60
+ attrs.delete(chart_config['x_axis']['attr'])
61
+
62
+ attrs.map do |attr|
63
+ y_axis = chart_config['y_axes'].find do |col|
64
+ attr == aggregated_attr(col['attr'], col['aggregation'])[1]
65
+ end
66
+
67
+ { name: y_axis['label'], data: data.pluck(attr) }
68
+ end
69
+ end
70
+
71
+ def self.add_select_clause(query, chart_config)
72
+ fields = []
73
+ fields << chart_config['x_axis']['attr']
74
+
75
+ chart_config['y_axes'].each do |column|
76
+ aggregate = aggregated_attr(column['attr'], column['aggregation'])
77
+ fields << "#{aggregate[0]} AS '#{aggregate[1]}'"
78
+ end
79
+
80
+ query.select(fields)
81
+ end
82
+
83
+ def self.aggregated_attr(attr, aggregation)
84
+ case aggregation
85
+ when 'count'
86
+ ["COUNT(#{attr})", "num_#{attr}"]
87
+ when 'count_distinct'
88
+ ["COUNT(DISTINCT #{attr})", "num_uniq_#{attr}"]
89
+ when 'average'
90
+ ["AVG(#{attr})", "avg_#{attr}"]
91
+ when 'min'
92
+ ["MIN(#{attr})", "min_#{attr}"]
93
+ when 'max'
94
+ ["MAX(#{attr})", "max_#{attr}"]
95
+ when 'sum'
96
+ ["SUM(#{attr})", "sum_#{attr}"]
97
+ else
98
+ attr
99
+ end
100
+ end
101
+
102
+ def self.add_where_clause(query, chart_config)
103
+ return query if chart_config['filters'].blank?
104
+
105
+ chart_config['filters'].each do |filter|
106
+ field = filter['attr']
107
+ operator = filter['operator']
108
+ value = filter['value']
109
+
110
+ case operator
111
+ when '='
112
+ query = query.where(field => value)
113
+ when '!='
114
+ query = query.where.not(field => value)
115
+ when '>'
116
+ query = query.where("#{field} > ?", value)
117
+ when '>='
118
+ query = query.where("#{field} >= ?", value)
119
+ when '<'
120
+ query = query.where("#{field} < ?", value)
121
+ when '<='
122
+ query = query.where("#{field} <= ?", value)
123
+ when 'contains'
124
+ query = query.where("#{field} LIKE ?", "%#{value}%")
125
+ when 'starts_with'
126
+ query = query.where("#{field} LIKE ?", "#{value}%")
127
+ when 'ends_with'
128
+ query = query.where("#{field} LIKE ?", "%#{value}")
129
+ when 'one_of'
130
+ query = query.where("#{field} IN (?)", value)
131
+ when 'not_one_of'
132
+ query = query.where.not("#{field} IN (?)", value)
133
+ end
134
+ end
135
+
136
+ query
137
+ end
138
+
139
+ def self.add_group_clause(query, chart_config)
140
+ group_field = chart_config['x_axis']['attr']
141
+ query.group(group_field)
142
+ end
143
+
144
+ def self.build_csv(chart)
145
+ {
146
+ headers: csv_headers(chart),
147
+ rows: build(chart)
148
+ }
149
+ end
150
+
151
+ def self.csv_headers(chart)
152
+ chart_config = chart.configuration || {}
153
+
154
+ fields = []
155
+ fields << chart_config['x_axis']['attr']
156
+
157
+ chart_config['y_axes'].each do |column|
158
+ fields << "num_#{column['attr']}" if column['count']
159
+ fields << "num_uniq_#{column['attr']}" if column['count_distinct']
160
+ fields << "avg_#{column['attr']}" if column['average']
161
+ fields << "min_#{column['attr']}" if column['min']
162
+ fields << "max_#{column['attr']}" if column['max']
163
+ fields << "sum_#{column['attr']}" if column['sum']
164
+ end
165
+
166
+ fields
167
+ end
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,133 @@
1
+ module Fios
2
+ module Builders
3
+ class ReportBuilder
4
+ def self.build(dynamic_report)
5
+ report_config = dynamic_report.configuration || {}
6
+
7
+ dataset = Dataset.find(report_config['dataset_id'])
8
+ dataset_class = Fios::Services::DatasetFetcher.fetch(dataset)
9
+
10
+ query = dataset_class.all
11
+ query = add_select_clause(query, dataset_class, report_config)
12
+ query = add_where_clause(query, report_config)
13
+ add_group_clause(query, report_config)
14
+ end
15
+
16
+ def self.add_select_clause(query, dataset_class, report_config)
17
+ fields = []
18
+ report_config['columns'].each do |column|
19
+ next unless column['selected']
20
+
21
+ if report_config['aggregated']
22
+ fields << column['name'] if column['group_by']
23
+ fields << "COUNT(#{column['name']}) AS 'num_#{column['name']}'" if column['count']
24
+ if column['count_distinct']
25
+ fields << "COUNT(DISTINCT #{column['name']}) AS 'num_uniq_#{column['name']}'"
26
+ end
27
+ if column['average']
28
+ if column['type'].in?(%w[date datetime])
29
+ fields << "FROM_UNIXTIME(AVG(UNIX_TIMESTAMP(#{column['name']}))) AS 'avg_#{column['name']}'"
30
+ else
31
+ fields << "AVG(#{column['name']}) AS 'avg_#{column['name']}'"
32
+ end
33
+ end
34
+ fields << "MIN(#{column['name']}) AS 'min_#{column['name']}'" if column['min']
35
+ fields << "MAX(#{column['name']}) AS 'max_#{column['name']}'" if column['max']
36
+ fields << "SUM(#{column['name']}) AS 'sum_#{column['name']}'" if column['sum']
37
+ else
38
+ fields << column['name']
39
+ end
40
+ end
41
+
42
+ fields = dataset_class.column_names if fields.empty?
43
+
44
+ query.select(fields)
45
+ end
46
+
47
+ def self.add_where_clause(query, report_config)
48
+ return query if report_config['filters'].blank?
49
+
50
+ report_config['filters'].each do |filter|
51
+ field = filter['name']
52
+ operator = filter['operator']
53
+ value = filter['value']
54
+
55
+ case operator
56
+ when '='
57
+ query = query.where(field => value)
58
+ when '!='
59
+ query = query.where.not(field => value)
60
+ when '>'
61
+ query = query.where("#{field} > ?", value)
62
+ when '>='
63
+ query = query.where("#{field} >= ?", value)
64
+ when '<'
65
+ query = query.where("#{field} < ?", value)
66
+ when '<='
67
+ query = query.where("#{field} <= ?", value)
68
+ when 'contains'
69
+ query = query.where("#{field} LIKE ?", "%#{value}%")
70
+ when 'starts_with'
71
+ query = query.where("#{field} LIKE ?", "#{value}%")
72
+ when 'ends_with'
73
+ query = query.where("#{field} LIKE ?", "%#{value}")
74
+ when 'one_of'
75
+ query = query.where("#{field} IN (?)", value)
76
+ when 'not_one_of'
77
+ query = query.where.not("#{field} IN (?)", value)
78
+ end
79
+ end
80
+
81
+ query
82
+ end
83
+
84
+ def self.add_group_clause(query, report_config)
85
+ return query unless report_config['aggregated']
86
+
87
+ group_fields = []
88
+ report_config['columns'].each do |column|
89
+ next unless column['selected'] && column['group_by']
90
+
91
+ group_fields << column['name']
92
+ end
93
+
94
+ query.group(group_fields)
95
+ end
96
+
97
+ def self.build_csv(dynamic_report)
98
+ {
99
+ headers: csv_headers(dynamic_report),
100
+ rows: build(dynamic_report)
101
+ }
102
+ end
103
+
104
+ def self.csv_headers(dynamic_report)
105
+ report_config = dynamic_report.configuration || {}
106
+
107
+ dataset = Dataset.find(report_config['dataset_id'])
108
+ dataset_class = Fios::Services::DatasetFetcher.fetch(dataset)
109
+
110
+ return dataset_class.column_names if report_config['columns'].blank?
111
+
112
+ fields = []
113
+ report_config['columns'].each do |column|
114
+ next unless column['selected']
115
+
116
+ if report_config['aggregated']
117
+ fields << column['name'] if column['group_by']
118
+ fields << "num_#{column['name']}" if column['count']
119
+ fields << "num_uniq_#{column['name']}" if column['count_distinct']
120
+ fields << "avg_#{column['name']}" if column['average']
121
+ fields << "min_#{column['name']}" if column['min']
122
+ fields << "max_#{column['name']}" if column['max']
123
+ fields << "sum_#{column['name']}" if column['sum']
124
+ else
125
+ fields << column['name']
126
+ end
127
+ end
128
+
129
+ fields
130
+ end
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,13 @@
1
+ module Fios
2
+ module Definitions
3
+ module Base
4
+ extend ActiveSupport::Concern
5
+
6
+ class_methods do
7
+ def dataset_key
8
+ raise NotImplementedError
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,24 @@
1
+ module Fios
2
+ module Definitions
3
+ class Registry
4
+ mattr_accessor :definitions, default: {}
5
+
6
+ def self.register(klass)
7
+ key = klass.dataset_key.to_sym
8
+ raise "Duplicate dataset key: #{key}" if definitions.key?(key)
9
+
10
+ @definitions[key] = klass
11
+ end
12
+
13
+ def self.fetch(key)
14
+ @definitions.fetch(key.to_sym) do
15
+ raise KeyError, "Unknown dataset: #{key}"
16
+ end
17
+ end
18
+
19
+ def self.clear!
20
+ @definitions = {}
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,10 @@
1
+ module Fios
2
+ class Railtie < Rails::Railtie
3
+ initializer "fios.prepare" do
4
+ Rails.application.config.to_prepare do
5
+ Fios::Definitions::Registry.clear!
6
+ Fios::Adapters::Registry.clear!
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ module Fios
2
+ module Registrar
3
+ def self.register(&block)
4
+ instance_eval(&block)
5
+ end
6
+
7
+ def self.dataset(klass)
8
+ Fios::Definitions::Registry.register(klass)
9
+ end
10
+
11
+ def self.adapter(klass)
12
+ Fios::Adapters::Registry.register(klass)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ module Fios
2
+ module Services
3
+ class DatasetFetcher
4
+ def self.fetch(dataset)
5
+ adapter_klass = Fios::Adapters::Registry.fetch(dataset.adapter)
6
+ adapter = adapter_klass.new(dataset)
7
+ adapter.definition
8
+ #adapter.fetch()
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Fios
4
+ VERSION = "0.1.0"
5
+ end
data/lib/fios.rb ADDED
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support"
4
+ require "active_support/concern"
5
+ require "rails"
6
+
7
+ require_relative "fios/adapters/base"
8
+ require_relative "fios/adapters/active_record_adapter"
9
+ require_relative "fios/adapters/registry"
10
+ require_relative "fios/builders/chart_builder"
11
+ require_relative "fios/builders/report_builder"
12
+ require_relative "fios/definitions/base"
13
+ require_relative "fios/definitions/registry"
14
+ require_relative "fios/services/dataset_fetcher"
15
+ require_relative "fios/registrar"
16
+ require_relative "fios/version"
17
+ require_relative "fios/railtie"
18
+
19
+ module Fios
20
+ class Error < StandardError; end
21
+ end
data/sig/fios.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Fios
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
data/spec/fios_spec.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Fios do
4
+ it "has a version number" do
5
+ expect(Fios::VERSION).not_to be nil
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fios"
4
+
5
+ RSpec.configure do |config|
6
+ # Enable flags like --only-failures and --next-failure
7
+ config.example_status_persistence_file_path = ".rspec_status"
8
+
9
+ # Disable RSpec exposing methods globally on `Module` and `main`
10
+ config.disable_monkey_patching!
11
+
12
+ config.expect_with :rspec do |c|
13
+ c.syntax = :expect
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fios
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mark Harbison
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-02-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '6.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '6.1'
27
+ description: Fios.
28
+ email:
29
+ - mark@tyne-solutions.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - ".rspec"
36
+ - ".rubocop.yml"
37
+ - CHANGELOG.md
38
+ - CODE_OF_CONDUCT.md
39
+ - Gemfile
40
+ - Gemfile.lock
41
+ - LICENSE.txt
42
+ - README.md
43
+ - Rakefile
44
+ - bin/console
45
+ - bin/setup
46
+ - fios.gemspec
47
+ - lib/fios.rb
48
+ - lib/fios/adapters/active_record_adapter.rb
49
+ - lib/fios/adapters/base.rb
50
+ - lib/fios/adapters/registry.rb
51
+ - lib/fios/builders/chart_builder.rb
52
+ - lib/fios/builders/report_builder.rb
53
+ - lib/fios/definitions/base.rb
54
+ - lib/fios/definitions/registry.rb
55
+ - lib/fios/railtie.rb
56
+ - lib/fios/registrar.rb
57
+ - lib/fios/services/dataset_fetcher.rb
58
+ - lib/fios/version.rb
59
+ - sig/fios.rbs
60
+ - spec/fios_spec.rb
61
+ - spec/spec_helper.rb
62
+ homepage: https://github.com/CodeTectonics/fios
63
+ licenses:
64
+ - MIT
65
+ metadata:
66
+ homepage_uri: https://github.com/CodeTectonics/fios
67
+ source_code_uri: https://github.com/CodeTectonics/fios
68
+ changelog_uri: https://github.com/CodeTectonics/fios/blob/main/CHANGELOG.md
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: 3.2.0
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubygems_version: 3.4.19
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Fios.
88
+ test_files:
89
+ - spec/fios_spec.rb
90
+ - spec/spec_helper.rb