foobara-ruby-gems-api 0.0.1 → 0.0.3
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 +4 -4
- data/CHANGELOG.md +11 -1
- data/lib/foobara/ruby_gems_api.rb +1 -0
- data/src/foobara/ruby_gems_api/get_owners.rb +2 -52
- data/src/foobara/ruby_gems_api/get_versions.rb +2 -52
- data/src/foobara/ruby_gems_api/search.rb +2 -41
- metadata +18 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14d3596c7bb9190012461d5d2d764df01d280c7f21bfc35eb23c2132b9c36bf2
|
4
|
+
data.tar.gz: 3b3d53e30514e7115a7a6f434f626688fe7620c8cbdb7c5b893d0efd9667110b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0440c20ea8368f9e5d75390e09ead41635d7506a3480383f92bafcc1ccfb5e2382938c9b80a4199f6cccd245985d83cff69f10a1f00b53362e1c23be24315c21
|
7
|
+
data.tar.gz: 14c147553b9f3d6c8819d80238ff6d56aafe21d49564fecc607cf79dc24987c43621861f91313ae42f9737f37ea34a89668a0be7843baf69c26b03eb04e65ffe
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
|
-
## [
|
1
|
+
## [0.0.3] - 2025-03-20
|
2
|
+
|
3
|
+
- Bump Ruby and gems and deal with breakages/deprecations
|
4
|
+
|
5
|
+
## [0.0.2] - 2025-01-07
|
6
|
+
|
7
|
+
- Bump Ruby to 3.4.1
|
2
8
|
|
3
9
|
## [0.0.1] - 2024-11-08
|
4
10
|
|
5
11
|
- Initial release
|
12
|
+
|
13
|
+
## [0.0.0] - 2024-11-04
|
14
|
+
|
15
|
+
- Project birth
|
@@ -1,65 +1,15 @@
|
|
1
|
-
require "uri"
|
2
|
-
require "net/http"
|
3
|
-
|
4
1
|
module Foobara
|
5
2
|
module RubyGemsApi
|
6
3
|
class GetOwners < Foobara::Command
|
7
|
-
API_URL = ->(gem_name) { "https://rubygems.org/api/v1/gems/#{gem_name}/owners.json" }
|
8
|
-
|
9
4
|
inputs do
|
10
5
|
gem_name :string, :required
|
11
6
|
end
|
12
7
|
|
13
8
|
result [User]
|
14
9
|
|
15
|
-
|
16
|
-
build_request_body
|
17
|
-
build_request_headers
|
18
|
-
issue_http_request
|
19
|
-
parse_response
|
20
|
-
build_gems
|
21
|
-
|
22
|
-
gems
|
23
|
-
end
|
24
|
-
|
25
|
-
attr_accessor :request_body, :request_headers, :response, :response_body, :gems
|
26
|
-
|
27
|
-
def build_request_body
|
28
|
-
self.request_body = {}
|
29
|
-
end
|
30
|
-
|
31
|
-
def build_request_headers
|
32
|
-
self.request_headers = {
|
33
|
-
"Content-Type" => "application/json"
|
34
|
-
}
|
35
|
-
end
|
10
|
+
include HttpApiCommand
|
36
11
|
|
37
|
-
|
38
|
-
API_URL.call(gem_name)
|
39
|
-
end
|
40
|
-
|
41
|
-
def issue_http_request
|
42
|
-
uri = URI(url)
|
43
|
-
uri.query = URI.encode_www_form(request_body)
|
44
|
-
self.response = Net::HTTP.get_response(uri, request_headers)
|
45
|
-
end
|
46
|
-
|
47
|
-
def parse_response
|
48
|
-
json = if response.is_a?(Net::HTTPSuccess)
|
49
|
-
response.body
|
50
|
-
else
|
51
|
-
# :nocov:
|
52
|
-
raise "Could not successfully hit #{url}: " \
|
53
|
-
"#{response.code} #{response.message}"
|
54
|
-
# :nocov:
|
55
|
-
end
|
56
|
-
|
57
|
-
self.response_body = JSON.parse(json)
|
58
|
-
end
|
59
|
-
|
60
|
-
def build_gems
|
61
|
-
self.gems = response_body
|
62
|
-
end
|
12
|
+
url { "https://rubygems.org/api/v1/gems/#{gem_name}/owners.json" }
|
63
13
|
end
|
64
14
|
end
|
65
15
|
end
|
@@ -1,65 +1,15 @@
|
|
1
|
-
require "uri"
|
2
|
-
require "net/http"
|
3
|
-
|
4
1
|
module Foobara
|
5
2
|
module RubyGemsApi
|
6
3
|
class GetVersions < Foobara::Command
|
7
|
-
API_URL = ->(gem_name) { "https://rubygems.org/api/v1/versions/#{gem_name}.json" }
|
8
|
-
|
9
4
|
inputs do
|
10
5
|
gem_name :string, :required
|
11
6
|
end
|
12
7
|
|
13
8
|
result [Version]
|
14
9
|
|
15
|
-
|
16
|
-
build_request_body
|
17
|
-
build_request_headers
|
18
|
-
issue_http_request
|
19
|
-
parse_response
|
20
|
-
build_versions
|
21
|
-
|
22
|
-
versions
|
23
|
-
end
|
24
|
-
|
25
|
-
attr_accessor :request_body, :request_headers, :response, :response_body, :versions
|
26
|
-
|
27
|
-
def build_request_body
|
28
|
-
self.request_body = {}
|
29
|
-
end
|
30
|
-
|
31
|
-
def build_request_headers
|
32
|
-
self.request_headers = {
|
33
|
-
"Content-Type" => "application/json"
|
34
|
-
}
|
35
|
-
end
|
10
|
+
include HttpApiCommand
|
36
11
|
|
37
|
-
|
38
|
-
API_URL.call(gem_name)
|
39
|
-
end
|
40
|
-
|
41
|
-
def issue_http_request
|
42
|
-
uri = URI(url)
|
43
|
-
uri.query = URI.encode_www_form(request_body)
|
44
|
-
self.response = Net::HTTP.get_response(uri, request_headers)
|
45
|
-
end
|
46
|
-
|
47
|
-
def parse_response
|
48
|
-
json = if response.is_a?(Net::HTTPSuccess)
|
49
|
-
response.body
|
50
|
-
else
|
51
|
-
# :nocov:
|
52
|
-
raise "Could not successfully hit #{url}: " \
|
53
|
-
"#{response.code} #{response.message}"
|
54
|
-
# :nocov:
|
55
|
-
end
|
56
|
-
|
57
|
-
self.response_body = JSON.parse(json)
|
58
|
-
end
|
59
|
-
|
60
|
-
def build_versions
|
61
|
-
self.versions = response_body
|
62
|
-
end
|
12
|
+
url { "https://rubygems.org/api/v1/versions/#{gem_name}.json" }
|
63
13
|
end
|
64
14
|
end
|
65
15
|
end
|
@@ -4,58 +4,19 @@ require "net/http"
|
|
4
4
|
module Foobara
|
5
5
|
module RubyGemsApi
|
6
6
|
class Search < Foobara::Command
|
7
|
-
API_URL = "https://rubygems.org/api/v1/search.json".freeze
|
8
|
-
|
9
7
|
inputs do
|
10
8
|
query :string, :required
|
11
9
|
end
|
12
10
|
|
13
11
|
result [Gem]
|
14
12
|
|
15
|
-
|
16
|
-
build_request_body
|
17
|
-
build_request_headers
|
18
|
-
issue_http_request
|
19
|
-
parse_response
|
20
|
-
build_gems
|
21
|
-
|
22
|
-
gems
|
23
|
-
end
|
13
|
+
include HttpApiCommand
|
24
14
|
|
25
|
-
|
15
|
+
url "https://rubygems.org/api/v1/search.json"
|
26
16
|
|
27
17
|
def build_request_body
|
28
18
|
self.request_body = { query: }
|
29
19
|
end
|
30
|
-
|
31
|
-
def build_request_headers
|
32
|
-
self.request_headers = {
|
33
|
-
"Content-Type" => "application/json"
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
|
-
def issue_http_request
|
38
|
-
uri = URI(API_URL)
|
39
|
-
uri.query = URI.encode_www_form(request_body)
|
40
|
-
self.response = Net::HTTP.get_response(uri, request_headers)
|
41
|
-
end
|
42
|
-
|
43
|
-
def parse_response
|
44
|
-
json = if response.is_a?(Net::HTTPSuccess)
|
45
|
-
response.body
|
46
|
-
else
|
47
|
-
# :nocov:
|
48
|
-
raise "Could not successfully hit #{API_URL}: " \
|
49
|
-
"#{response.code} #{response.message}"
|
50
|
-
# :nocov:
|
51
|
-
end
|
52
|
-
|
53
|
-
self.response_body = JSON.parse(json)
|
54
|
-
end
|
55
|
-
|
56
|
-
def build_gems
|
57
|
-
self.gems = response_body
|
58
|
-
end
|
59
20
|
end
|
60
21
|
end
|
61
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara-ruby-gems-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-03-21 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: foobara
|
@@ -24,7 +23,20 @@ dependencies:
|
|
24
23
|
- - ">="
|
25
24
|
- !ruby/object:Gem::Version
|
26
25
|
version: '0'
|
27
|
-
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: foobara-http-api-command
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
28
40
|
email:
|
29
41
|
- azimux@gmail.com
|
30
42
|
executables: []
|
@@ -50,7 +62,6 @@ metadata:
|
|
50
62
|
source_code_uri: https://github.com/foobara/ruby-gems-api
|
51
63
|
changelog_uri: https://github.com/foobara/ruby-gems-api/blob/main/CHANGELOG.md
|
52
64
|
rubygems_mfa_required: 'true'
|
53
|
-
post_install_message:
|
54
65
|
rdoc_options: []
|
55
66
|
require_paths:
|
56
67
|
- lib
|
@@ -58,15 +69,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
58
69
|
requirements:
|
59
70
|
- - ">="
|
60
71
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.
|
72
|
+
version: 3.4.0
|
62
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
74
|
requirements:
|
64
75
|
- - ">="
|
65
76
|
- !ruby/object:Gem::Version
|
66
77
|
version: '0'
|
67
78
|
requirements: []
|
68
|
-
rubygems_version: 3.
|
69
|
-
signing_key:
|
79
|
+
rubygems_version: 3.6.6
|
70
80
|
specification_version: 4
|
71
81
|
summary: No description. Add one.
|
72
82
|
test_files: []
|