bullet_proof_json 0.1.0 → 0.2.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 +4 -4
- data/.github/workflows/ruby.yml +30 -0
- data/.gitignore +5 -2
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +15 -15
- data/LICENSE.txt +21 -0
- data/README.md +4 -1
- data/SECURITY.md +5 -0
- data/bullet_proof_json.gemspec +1 -1
- data/lib/bullet_proof_json/provider.rb +6 -0
- data/lib/bullet_proof_json/version.rb +1 -1
- metadata +8 -5
- data/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9c0c79c825a90b0290e857a654e63d0350391d144720961d64868390e19f159
|
4
|
+
data.tar.gz: e6e7ec7b451698de9830dab8b1fd4c6aadb73f5ea73071d328bd845cf4ce8ab8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 961a00e44136eb071a906918568c99be58c65ae107d186db8345627cb52dd83fa839d4273adec591f2a8a412066a84fb516171f4ff2c564274eb17cd4315692c
|
7
|
+
data.tar.gz: 70e27d6f1cd12579ba8ee98a1757959569b2f39294c7de823f74c3dda4b896f467dfb7240580bf1fbfb14ffc36257f4b7bd1f4cf5c85bfc4ead503286c37c92e
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: Ruby RSpec Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- main
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
test:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- name: Checkout repository
|
17
|
+
uses: actions/checkout@v3
|
18
|
+
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: '3.3'
|
23
|
+
|
24
|
+
- name: Install dependencies
|
25
|
+
run: |
|
26
|
+
gem install bundler
|
27
|
+
bundle install
|
28
|
+
|
29
|
+
- name: Run RSpec tests
|
30
|
+
run: bundle exec rspec
|
data/.gitignore
CHANGED
@@ -46,11 +46,14 @@ build-iPhoneSimulator/
|
|
46
46
|
# for a library or gem, you might want to ignore these files since the code is
|
47
47
|
# intended to run in multiple environments; otherwise, check them in:
|
48
48
|
# Gemfile.lock
|
49
|
-
|
49
|
+
.ruby-version
|
50
50
|
# .ruby-gemset
|
51
51
|
|
52
52
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
53
|
.rvmrc
|
54
54
|
|
55
55
|
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
56
|
-
# .rubocop-https?--*
|
56
|
+
# .rubocop-https?--*
|
57
|
+
|
58
|
+
# .DS_Store
|
59
|
+
.DS_Store
|
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bullet_proof_json (0.
|
4
|
+
bullet_proof_json (0.2.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
coderay (1.1.3)
|
10
|
-
diff-lcs (1.
|
11
|
-
ffi (1.17.
|
12
|
-
formatador (1.1.
|
10
|
+
diff-lcs (1.6.2)
|
11
|
+
ffi (1.17.2)
|
12
|
+
formatador (1.1.1)
|
13
13
|
guard (2.19.1)
|
14
14
|
formatador (>= 0.2.4)
|
15
15
|
listen (>= 2.7, < 4.0)
|
@@ -29,36 +29,36 @@ GEM
|
|
29
29
|
listen (3.9.0)
|
30
30
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
31
31
|
rb-inotify (~> 0.9, >= 0.9.10)
|
32
|
-
logger (1.
|
33
|
-
lumberjack (1.
|
32
|
+
logger (1.7.0)
|
33
|
+
lumberjack (1.3.1)
|
34
34
|
method_source (1.1.0)
|
35
35
|
nenv (0.3.0)
|
36
36
|
notiffany (0.1.3)
|
37
37
|
nenv (~> 0.1)
|
38
38
|
shellany (~> 0.0)
|
39
|
-
ostruct (0.6.
|
39
|
+
ostruct (0.6.3)
|
40
40
|
pry (0.15.2)
|
41
41
|
coderay (~> 1.1)
|
42
42
|
method_source (~> 1.0)
|
43
|
-
rake (
|
43
|
+
rake (12.3.3)
|
44
44
|
rb-fsevent (0.11.2)
|
45
45
|
rb-inotify (0.11.1)
|
46
46
|
ffi (~> 1.0)
|
47
|
-
rspec (3.13.
|
47
|
+
rspec (3.13.1)
|
48
48
|
rspec-core (~> 3.13.0)
|
49
49
|
rspec-expectations (~> 3.13.0)
|
50
50
|
rspec-mocks (~> 3.13.0)
|
51
|
-
rspec-core (3.13.
|
51
|
+
rspec-core (3.13.5)
|
52
52
|
rspec-support (~> 3.13.0)
|
53
|
-
rspec-expectations (3.13.
|
53
|
+
rspec-expectations (3.13.5)
|
54
54
|
diff-lcs (>= 1.2.0, < 2.0)
|
55
55
|
rspec-support (~> 3.13.0)
|
56
|
-
rspec-mocks (3.13.
|
56
|
+
rspec-mocks (3.13.5)
|
57
57
|
diff-lcs (>= 1.2.0, < 2.0)
|
58
58
|
rspec-support (~> 3.13.0)
|
59
|
-
rspec-support (3.13.
|
59
|
+
rspec-support (3.13.4)
|
60
60
|
shellany (0.0.1)
|
61
|
-
thor (1.
|
61
|
+
thor (1.4.0)
|
62
62
|
|
63
63
|
PLATFORMS
|
64
64
|
ruby
|
@@ -69,7 +69,7 @@ DEPENDENCIES
|
|
69
69
|
guard (~> 2.19.1)
|
70
70
|
guard-rspec (~> 4.7.3)
|
71
71
|
pry (~> 0.15.2)
|
72
|
-
rake (~>
|
72
|
+
rake (~> 12.3)
|
73
73
|
rspec (~> 3.0)
|
74
74
|
|
75
75
|
BUNDLED WITH
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 Grzegorz Błaszczyk
|
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
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
[](https://github.com/grzegorzblaszczyk/bullet-proof-json/actions/workflows/ruby.yml)
|
2
|
+
[](https://github.com/grzegorzblaszczyk/bullet-proof-json/actions/workflows/dependabot/dependabot-updates)
|
3
|
+
|
4
|
+
# The Goal
|
2
5
|
|
3
6
|
Tired of dealing with unreliable REST APIs with JSON responses, endless timeouts, and complex error handling just to fetch some JSON data?
|
4
7
|
|
data/SECURITY.md
ADDED
data/bullet_proof_json.gemspec
CHANGED
@@ -29,6 +29,6 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency "guard", "~> 2.19.1"
|
30
30
|
spec.add_development_dependency "guard-rspec", "~> 4.7.3"
|
31
31
|
spec.add_development_dependency "pry", "~> 0.15.2"
|
32
|
-
spec.add_development_dependency "rake", "~>
|
32
|
+
spec.add_development_dependency "rake", "~> 12.3"
|
33
33
|
spec.add_development_dependency "rspec", "~> 3.0"
|
34
34
|
end
|
@@ -23,6 +23,7 @@ module BulletProofJson
|
|
23
23
|
uri = URI(uri_string)
|
24
24
|
http_headers = {}
|
25
25
|
http_headers["Authorization"] = "Bearer #{@api_key}" unless @api_key.nil?
|
26
|
+
http_headers["User-Agent"] = user_agent
|
26
27
|
response = ::Net::HTTP.get(uri, http_headers)
|
27
28
|
json = JSON(response)
|
28
29
|
|
@@ -63,6 +64,11 @@ module BulletProofJson
|
|
63
64
|
json
|
64
65
|
end
|
65
66
|
|
67
|
+
private
|
68
|
+
def user_agent(version = BulletProofJson::VERSION)
|
69
|
+
"bullet-proof-json #{version} - https://github.com/grzegorzblaszczyk/bullet-proof-json"
|
70
|
+
end
|
71
|
+
|
66
72
|
end
|
67
73
|
|
68
74
|
class ProviderError < ::StandardError
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_proof_json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grzegorz Błaszczyk
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-07-22 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bundler
|
@@ -71,14 +71,14 @@ dependencies:
|
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '12.3'
|
75
75
|
type: :development
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
81
|
+
version: '12.3'
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: rspec
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,16 +104,19 @@ executables: []
|
|
104
104
|
extensions: []
|
105
105
|
extra_rdoc_files: []
|
106
106
|
files:
|
107
|
-
- ".
|
107
|
+
- ".github/workflows/ruby.yml"
|
108
108
|
- ".gitignore"
|
109
109
|
- ".ruby-version"
|
110
|
+
- CHANGELOG.md
|
110
111
|
- CODE_OF_CONDUCT.md
|
111
112
|
- Gemfile
|
112
113
|
- Gemfile.lock
|
113
114
|
- Guardfile
|
114
115
|
- LICENSE
|
116
|
+
- LICENSE.txt
|
115
117
|
- README.md
|
116
118
|
- Rakefile
|
119
|
+
- SECURITY.md
|
117
120
|
- bin/console
|
118
121
|
- bin/setup
|
119
122
|
- bullet_proof_json.gemspec
|
data/.DS_Store
DELETED
Binary file
|