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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f5f2aefe1d6f36747241422a791bfa619b4d6dc53b9ef5e93a191b3162eed1a
4
- data.tar.gz: 3a0d745cdc585a8290ab9bd0623299968e70fc344a638586115bc16cc35008ad
3
+ metadata.gz: f713948b7addf2d4ec79c52821d837796329cd53195fcd36e058bc04c37a5f80
4
+ data.tar.gz: a1356201e0faaa66e94a9ec4d6c3a5bc730768c9e29f6ebdedea3b0771a04cc5
5
5
  SHA512:
6
- metadata.gz: e0d898e56d580631ab901c37453419d54d7a079378932af2518220294769122f3803d0db4b65b90f99fc1671294edc0973fcf244aee7c854be62ec5a4d37ba21
7
- data.tar.gz: 66859b84c931ec9519afe931edb9ec48662607c886a030151dbc82f633056245b5a269a7e7c861745fdca1733da86e21d62bca7fa8ff07e177a2e96aeb9bad01
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] = OpenStruct.new(data: value, expiry: nil)
18
+ @cache[key] = { data: value, expiry: nil }
20
19
  end
21
20
 
22
21
  def write(key, value, expiry: nil)
23
- @cache[key] = OpenStruct.new(data: value, expiry: expiry)
22
+ @cache[key] = { data: value, expiry: expiry }
24
23
  end
25
24
 
26
25
  def read(key)
@@ -6,7 +6,7 @@ module CFC
6
6
  attr_reader :request, :response
7
7
 
8
8
  def initialize(request, response)
9
- super "Cloudflare API request returned HTTP #{response.code}"
9
+ super("Cloudflare API request returned HTTP #{response.code}")
10
10
  @request = request
11
11
  @response = response
12
12
  end
@@ -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
- 'relationship on another object, the property may not have been fetched.'
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&.map { |k, v| [k.to_json, v] }&.to_h,
12
+ resources: resources&.transform_keys(&:to_json),
13
13
  permission_groups: permission_groups
14
14
  }.compact)))
15
15
  end
@@ -40,8 +40,8 @@ module CFC
40
40
 
41
41
  alias as_json to_h
42
42
 
43
- def to_json(*args)
44
- as_json.to_json(*args)
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.map do |var|
55
+ bind.local_variables.to_h do |var|
56
56
  [var, bind.local_variable_get(var)]
57
- end.to_h
57
+ end
58
58
  end
59
59
 
60
60
  private
data/lib/cfc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CFC
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
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.1.4
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: 2021-01-07 00:00:00.000000000 Z
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: gems@codidact.org
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
- post_install_message:
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.4.0
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.0.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: []