Skip to content

Commit e5d303a

Browse files
authored
Merge pull request #2 from codidact/art/v0.2.0
v0.2.0
2 parents 33fee06 + ed2d62e commit e5d303a

File tree

13 files changed

+69
-104
lines changed

13 files changed

+69
-104
lines changed

.circleci/config.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
rubocop:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Setup Ruby
14+
uses: ruby/setup-ruby@v1
15+
with:
16+
ruby-version: 3.2
17+
bundler-cache: true
18+
- run: bundle exec rubocop

.rubocop.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# This file is maintained in alphabetic order by class name (Layout, Metrics, Style) first, then by key name.
22

33
AllCops:
4-
TargetRubyVersion: 2.4
4+
TargetRubyVersion: 3.2
55
Exclude:
66
- 'config/**/*'
77
- 'db/**/*'
88
- 'scripts/**/*'
99
- 'bin/**/*'
10+
- 'vendor/**/*'
1011
NewCops: enable
1112
SuggestExtensions: false
1213

Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
source 'https://rubygems.org'
22

3+
ruby '>=3'
4+
35
gemspec
46

5-
gem 'rubocop', '~> 1.5'
7+
gem 'rubocop', '~> 1.78'

Gemfile.lock

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,51 @@
11
PATH
22
remote: .
33
specs:
4-
cfc (0.1.4)
4+
cfc (0.2.0)
55

66
GEM
77
remote: https://rubygems.org/
88
specs:
9-
ast (2.4.1)
10-
parallel (1.20.1)
11-
parser (2.7.2.0)
9+
ast (2.4.3)
10+
json (2.12.2)
11+
language_server-protocol (3.17.0.5)
12+
lint_roller (1.1.0)
13+
parallel (1.27.0)
14+
parser (3.3.8.0)
1215
ast (~> 2.4.1)
13-
rainbow (3.0.0)
14-
regexp_parser (2.0.0)
15-
rexml (3.2.5)
16-
rubocop (1.5.2)
16+
racc
17+
prism (1.4.0)
18+
racc (1.8.1)
19+
rainbow (3.1.1)
20+
regexp_parser (2.10.0)
21+
rubocop (1.78.0)
22+
json (~> 2.3)
23+
language_server-protocol (~> 3.17.0.2)
24+
lint_roller (~> 1.1.0)
1725
parallel (~> 1.10)
18-
parser (>= 2.7.1.5)
26+
parser (>= 3.3.0.2)
1927
rainbow (>= 2.2.2, < 4.0)
20-
regexp_parser (>= 1.8, < 3.0)
21-
rexml
22-
rubocop-ast (>= 1.2.0, < 2.0)
28+
regexp_parser (>= 2.9.3, < 3.0)
29+
rubocop-ast (>= 1.45.1, < 2.0)
2330
ruby-progressbar (~> 1.7)
24-
unicode-display_width (>= 1.4.0, < 2.0)
25-
rubocop-ast (1.3.0)
26-
parser (>= 2.7.1.5)
27-
ruby-progressbar (1.10.1)
28-
unicode-display_width (1.7.0)
31+
unicode-display_width (>= 2.4.0, < 4.0)
32+
rubocop-ast (1.45.1)
33+
parser (>= 3.3.7.2)
34+
prism (~> 1.4)
35+
ruby-progressbar (1.13.0)
36+
unicode-display_width (3.1.4)
37+
unicode-emoji (~> 4.0, >= 4.0.4)
38+
unicode-emoji (4.0.4)
2939

3040
PLATFORMS
3141
x86_64-linux
3242

3343
DEPENDENCIES
3444
cfc!
35-
rubocop (~> 1.5)
45+
rubocop (~> 1.78)
46+
47+
RUBY VERSION
48+
ruby 3.2.0p0
3649

3750
BUNDLED WITH
3851
2.2.3

cfc.gemspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ Gem::Specification.new do |s|
88
s.description = 'Simple API library for interacting with the Cloudflare API. See GitHub for usage details: ' \
99
'https://github.com/codidact/cfc'
1010
s.authors = ['The Codidact Foundation']
11-
s.email = 'gems@codidact.org'
11+
s.email = 'info@codidact.org'
1212
s.homepage = 'https://github.com/codidact/cfc'
1313
s.files = Dir['{lib}/**/*', 'LICENSE', 'README.md']
1414
s.require_paths = ['lib']
15-
s.required_ruby_version = '>= 2.4.0'
15+
s.required_ruby_version = '>=3.2'
16+
s.metadata['rubygems_mfa_required'] = 'true'
1617
end

lib/cfc/api.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def request(cls, uri, data: nil, headers: nil, cache: true, expiry: nil)
5656
'X-Auth-Key' => CFC::Config.instance.api_key,
5757
'X-Auth-Email' => CFC::Config.instance.api_email
5858
})
59+
else
60+
raise CFC::Errors::ConfigurationError, 'Incorrect configuration parameters to set auth method'
5961
end
6062

6163
rq = cls.new(uri, headers)

lib/cfc/cache.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require 'ostruct'
21
require 'date'
32

43
module CFC
@@ -16,11 +15,11 @@ def [](key)
1615
end
1716

1817
def []=(key, value)
19-
@cache[key] = OpenStruct.new(data: value, expiry: nil)
18+
@cache[key] = { data: value, expiry: nil }
2019
end
2120

2221
def write(key, value, expiry: nil)
23-
@cache[key] = OpenStruct.new(data: value, expiry: expiry)
22+
@cache[key] = { data: value, expiry: expiry }
2423
end
2524

2625
def read(key)

lib/cfc/errors/http_error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class HTTPError < StandardError
66
attr_reader :request, :response
77

88
def initialize(request, response)
9-
super "Cloudflare API request returned HTTP #{response.code}"
9+
super("Cloudflare API request returned HTTP #{response.code}")
1010
@request = request
1111
@response = response
1212
end

lib/cfc/errors/missing_property.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Errors
33
class MissingProperty < StandardError
44
def self.default_message(obj, property)
55
"This #{obj.class.name} does not have a `#{property}' property. If you are accessing this object from a " \
6-
'relationship on another object, the property may not have been fetched.'
6+
'relationship on another object, the property may not have been fetched.'
77
end
88
end
99
end

0 commit comments

Comments
 (0)