spond 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: 739e0121d36f357ab21d8c0ca2411f37dbe4eb77a301b1b48fe3fe4c62ec74cf
4
+ data.tar.gz: bafca8f1a0430480e19adab4e62cf220b5e5f383d5a7b5388fb02fdc60b03837
5
+ SHA512:
6
+ metadata.gz: 65e19c7b088e1e4c9c4033d1739149ffa9ce62359d656434ed570766ced558b092a05b2e9431fb4d74deb1b3695fc8c0ad672cc8afeecc0ac8ef8382e439f8f3
7
+ data.tar.gz: 3de199b0a3a888491b5551593f276d9e1c29b591fdeaa83c64fd818840d387bff99e887d6609a71fd6a7bca7e89bd6408d62be47e11439c90e3ead7dc97c76f3
data/.envrc ADDED
@@ -0,0 +1 @@
1
+ use flake
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/standardrb/standard
3
+ ruby_version: 3.4
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-02-13
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/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Graeme Porteous
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,91 @@
1
+ # Unofficial Ruby client for the Spond API
2
+
3
+ This gem provides an unofficial Ruby client for the Spond API, allowing you to interact with Spond platform for managing sports clubs, teams and events programmatically.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ $ bundle add spond
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ $ gem install spond
14
+
15
+ ## Usage
16
+
17
+ Authentication set env vars:
18
+
19
+ ENV["SPOND_EMAIL"]
20
+ ENV["SPOND_PASSWORD"]
21
+
22
+ Authentication happens transparently when these environment variables are set.
23
+
24
+ You can also authenticate explicitly:
25
+
26
+ client = Spond::Client.new(
27
+ email: "your-email@example.com",
28
+ password: "your-password"
29
+ )
30
+ Spond.client = client
31
+
32
+ ### Working with the current user
33
+
34
+ ```ruby
35
+ # Get the current user's profile information
36
+ profile = Spond.profile
37
+ ```
38
+
39
+ ### Working with groups
40
+
41
+ ```ruby
42
+ # Get all groups the user is a member of
43
+ groups = Spond.groups
44
+
45
+ # Access group information
46
+ groups.each do |group|
47
+ puts "Group: #{group.name} (ID: #{group.id})"
48
+ end
49
+ ```
50
+
51
+ ### Working with events
52
+
53
+ ```ruby
54
+ # Get all events for the user
55
+ events = Spond.events
56
+
57
+ # Filter events
58
+ future_events = Spond::Event.where(maxEndTimestamp: Time.now)
59
+
60
+ # Get events for a specific group
61
+ group_events = Spond::Event.for_group("group-id-here")
62
+
63
+ # Access event details
64
+ event = events.first
65
+ puts "Event: #{event.heading}"
66
+ puts "Start time: #{event.startTimestamp}"
67
+
68
+ # Get event comments
69
+ comments = event.comments
70
+ comments.each do |comment|
71
+ puts "Comment: #{comment.text}"
72
+ end
73
+ ```
74
+
75
+ ## Development
76
+
77
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
78
+
79
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `lib/spond/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).
80
+
81
+ ## Contributing
82
+
83
+ Bug reports and pull requests are welcome on GitHub at https://github.com/gbp/spond-ruby. 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/gbp/spond-ruby/blob/main/CODE_OF_CONDUCT.md).
84
+
85
+ ## License
86
+
87
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
88
+
89
+ ## Code of Conduct
90
+
91
+ Everyone interacting in the unofficial Ruby client for the Spond API project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/gbp/spond-ruby/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ require "standard/rake"
7
+
8
+ task default: %i[spec standard]
data/flake.lock ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "nodes": {
3
+ "flake-utils": {
4
+ "inputs": {
5
+ "systems": "systems"
6
+ },
7
+ "locked": {
8
+ "lastModified": 1731533236,
9
+ "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
10
+ "owner": "numtide",
11
+ "repo": "flake-utils",
12
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
13
+ "type": "github"
14
+ },
15
+ "original": {
16
+ "owner": "numtide",
17
+ "repo": "flake-utils",
18
+ "type": "github"
19
+ }
20
+ },
21
+ "nixpkgs": {
22
+ "locked": {
23
+ "lastModified": 1739319052,
24
+ "narHash": "sha256-L8Tq1dnW96U70vrNpCCGCLHz4rX1GhNRCrRI/iox9wc=",
25
+ "owner": "NixOS",
26
+ "repo": "nixpkgs",
27
+ "rev": "83a2581c81ff5b06f7c1a4e7cc736a455dfcf7b4",
28
+ "type": "github"
29
+ },
30
+ "original": {
31
+ "id": "nixpkgs",
32
+ "ref": "nixpkgs-unstable",
33
+ "type": "indirect"
34
+ }
35
+ },
36
+ "root": {
37
+ "inputs": {
38
+ "flake-utils": "flake-utils",
39
+ "nixpkgs": "nixpkgs"
40
+ }
41
+ },
42
+ "systems": {
43
+ "locked": {
44
+ "lastModified": 1681028828,
45
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
46
+ "owner": "nix-systems",
47
+ "repo": "default",
48
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
49
+ "type": "github"
50
+ },
51
+ "original": {
52
+ "owner": "nix-systems",
53
+ "repo": "default",
54
+ "type": "github"
55
+ }
56
+ }
57
+ },
58
+ "root": "root",
59
+ "version": 7
60
+ }
data/flake.nix ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ description = "Spond Ruby Client";
3
+
4
+ inputs = {
5
+ nixpkgs.url = "nixpkgs/nixpkgs-unstable";
6
+ flake-utils.url = "github:numtide/flake-utils";
7
+ };
8
+
9
+ outputs = { self, nixpkgs, flake-utils }:
10
+ flake-utils.lib.eachDefaultSystem (system:
11
+ let
12
+ pkgs = nixpkgs.legacyPackages.${system};
13
+ spondRuby = pkgs.bundlerEnv {
14
+ name = "gemset";
15
+ gemfile = ./Gemfile;
16
+ lockfile = ./Gemfile.lock;
17
+ gemset = ./gemset.nix;
18
+ };
19
+ in {
20
+
21
+ defaultPackage = spondRuby;
22
+
23
+ # used by nix shell and nix develop
24
+ devShell = with pkgs;
25
+ mkShell {
26
+ buildInputs = [
27
+ ruby_3_4
28
+ bundix
29
+
30
+ # For psych gem:
31
+ libyaml
32
+ ];
33
+ };
34
+ });
35
+ }
data/gemset.nix ADDED
@@ -0,0 +1,524 @@
1
+ {
2
+ addressable = {
3
+ dependencies = ["public_suffix"];
4
+ groups = ["default"];
5
+ platforms = [];
6
+ source = {
7
+ remotes = ["https://rubygems.org"];
8
+ sha256 = "0cl2qpvwiffym62z991ynks7imsm87qmgxf0yfsmlwzkgi9qcaa6";
9
+ type = "gem";
10
+ };
11
+ version = "2.8.7";
12
+ };
13
+ ast = {
14
+ groups = ["default"];
15
+ platforms = [];
16
+ source = {
17
+ remotes = ["https://rubygems.org"];
18
+ sha256 = "04nc8x27hlzlrr5c2gn7mar4vdr0apw5xg22wp6m8dx3wqr04a0y";
19
+ type = "gem";
20
+ };
21
+ version = "2.4.2";
22
+ };
23
+ base64 = {
24
+ groups = ["default"];
25
+ platforms = [];
26
+ source = {
27
+ remotes = ["https://rubygems.org"];
28
+ sha256 = "01qml0yilb9basf7is2614skjp8384h2pycfx86cr8023arfj98g";
29
+ type = "gem";
30
+ };
31
+ version = "0.2.0";
32
+ };
33
+ bigdecimal = {
34
+ groups = ["default"];
35
+ platforms = [];
36
+ source = {
37
+ remotes = ["https://rubygems.org"];
38
+ sha256 = "1k6qzammv9r6b2cw3siasaik18i6wjc5m0gw5nfdc6jj64h79z1g";
39
+ type = "gem";
40
+ };
41
+ version = "3.1.9";
42
+ };
43
+ crack = {
44
+ dependencies = ["bigdecimal" "rexml"];
45
+ groups = ["default"];
46
+ platforms = [];
47
+ source = {
48
+ remotes = ["https://rubygems.org"];
49
+ sha256 = "0jaa7is4fw1cxigm8vlyhg05bw4nqy4f91zjqxk7pp4c8bdyyfn8";
50
+ type = "gem";
51
+ };
52
+ version = "1.0.0";
53
+ };
54
+ date = {
55
+ groups = ["default"];
56
+ platforms = [];
57
+ source = {
58
+ remotes = ["https://rubygems.org"];
59
+ sha256 = "0kz6mc4b9m49iaans6cbx031j9y7ldghpi5fzsdh0n3ixwa8w9mz";
60
+ type = "gem";
61
+ };
62
+ version = "3.4.1";
63
+ };
64
+ diff-lcs = {
65
+ groups = ["default"];
66
+ platforms = [];
67
+ source = {
68
+ remotes = ["https://rubygems.org"];
69
+ sha256 = "0bnss89lcm3b1k3xcjd35grxqz5q040d12imd73qybwnfarggrx1";
70
+ type = "gem";
71
+ };
72
+ version = "1.6.0";
73
+ };
74
+ hashdiff = {
75
+ groups = ["default"];
76
+ platforms = [];
77
+ source = {
78
+ remotes = ["https://rubygems.org"];
79
+ sha256 = "0xqsnx25lm1wwgchvrl5xla5zzk3d6gbkdfj062cwggdsvgfwc1c";
80
+ type = "gem";
81
+ };
82
+ version = "1.1.2";
83
+ };
84
+ io-console = {
85
+ groups = ["default"];
86
+ platforms = [];
87
+ source = {
88
+ remotes = ["https://rubygems.org"];
89
+ sha256 = "18pgvl7lfjpichdfh1g50rpz0zpaqrpr52ybn9liv1v9pjn9ysnd";
90
+ type = "gem";
91
+ };
92
+ version = "0.8.0";
93
+ };
94
+ irb = {
95
+ dependencies = ["pp" "rdoc" "reline"];
96
+ groups = ["default"];
97
+ platforms = [];
98
+ source = {
99
+ remotes = ["https://rubygems.org"];
100
+ sha256 = "1478m97wiy6nwg6lnl0szy39p46acsvrhax552vsh1s2mi2sgg6r";
101
+ type = "gem";
102
+ };
103
+ version = "1.15.1";
104
+ };
105
+ json = {
106
+ groups = ["default"];
107
+ platforms = [];
108
+ source = {
109
+ remotes = ["https://rubygems.org"];
110
+ sha256 = "1p4l5ycdxfsr8b51gnvlvhq6s21vmx9z4x617003zbqv3bcqmj6x";
111
+ type = "gem";
112
+ };
113
+ version = "2.10.1";
114
+ };
115
+ language_server-protocol = {
116
+ groups = ["default"];
117
+ platforms = [];
118
+ source = {
119
+ remotes = ["https://rubygems.org"];
120
+ sha256 = "0scnz2fvdczdgadvjn0j9d49118aqm3hj66qh8sd2kv6g1j65164";
121
+ type = "gem";
122
+ };
123
+ version = "3.17.0.4";
124
+ };
125
+ lint_roller = {
126
+ groups = ["default"];
127
+ platforms = [];
128
+ source = {
129
+ remotes = ["https://rubygems.org"];
130
+ sha256 = "11yc0d84hsnlvx8cpk4cbj6a4dz9pk0r1k29p0n1fz9acddq831c";
131
+ type = "gem";
132
+ };
133
+ version = "1.1.0";
134
+ };
135
+ logger = {
136
+ groups = ["default"];
137
+ platforms = [];
138
+ source = {
139
+ remotes = ["https://rubygems.org"];
140
+ sha256 = "05s008w9vy7is3njblmavrbdzyrwwc1fsziffdr58w9pwqj8sqfx";
141
+ type = "gem";
142
+ };
143
+ version = "1.6.6";
144
+ };
145
+ parallel = {
146
+ groups = ["default"];
147
+ platforms = [];
148
+ source = {
149
+ remotes = ["https://rubygems.org"];
150
+ sha256 = "1vy7sjs2pgz4i96v5yk9b7aafbffnvq7nn419fgvw55qlavsnsyq";
151
+ type = "gem";
152
+ };
153
+ version = "1.26.3";
154
+ };
155
+ parser = {
156
+ dependencies = ["ast" "racc"];
157
+ groups = ["default"];
158
+ platforms = [];
159
+ source = {
160
+ remotes = ["https://rubygems.org"];
161
+ sha256 = "18dcwrcnddvi8gl3hmbsb2cj1l7afxk2lh3jmhj90l95h1hn3gkx";
162
+ type = "gem";
163
+ };
164
+ version = "3.3.7.1";
165
+ };
166
+ pp = {
167
+ dependencies = ["prettyprint"];
168
+ groups = ["default"];
169
+ platforms = [];
170
+ source = {
171
+ remotes = ["https://rubygems.org"];
172
+ sha256 = "1zxnfxjni0r9l2x42fyq0sqpnaf5nakjbap8irgik4kg1h9c6zll";
173
+ type = "gem";
174
+ };
175
+ version = "0.6.2";
176
+ };
177
+ prettyprint = {
178
+ groups = ["default"];
179
+ platforms = [];
180
+ source = {
181
+ remotes = ["https://rubygems.org"];
182
+ sha256 = "14zicq3plqi217w6xahv7b8f7aj5kpxv1j1w98344ix9h5ay3j9b";
183
+ type = "gem";
184
+ };
185
+ version = "0.2.0";
186
+ };
187
+ prism = {
188
+ groups = ["default"];
189
+ platforms = [];
190
+ source = {
191
+ remotes = ["https://rubygems.org"];
192
+ sha256 = "0fi7hvrm2wzbhm21d3w87z5nrqx6z0gwhilvdizcpc9ik21205mi";
193
+ type = "gem";
194
+ };
195
+ version = "1.3.0";
196
+ };
197
+ psych = {
198
+ dependencies = ["date" "stringio"];
199
+ groups = ["default"];
200
+ platforms = [];
201
+ source = {
202
+ remotes = ["https://rubygems.org"];
203
+ sha256 = "1vjrx3yd596zzi42dcaq5xw7hil1921r769dlbz08iniaawlp9c4";
204
+ type = "gem";
205
+ };
206
+ version = "5.2.3";
207
+ };
208
+ public_suffix = {
209
+ groups = ["default"];
210
+ platforms = [];
211
+ source = {
212
+ remotes = ["https://rubygems.org"];
213
+ sha256 = "0vqcw3iwby3yc6avs1vb3gfd0vcp2v7q310665dvxfswmcf4xm31";
214
+ type = "gem";
215
+ };
216
+ version = "6.0.1";
217
+ };
218
+ racc = {
219
+ groups = ["default"];
220
+ platforms = [];
221
+ source = {
222
+ remotes = ["https://rubygems.org"];
223
+ sha256 = "0byn0c9nkahsl93y9ln5bysq4j31q8xkf2ws42swighxd4lnjzsa";
224
+ type = "gem";
225
+ };
226
+ version = "1.8.1";
227
+ };
228
+ rainbow = {
229
+ groups = ["default"];
230
+ platforms = [];
231
+ source = {
232
+ remotes = ["https://rubygems.org"];
233
+ sha256 = "0smwg4mii0fm38pyb5fddbmrdpifwv22zv3d3px2xx497am93503";
234
+ type = "gem";
235
+ };
236
+ version = "3.1.1";
237
+ };
238
+ rake = {
239
+ groups = ["default"];
240
+ platforms = [];
241
+ source = {
242
+ remotes = ["https://rubygems.org"];
243
+ sha256 = "17850wcwkgi30p7yqh60960ypn7yibacjjha0av78zaxwvd3ijs6";
244
+ type = "gem";
245
+ };
246
+ version = "13.2.1";
247
+ };
248
+ rbs = {
249
+ dependencies = ["logger"];
250
+ groups = ["default"];
251
+ platforms = [];
252
+ source = {
253
+ remotes = ["https://rubygems.org"];
254
+ sha256 = "07cwjkx7b3ssy8ccqq1s34sc5snwvgxan2ikmp9y2rz2a9wy6v1b";
255
+ type = "gem";
256
+ };
257
+ version = "3.8.1";
258
+ };
259
+ rdoc = {
260
+ dependencies = ["psych"];
261
+ groups = ["default"];
262
+ platforms = [];
263
+ source = {
264
+ remotes = ["https://rubygems.org"];
265
+ sha256 = "1q2nkyk6r3m15a2an7lwm4ilkcxzdh3j93s4ib8sbzqb0xp70vvx";
266
+ type = "gem";
267
+ };
268
+ version = "6.12.0";
269
+ };
270
+ regexp_parser = {
271
+ groups = ["default"];
272
+ platforms = [];
273
+ source = {
274
+ remotes = ["https://rubygems.org"];
275
+ sha256 = "0qccah61pjvzyyg6mrp27w27dlv6vxlbznzipxjcswl7x3fhsvyb";
276
+ type = "gem";
277
+ };
278
+ version = "2.10.0";
279
+ };
280
+ reline = {
281
+ dependencies = ["io-console"];
282
+ groups = ["default"];
283
+ platforms = [];
284
+ source = {
285
+ remotes = ["https://rubygems.org"];
286
+ sha256 = "1lirwlw59apc8m1wjk85y2xidiv0fkxjn6f7p84yqmmyvish6qjp";
287
+ type = "gem";
288
+ };
289
+ version = "0.6.0";
290
+ };
291
+ rexml = {
292
+ groups = ["default"];
293
+ platforms = [];
294
+ source = {
295
+ remotes = ["https://rubygems.org"];
296
+ sha256 = "1jmbf6lf7pcyacpb939xjjpn1f84c3nw83dy3p1lwjx0l2ljfif7";
297
+ type = "gem";
298
+ };
299
+ version = "3.4.1";
300
+ };
301
+ rspec = {
302
+ dependencies = ["rspec-core" "rspec-expectations" "rspec-mocks"];
303
+ groups = ["default"];
304
+ platforms = [];
305
+ source = {
306
+ remotes = ["https://rubygems.org"];
307
+ sha256 = "14xrp8vq6i9zx37vh0yp4h9m0anx9paw200l1r5ad9fmq559346l";
308
+ type = "gem";
309
+ };
310
+ version = "3.13.0";
311
+ };
312
+ rspec-core = {
313
+ dependencies = ["rspec-support"];
314
+ groups = ["default"];
315
+ platforms = [];
316
+ source = {
317
+ remotes = ["https://rubygems.org"];
318
+ sha256 = "1r6zbis0hhbik1ck8kh58qb37d1qwij1x1d2fy4jxkzryh3na4r5";
319
+ type = "gem";
320
+ };
321
+ version = "3.13.3";
322
+ };
323
+ rspec-expectations = {
324
+ dependencies = ["diff-lcs" "rspec-support"];
325
+ groups = ["default"];
326
+ platforms = [];
327
+ source = {
328
+ remotes = ["https://rubygems.org"];
329
+ sha256 = "0n3cyrhsa75x5wwvskrrqk56jbjgdi2q1zx0irllf0chkgsmlsqf";
330
+ type = "gem";
331
+ };
332
+ version = "3.13.3";
333
+ };
334
+ rspec-mocks = {
335
+ dependencies = ["diff-lcs" "rspec-support"];
336
+ groups = ["default"];
337
+ platforms = [];
338
+ source = {
339
+ remotes = ["https://rubygems.org"];
340
+ sha256 = "1vxxkb2sf2b36d8ca2nq84kjf85fz4x7wqcvb8r6a5hfxxfk69r3";
341
+ type = "gem";
342
+ };
343
+ version = "3.13.2";
344
+ };
345
+ rspec-support = {
346
+ groups = ["default"];
347
+ platforms = [];
348
+ source = {
349
+ remotes = ["https://rubygems.org"];
350
+ sha256 = "1v6v6xvxcpkrrsrv7v1xgf7sl0d71vcfz1cnrjflpf6r7x3a58yf";
351
+ type = "gem";
352
+ };
353
+ version = "3.13.2";
354
+ };
355
+ rubocop = {
356
+ dependencies = ["json" "language_server-protocol" "parallel" "parser" "rainbow" "regexp_parser" "rubocop-ast" "ruby-progressbar" "unicode-display_width"];
357
+ groups = ["default"];
358
+ platforms = [];
359
+ source = {
360
+ remotes = ["https://rubygems.org"];
361
+ sha256 = "0zzrsdz23jmjc8iwilzhw5cifn4flzmsbwkzxlwa6qf6m80payws";
362
+ type = "gem";
363
+ };
364
+ version = "1.71.2";
365
+ };
366
+ rubocop-ast = {
367
+ dependencies = ["parser"];
368
+ groups = ["default"];
369
+ platforms = [];
370
+ source = {
371
+ remotes = ["https://rubygems.org"];
372
+ sha256 = "1zjpv3kw4ciwk0dh43zj17ws318vnirby1clmcy6j9mvr4mbxv40";
373
+ type = "gem";
374
+ };
375
+ version = "1.38.1";
376
+ };
377
+ rubocop-performance = {
378
+ dependencies = ["rubocop" "rubocop-ast"];
379
+ groups = ["default"];
380
+ platforms = [];
381
+ source = {
382
+ remotes = ["https://rubygems.org"];
383
+ sha256 = "10hv0lz54q34dlwx6vld0qx1fjskfb0nyb5c18cadrpmjnkqcbzj";
384
+ type = "gem";
385
+ };
386
+ version = "1.23.1";
387
+ };
388
+ ruby-lsp = {
389
+ dependencies = ["language_server-protocol" "prism" "rbs" "sorbet-runtime"];
390
+ groups = ["default"];
391
+ platforms = [];
392
+ source = {
393
+ remotes = ["https://rubygems.org"];
394
+ sha256 = "1hx0hb0j0jpzizc76sjrmvgvwifr7507xap66wzg6mj3mqc0y46r";
395
+ type = "gem";
396
+ };
397
+ version = "0.23.11";
398
+ };
399
+ ruby-progressbar = {
400
+ groups = ["default"];
401
+ platforms = [];
402
+ source = {
403
+ remotes = ["https://rubygems.org"];
404
+ sha256 = "0cwvyb7j47m7wihpfaq7rc47zwwx9k4v7iqd9s1xch5nm53rrz40";
405
+ type = "gem";
406
+ };
407
+ version = "1.13.0";
408
+ };
409
+ sorbet-runtime = {
410
+ groups = ["default"];
411
+ platforms = [];
412
+ source = {
413
+ remotes = ["https://rubygems.org"];
414
+ sha256 = "1d52l2f15fgbdk6sn40yx08abpdvxw2mad6215blafpxxgaf0gk3";
415
+ type = "gem";
416
+ };
417
+ version = "0.5.11875";
418
+ };
419
+ spond = {
420
+ groups = ["default"];
421
+ platforms = [];
422
+ source = {
423
+ path = ./.;
424
+ type = "path";
425
+ };
426
+ version = "0.1.0";
427
+ };
428
+ standard = {
429
+ dependencies = ["language_server-protocol" "lint_roller" "rubocop" "standard-custom" "standard-performance"];
430
+ groups = ["default"];
431
+ platforms = [];
432
+ source = {
433
+ remotes = ["https://rubygems.org"];
434
+ sha256 = "13ijzq7r0v0rm1yyba1jfw2s9r3kfxljwypfhzpnkrsag64kk2b5";
435
+ type = "gem";
436
+ };
437
+ version = "1.45.0";
438
+ };
439
+ standard-custom = {
440
+ dependencies = ["lint_roller" "rubocop"];
441
+ groups = ["default"];
442
+ platforms = [];
443
+ source = {
444
+ remotes = ["https://rubygems.org"];
445
+ sha256 = "0av55ai0nv23z5mhrwj1clmxpgyngk7vk6rh58d4y1ws2y2dqjj2";
446
+ type = "gem";
447
+ };
448
+ version = "1.0.2";
449
+ };
450
+ standard-performance = {
451
+ dependencies = ["lint_roller" "rubocop-performance"];
452
+ groups = ["default"];
453
+ platforms = [];
454
+ source = {
455
+ remotes = ["https://rubygems.org"];
456
+ sha256 = "1x298w3wmq8cavbsg903wc3arxp3xh2x8263brvy128436m732rd";
457
+ type = "gem";
458
+ };
459
+ version = "1.6.0";
460
+ };
461
+ stringio = {
462
+ groups = ["default"];
463
+ platforms = [];
464
+ source = {
465
+ remotes = ["https://rubygems.org"];
466
+ sha256 = "1j1mgvrgkxhadi6nb6pz1kcff7gsb5aivj1vfhsia4ssa5hj9adw";
467
+ type = "gem";
468
+ };
469
+ version = "3.1.5";
470
+ };
471
+ unicode-display_width = {
472
+ dependencies = ["unicode-emoji"];
473
+ groups = ["default"];
474
+ platforms = [];
475
+ source = {
476
+ remotes = ["https://rubygems.org"];
477
+ sha256 = "1has87asspm6m9wgqas8ghhhwyf2i1yqrqgrkv47xw7jq3qjmbwc";
478
+ type = "gem";
479
+ };
480
+ version = "3.1.4";
481
+ };
482
+ unicode-emoji = {
483
+ groups = ["default"];
484
+ platforms = [];
485
+ source = {
486
+ remotes = ["https://rubygems.org"];
487
+ sha256 = "0ajk6rngypm3chvl6r0vwv36q1931fjqaqhjjya81rakygvlwb1c";
488
+ type = "gem";
489
+ };
490
+ version = "4.0.4";
491
+ };
492
+ vcr = {
493
+ dependencies = ["base64"];
494
+ groups = ["default"];
495
+ platforms = [];
496
+ source = {
497
+ remotes = ["https://rubygems.org"];
498
+ sha256 = "1v83xjgj5y1fzp7nm4s5dixwpy5yr8crklyjyjilc13jgqanxd9p";
499
+ type = "gem";
500
+ };
501
+ version = "6.3.1";
502
+ };
503
+ warning = {
504
+ groups = ["default"];
505
+ platforms = [];
506
+ source = {
507
+ remotes = ["https://rubygems.org"];
508
+ sha256 = "0lwcf7fsz1sda1fdbqq1i4q9kzg4f5vwrzgfg1vpa1hcxagw84hg";
509
+ type = "gem";
510
+ };
511
+ version = "1.5.0";
512
+ };
513
+ webmock = {
514
+ dependencies = ["addressable" "crack" "hashdiff"];
515
+ groups = ["default"];
516
+ platforms = [];
517
+ source = {
518
+ remotes = ["https://rubygems.org"];
519
+ sha256 = "08v374yrqqhjj3xjzmvwnv3yz21r22kn071yr0i67gmwaf9mv7db";
520
+ type = "gem";
521
+ };
522
+ version = "3.25.1";
523
+ };
524
+ }
@@ -0,0 +1,73 @@
1
+ require "json"
2
+ require "net/http"
3
+ require "uri"
4
+ require_relative "version"
5
+
6
+ module Spond
7
+ class Client
8
+ API_URL = "https://api.spond.com/core/v1"
9
+ AUTH_PATH = "/auth2/login"
10
+
11
+ attr_reader :token
12
+
13
+ def initialize(email: nil, password: nil, token: nil)
14
+ @email = email
15
+ @password = password
16
+ @token = token
17
+
18
+ authenticate if @email && @password && !@token
19
+ end
20
+
21
+ def get(endpoint, params: nil)
22
+ request("GET", endpoint, params: params)
23
+ end
24
+
25
+ def post(endpoint, data: nil)
26
+ request("POST", endpoint, data: data)
27
+ end
28
+
29
+ def put(endpoint, data: nil)
30
+ request("PUT", endpoint, data: data)
31
+ end
32
+
33
+ def delete(endpoint)
34
+ request("DELETE", endpoint)
35
+ end
36
+
37
+ private
38
+
39
+ def authenticate
40
+ data = {email: @email, password: @password}
41
+ @token = post(AUTH_PATH, data: data)["accessToken"]["token"]
42
+ end
43
+
44
+ def request(method, endpoint, data: nil, params: nil)
45
+ uri = URI("#{API_URL}#{endpoint}")
46
+ uri.query = URI.encode_www_form(params) if params
47
+
48
+ http = Net::HTTP.new(uri.host, uri.port)
49
+ http.use_ssl = true
50
+
51
+ request_class = case method.downcase
52
+ when "get" then Net::HTTP::Get
53
+ when "post" then Net::HTTP::Post
54
+ when "put" then Net::HTTP::Put
55
+ when "delete" then Net::HTTP::Delete
56
+ else
57
+ raise "Unsupported HTTP method: #{method}"
58
+ end
59
+
60
+ request = request_class.new(uri)
61
+ request["Content-Type"] = "application/json"
62
+ request["Authorization"] = "Bearer #{@token}" if @token
63
+ request["User-Agent"] = "spond-ruby/#{Spond::VERSION}"
64
+ request.body = data.to_json if data
65
+
66
+ response = http.request(request)
67
+
68
+ return JSON.parse(response.body) if response.code == "200"
69
+
70
+ raise "API request failed: #{response.body}"
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,36 @@
1
+ require_relative "resource"
2
+
3
+ module Spond
4
+ class Comment < Resource
5
+ attribute :from_profile_id, key: "fromProfileId"
6
+ attribute :timestamp
7
+ attribute :text
8
+ attribute :children, default: []
9
+ attribute :reactions, default: {}
10
+
11
+ def timestamp_parsed
12
+ @timestamp_parsed ||= Time.parse(@timestamp) if @timestamp
13
+ end
14
+
15
+ def has_reactions?
16
+ @reactions.any?
17
+ end
18
+
19
+ def reaction_count(emoji = nil)
20
+ return @reactions.values.sum { |profiles| profiles.size } unless emoji
21
+ @reactions[emoji]&.size || 0
22
+ end
23
+
24
+ def reaction_emojis
25
+ @reactions.keys
26
+ end
27
+
28
+ def has_children?
29
+ @children.any?
30
+ end
31
+
32
+ def child_comments
33
+ @child_comments ||= @children.map { |child_data| self.class.new(child_data) }
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,45 @@
1
+ require_relative "resource"
2
+
3
+ module Spond
4
+ class Event < Resource
5
+ has_many :comments, "Comment", local: true
6
+
7
+ def self.where(params = {})
8
+ params = {
9
+ includeComments: true,
10
+ addProfileInfo: true,
11
+ order: 'asc'
12
+ }.merge(params)
13
+ response = client.get("/sponds", params: params)
14
+ response.map { |event_data| new(event_data) }
15
+ end
16
+
17
+ def self.before(time, params = {})
18
+ where(**params.merge(maxEndTimestamp: time))
19
+ end
20
+
21
+ def self.past(params = {})
22
+ before(Time.now, params)
23
+ end
24
+
25
+ def self.after(time, params = {})
26
+ where(**params.merge(minStartTimestamp: time))
27
+ end
28
+
29
+ def self.future(params = {})
30
+ after(Time.now, params)
31
+ end
32
+
33
+ def self.for_group(group_id, params = {})
34
+ where(**params.merge(groupId: group_id))
35
+ end
36
+
37
+ def has_comments?
38
+ comments.any?
39
+ end
40
+
41
+ def comment_count
42
+ comments.size
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,12 @@
1
+ require_relative "resource"
2
+
3
+ module Spond
4
+ class Group < Resource
5
+ has_many :events, "Event", scope_method: :for_group
6
+
7
+ def self.all
8
+ response = client.get("/groups")
9
+ response.map { |group_data| new(group_data) }
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,20 @@
1
+ require_relative "resource"
2
+
3
+ module Spond
4
+ class Profile < Resource
5
+ attribute :first_name, key: "firstName"
6
+ attribute :last_name, key: "lastName"
7
+ attribute :primary_email, key: "primaryEmail"
8
+
9
+ def self.get
10
+ response = client.get("/profile")
11
+ new(response)
12
+ end
13
+
14
+ def self.find_by_id(id)
15
+ # This would be used for looking up profiles by ID
16
+ # For now, return nil as we don't have a profiles endpoint
17
+ nil
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,75 @@
1
+ module Spond
2
+ class Resource
3
+ attr_reader :id, :data
4
+
5
+ # Class variable to store defined attributes
6
+ @attributes = []
7
+
8
+ def self.attributes
9
+ @attributes ||= []
10
+ end
11
+
12
+ def self.attribute(name, key: nil, default: nil)
13
+ key ||= name.to_s
14
+ attributes << [name, key, default]
15
+ attr_reader name
16
+ end
17
+
18
+ def self.inherited(subclass)
19
+ super
20
+ subclass.instance_variable_set(:@attributes, [])
21
+ end
22
+
23
+ def self.client
24
+ Spond.client
25
+ end
26
+
27
+ # Helper method for creating scoped associations
28
+ def self.has_many(association_name, class_name, scope_param: nil, scope_method: nil, local: false)
29
+ define_method(association_name) do
30
+ association_class = Object.const_get("Spond::#{class_name}")
31
+ instance_var = "@#{association_name}"
32
+
33
+ return instance_variable_get(instance_var) if instance_variable_defined?(instance_var)
34
+
35
+ result = if local
36
+ # For local associations, parse embedded data
37
+ embedded_data = @data[association_name.to_s] || []
38
+ embedded_data.map { |item_data| association_class.new(item_data) }
39
+ elsif scope_method
40
+ association_class.send(scope_method, @id)
41
+ elsif scope_param
42
+ association_class.all(scope_param => @id)
43
+ else
44
+ association_class.all
45
+ end
46
+
47
+ instance_variable_set(instance_var, result)
48
+ end
49
+ end
50
+
51
+ def initialize(data)
52
+ @data = data
53
+ @id = data["id"]
54
+
55
+ # Set attribute values from data
56
+ self.class.attributes.each do |name, key, default|
57
+ value = @data[key]
58
+ value = default if value.nil? && !default.nil?
59
+ instance_variable_set("@#{name}", value)
60
+ end
61
+ end
62
+
63
+ def method_missing(method_name, *args, &block)
64
+ if @data.key?(method_name.to_s)
65
+ @data[method_name.to_s]
66
+ else
67
+ super
68
+ end
69
+ end
70
+
71
+ def respond_to_missing?(method_name, include_private = false)
72
+ @data.key?(method_name.to_s) || super
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,3 @@
1
+ module Spond
2
+ VERSION = "0.1.0"
3
+ end
data/lib/spond.rb ADDED
@@ -0,0 +1,32 @@
1
+ require_relative "spond/client"
2
+ require_relative "spond/event"
3
+ require_relative "spond/profile"
4
+ require_relative "spond/group"
5
+ require_relative "spond/comment"
6
+ require_relative "spond/version"
7
+
8
+ module Spond
9
+ class Error < StandardError; end
10
+
11
+ @client = nil
12
+
13
+ def self.client
14
+ @client ||= Client.new(
15
+ email: ENV["SPOND_EMAIL"],
16
+ password: ENV["SPOND_PASSWORD"],
17
+ token: ENV["SPOND_TOKEN"]
18
+ )
19
+ end
20
+
21
+ def self.profile
22
+ @profile ||= Profile.get
23
+ end
24
+
25
+ def self.groups
26
+ @groups ||= Group.all
27
+ end
28
+
29
+ def self.events(**args)
30
+ Event.where(**args)
31
+ end
32
+ end
data/sig/spond.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Spond
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spond
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Graeme Porteous
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 1980-01-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Unofficial Ruby client library for the Spond API.
14
+ email:
15
+ - graeme@rgbp.co.uk
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".envrc"
21
+ - ".standard.yml"
22
+ - CHANGELOG.md
23
+ - CODE_OF_CONDUCT.md
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - flake.lock
28
+ - flake.nix
29
+ - gemset.nix
30
+ - lib/spond.rb
31
+ - lib/spond/client.rb
32
+ - lib/spond/comment.rb
33
+ - lib/spond/event.rb
34
+ - lib/spond/group.rb
35
+ - lib/spond/profile.rb
36
+ - lib/spond/resource.rb
37
+ - lib/spond/version.rb
38
+ - sig/spond.rbs
39
+ homepage: https://github.com/gbp/spond-ruby
40
+ licenses:
41
+ - MIT
42
+ metadata:
43
+ homepage_uri: https://github.com/gbp/spond-ruby
44
+ source_code_uri: https://github.com/gbp/spond-ruby
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 3.4.0
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubygems_version: 3.5.22
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: Unofficial Ruby client library for the Spond API.
64
+ test_files: []