cfc 0.1.4 → 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/lib/cfc/api.rb +2 -0
- data/lib/cfc/cache.rb +2 -3
- data/lib/cfc/errors/http_error.rb +1 -1
- data/lib/cfc/errors/missing_property.rb +1 -1
- data/lib/cfc/objects/api_token_policy.rb +1 -1
- data/lib/cfc/objects/object.rb +4 -4
- data/lib/cfc/version.rb +1 -1
- metadata +7 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f713948b7addf2d4ec79c52821d837796329cd53195fcd36e058bc04c37a5f80
|
4
|
+
data.tar.gz: a1356201e0faaa66e94a9ec4d6c3a5bc730768c9e29f6ebdedea3b0771a04cc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23ab5c9f5840806912b58f84df5d360b0f7f00413c0932cfadf4c65572d0aa1b605a7e1d5f70709c986aa7a5ceb2e8540cd84d38c2dcaddfeee2e046c8e139a6
|
7
|
+
data.tar.gz: 611bb4111c31aed2a9c1cdefb682ccf5424dc80226cb6ca8f833a19d6a2b9be874a8f9ea1bcbc5b5c196a8e38e4c66ce766363353cd22bc13efe917eb8992890
|
data/lib/cfc/api.rb
CHANGED
@@ -56,6 +56,8 @@ module CFC
|
|
56
56
|
'X-Auth-Key' => CFC::Config.instance.api_key,
|
57
57
|
'X-Auth-Email' => CFC::Config.instance.api_email
|
58
58
|
})
|
59
|
+
else
|
60
|
+
raise CFC::Errors::ConfigurationError, 'Incorrect configuration parameters to set auth method'
|
59
61
|
end
|
60
62
|
|
61
63
|
rq = cls.new(uri, headers)
|
data/lib/cfc/cache.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'ostruct'
|
2
1
|
require 'date'
|
3
2
|
|
4
3
|
module CFC
|
@@ -16,11 +15,11 @@ module CFC
|
|
16
15
|
end
|
17
16
|
|
18
17
|
def []=(key, value)
|
19
|
-
@cache[key] =
|
18
|
+
@cache[key] = { data: value, expiry: nil }
|
20
19
|
end
|
21
20
|
|
22
21
|
def write(key, value, expiry: nil)
|
23
|
-
@cache[key] =
|
22
|
+
@cache[key] = { data: value, expiry: expiry }
|
24
23
|
end
|
25
24
|
|
26
25
|
def read(key)
|
@@ -3,7 +3,7 @@ module CFC
|
|
3
3
|
class MissingProperty < StandardError
|
4
4
|
def self.default_message(obj, property)
|
5
5
|
"This #{obj.class.name} does not have a `#{property}' property. If you are accessing this object from a " \
|
6
|
-
|
6
|
+
'relationship on another object, the property may not have been fetched.'
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -9,7 +9,7 @@ module CFC
|
|
9
9
|
def self.build(effect:, resources:, permission_groups:)
|
10
10
|
new(JSON.parse(JSON.dump({
|
11
11
|
effect: effect,
|
12
|
-
resources: resources&.
|
12
|
+
resources: resources&.transform_keys(&:to_json),
|
13
13
|
permission_groups: permission_groups
|
14
14
|
}.compact)))
|
15
15
|
end
|
data/lib/cfc/objects/object.rb
CHANGED
@@ -40,8 +40,8 @@ module CFC
|
|
40
40
|
|
41
41
|
alias as_json to_h
|
42
42
|
|
43
|
-
def to_json(*
|
44
|
-
as_json.to_json(*
|
43
|
+
def to_json(*)
|
44
|
+
as_json.to_json(*)
|
45
45
|
end
|
46
46
|
|
47
47
|
def self.relationship(property, cls, multiple: false)
|
@@ -52,9 +52,9 @@ module CFC
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def self.opts(bind)
|
55
|
-
bind.local_variables.
|
55
|
+
bind.local_variables.to_h do |var|
|
56
56
|
[var, bind.local_variable_get(var)]
|
57
|
-
end
|
57
|
+
end
|
58
58
|
end
|
59
59
|
|
60
60
|
private
|
data/lib/cfc/version.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Codidact Foundation
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
12
|
description: 'Simple API library for interacting with the Cloudflare API. See GitHub
|
14
13
|
for usage details: https://github.com/codidact/cfc'
|
15
|
-
email:
|
14
|
+
email: info@codidact.org
|
16
15
|
executables: []
|
17
16
|
extensions: []
|
18
17
|
extra_rdoc_files: []
|
@@ -38,8 +37,8 @@ files:
|
|
38
37
|
homepage: https://github.com/codidact/cfc
|
39
38
|
licenses:
|
40
39
|
- MIT
|
41
|
-
metadata:
|
42
|
-
|
40
|
+
metadata:
|
41
|
+
rubygems_mfa_required: 'true'
|
43
42
|
rdoc_options: []
|
44
43
|
require_paths:
|
45
44
|
- lib
|
@@ -47,15 +46,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
47
46
|
requirements:
|
48
47
|
- - ">="
|
49
48
|
- !ruby/object:Gem::Version
|
50
|
-
version: 2
|
49
|
+
version: '3.2'
|
51
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
51
|
requirements:
|
53
52
|
- - ">="
|
54
53
|
- !ruby/object:Gem::Version
|
55
54
|
version: '0'
|
56
55
|
requirements: []
|
57
|
-
rubygems_version: 3.
|
58
|
-
signing_key:
|
56
|
+
rubygems_version: 3.7.1
|
59
57
|
specification_version: 4
|
60
58
|
summary: Simple API library for interacting with the Cloudflare API.
|
61
59
|
test_files: []
|