aoc_cli 1.0.1 → 1.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ddf7e8e1d35efd516bae0a1a9b4d773a0ff59120f3ae287491668fa81740ffba
4
- data.tar.gz: 7fc18fbfcf0391b6d9b6ed43b6e6f35b372f368c9ffd8f5f23c2f3a305c470d2
3
+ metadata.gz: c2535bd90be617c2f05d9b4542be5119239c8bb0f7e191594560ac5760cc6099
4
+ data.tar.gz: 0dbb1758fdd5656c92fbb5b7907b090a4815b822d9aac48478a22e95229bf50b
5
5
  SHA512:
6
- metadata.gz: 41cb419b34d2d7a385e3c227e11b4f548f834d1f6d14566d11baff340367ff95ed7e87cdf512ae45aa3dc4339b65e9549ff2182960e33d0b26af06a6e36e1f24
7
- data.tar.gz: e32591f10e88ff7aa402ebe0523328af2bc61a8458028ff3c559477ec81aa3ee34944b8cf63156ae8625e9000e4a9716d910c02a59a4010679c524dcf387652b
6
+ metadata.gz: efef56f210de01b2294d1983262f23953a9f366cc234e6930243e15e2630009edbb7770358c2bc8eba9a862f17ab2ff260d549237b8064a724c2b6a836d7fe74
7
+ data.tar.gz: 5cea3ec9890e26be05d2ecadaa0ba186100e5c56f9483dfc862d0ae46601cbb11f6552362d06795df5ae288cc94ca2e282a54aafff88f6dd424b0f1c53208adb
data/Gemfile CHANGED
@@ -7,6 +7,7 @@ gem "rake", "~> 13.0"
7
7
  gem "rspec", "~> 3.0"
8
8
  gem "rubocop", "~> 1.21"
9
9
  gem "rubocop-rspec"
10
+ gem "simplecov"
10
11
  gem "steep"
11
12
  gem "vcr"
12
13
  gem "webmock"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aoc_cli (1.0.1)
4
+ aoc_cli (1.1.1)
5
5
  http
6
6
  kangaru
7
7
  nokogiri
@@ -23,8 +23,8 @@ GEM
23
23
  minitest (>= 5.1)
24
24
  mutex_m
25
25
  tzinfo (~> 2.0)
26
- addressable (2.8.5)
27
- public_suffix (>= 2.0.2, < 6.0)
26
+ addressable (2.8.8)
27
+ public_suffix (>= 2.0.2, < 8.0)
28
28
  ast (2.4.2)
29
29
  base64 (0.2.0)
30
30
  bigdecimal (3.1.5)
@@ -36,25 +36,27 @@ GEM
36
36
  rexml
37
37
  csv (3.2.8)
38
38
  diff-lcs (1.5.0)
39
- domain_name (0.6.20231109)
39
+ docile (1.4.0)
40
+ domain_name (0.6.20240107)
40
41
  drb (2.2.0)
41
42
  ruby2_keywords
42
43
  erb (4.0.3)
43
44
  cgi (>= 0.3.3)
44
45
  factory_bot (6.4.2)
45
46
  activesupport (>= 5.0.0)
46
- ffi (1.16.3)
47
- ffi-compiler (1.0.1)
48
- ffi (>= 1.0.0)
47
+ ffi (1.17.2-arm64-darwin)
48
+ ffi (1.17.2-x86_64-linux-gnu)
49
+ ffi-compiler (1.3.2)
50
+ ffi (>= 1.15.5)
49
51
  rake
50
52
  fileutils (1.7.2)
51
53
  hashdiff (1.0.1)
52
- http (5.1.1)
54
+ http (5.3.1)
53
55
  addressable (~> 2.8)
54
56
  http-cookie (~> 1.0)
55
57
  http-form_data (~> 2.2)
56
- llhttp-ffi (~> 0.4.0)
57
- http-cookie (1.0.5)
58
+ llhttp-ffi (~> 0.5.0)
59
+ http-cookie (1.1.0)
58
60
  domain_name (~> 0.5)
59
61
  http-form_data (2.3.0)
60
62
  i18n (1.14.1)
@@ -70,7 +72,7 @@ GEM
70
72
  listen (3.8.0)
71
73
  rb-fsevent (~> 0.10, >= 0.10.3)
72
74
  rb-inotify (~> 0.9, >= 0.9.10)
73
- llhttp-ffi (0.4.0)
75
+ llhttp-ffi (0.5.1)
74
76
  ffi-compiler (~> 1.0)
75
77
  rake (~> 13.0)
76
78
  logger (1.6.0)
@@ -84,10 +86,10 @@ GEM
84
86
  parser (3.2.2.4)
85
87
  ast (~> 2.4.1)
86
88
  racc
87
- public_suffix (5.0.4)
89
+ public_suffix (7.0.0)
88
90
  racc (1.7.3)
89
91
  rainbow (3.1.1)
90
- rake (13.1.0)
92
+ rake (13.3.1)
91
93
  rb-fsevent (0.11.2)
92
94
  rb-inotify (0.10.1)
93
95
  ffi (~> 1.0)
@@ -138,6 +140,12 @@ GEM
138
140
  bigdecimal
139
141
  sequel_polymorphic (0.5.0)
140
142
  sequel (>= 4.0.0, < 6)
143
+ simplecov (0.22.0)
144
+ docile (~> 1.1)
145
+ simplecov-html (~> 0.11)
146
+ simplecov_json_formatter (~> 0.1)
147
+ simplecov-html (0.12.3)
148
+ simplecov_json_formatter (0.1.4)
141
149
  sqlite3 (1.6.9-arm64-darwin)
142
150
  sqlite3 (1.6.9-x86_64-linux)
143
151
  steep (1.6.0)
@@ -170,6 +178,8 @@ GEM
170
178
 
171
179
  PLATFORMS
172
180
  arm64-darwin-21
181
+ arm64-darwin-23
182
+ arm64-darwin-24
173
183
  x86_64-linux
174
184
 
175
185
  DEPENDENCIES
@@ -179,6 +189,7 @@ DEPENDENCIES
179
189
  rspec (~> 3.0)
180
190
  rubocop (~> 1.21)
181
191
  rubocop-rspec
192
+ simplecov
182
193
  steep
183
194
  vcr
184
195
  webmock
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # `aoc-cli`
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/aoc_cli.svg)](https://badge.fury.io/rb/aoc_cli) ![aoc-ci](https://github.com/apexatoll/aoc-cli/actions/workflows/main.yml/badge.svg) [![codecov](https://codecov.io/gh/apexatoll/aoc-cli/graph/badge.svg?token=7R3GFUAXI5)](https://codecov.io/gh/apexatoll/aoc-cli)
4
+
3
5
  A command-line interface for Advent of Code, built in Ruby.
4
6
 
5
7
  > [!IMPORTANT]
@@ -1,14 +1,11 @@
1
1
  module AocCli
2
2
  module Core
3
3
  class Request
4
- extend Forwardable
5
-
6
- attr_reader :client
7
-
8
- def_delegators :client, :get, :post
4
+ attr_reader :client, :ssl_context
9
5
 
10
6
  def initialize(token:)
11
7
  @client = setup_client!(token)
8
+ @ssl_context = setup_ssl_context!
12
9
  end
13
10
 
14
11
  def self.build
@@ -19,6 +16,14 @@ module AocCli
19
16
  new(token:)
20
17
  end
21
18
 
19
+ def get(url)
20
+ client.get(url, **default_options)
21
+ end
22
+
23
+ def post(url, **options)
24
+ client.post(url, **default_options.merge(options))
25
+ end
26
+
22
27
  class << self
23
28
  extend Forwardable
24
29
 
@@ -32,6 +37,17 @@ module AocCli
32
37
 
33
38
  HTTP.headers(Cookie: cookie)
34
39
  end
40
+
41
+ def setup_ssl_context!
42
+ OpenSSL::SSL::SSLContext.new.tap do |context|
43
+ context.cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths)
44
+ context.cert_store.flags = 0
45
+ end
46
+ end
47
+
48
+ def default_options
49
+ { ssl_context: }
50
+ end
35
51
  end
36
52
  end
37
53
  end
@@ -1,3 +1,3 @@
1
1
  module AocCli
2
- VERSION = "1.0.1".freeze
2
+ VERSION = "1.1.1".freeze
3
3
  end
@@ -4,6 +4,7 @@ module AocCli
4
4
  extend Forwardable
5
5
 
6
6
  attr_reader client: HTTP::Client
7
+ attr_reader ssl_context: OpenSSL::SSL::SSLContext
7
8
 
8
9
  def initialize: (token: String) -> void
9
10
 
@@ -24,6 +25,10 @@ module AocCli
24
25
  private
25
26
 
26
27
  def setup_client!: (String) -> HTTP::Client
28
+
29
+ def setup_ssl_context!: -> OpenSSL::SSL::SSLContext
30
+
31
+ def default_options: -> Hash[Symbol, untyped]
27
32
  end
28
33
  end
29
34
  end
data/sig/http.rbs CHANGED
@@ -1,3 +1,9 @@
1
1
  module HTTP
2
2
  def self.headers: (**untyped) -> Client
3
+
4
+ class Client
5
+ def get: (String, **untyped) -> untyped
6
+
7
+ def post: (String, **untyped) -> untyped
8
+ end
3
9
  end
data/sig/open_ssl.rbs ADDED
@@ -0,0 +1,13 @@
1
+ module OpenSSL
2
+ module SSL
3
+ class SSLContext
4
+ attr_accessor cert_store: untyped
5
+ end
6
+ end
7
+
8
+ module X509
9
+ class Store
10
+ def set_default_paths: -> void
11
+ end
12
+ end
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aoc_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Welham
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-22 00:00:00.000000000 Z
11
+ date: 2025-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -244,6 +244,7 @@ files:
244
244
  - sig/http.rbs
245
245
  - sig/kangaru.rbs
246
246
  - sig/nokogiri.rbs
247
+ - sig/open_ssl.rbs
247
248
  - sig/reverse_markdown.rbs
248
249
  homepage: https://github.com/apexatoll/aoc-cli
249
250
  licenses: