cloudflare 4.3.0 → 4.5.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.
@@ -1,26 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2012, by Marcin Prokop.
4
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2014-2016, by Marcin Prokop.
5
+ # Copyright, 2014-2024, by Samuel Williams.
6
+ # Copyright, 2015, by Kyle Corbitt.
7
+ # Copyright, 2018, by Leonhardt Wille.
8
+ # Copyright, 2018, by Casey Lopez.
23
9
 
24
10
  module Cloudflare
25
- VERSION = '4.3.0'
11
+ VERSION = "4.5.0"
26
12
  end
@@ -1,65 +1,64 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2012, by Marcin Prokop.
4
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
5
- # Copyright, 2017, by David Rosenbloom. <http://artifactory.com>
6
- #
7
- # Permission is hereby granted, free of charge, to any person obtaining a copy
8
- # of this software and associated documentation files (the "Software"), to deal
9
- # in the Software without restriction, including without limitation the rights
10
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- # copies of the Software, and to permit persons to whom the Software is
12
- # furnished to do so, subject to the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be included in
15
- # all copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2017-2024, by Samuel Williams.
5
+ # Copyright, 2017, by Denis Sadomowski.
6
+ # Copyright, 2017, by 莫粒.
7
+ # Copyright, 2018, by Leonhardt Wille.
8
+ # Copyright, 2018, by Michael Kalygin.
9
+ # Copyright, 2018, by Sherman Koa.
10
+ # Copyright, 2018, by Kugayama Nana.
11
+ # Copyright, 2018, by Casey Lopez.
12
+ # Copyright, 2019, by Akinori Musha.
13
+ # Copyright, 2019, by Rob Widmer.
14
+ # Copyright, 2025, by Travis Skindzier.
24
15
 
25
- require_relative 'representation'
26
- require_relative 'paginate'
16
+ require_relative "representation"
17
+ require_relative "paginate"
27
18
 
28
- require_relative 'custom_hostnames'
29
- require_relative 'firewall'
30
- require_relative 'dns'
31
- require_relative 'logs'
19
+ require_relative "custom_hostnames"
20
+ require_relative "firewall"
21
+ require_relative "dns"
22
+ require_relative "logs"
32
23
 
33
24
  module Cloudflare
34
25
  class Zone < Representation
26
+ include Async::REST::Representation::Mutable
27
+
35
28
  def custom_hostnames
36
- self.with(CustomHostnames, path: 'custom_hostnames')
29
+ self.with(CustomHostnames, path: "custom_hostnames")
37
30
  end
38
-
31
+
39
32
  def dns_records
40
- self.with(DNS::Records, path: 'dns_records')
33
+ self.with(DNS::Records, path: "dns_records")
41
34
  end
42
35
 
43
36
  def firewall_rules
44
- self.with(Firewall::Rules, path: 'firewall/access_rules/rules')
37
+ self.with(Firewall::Rules, path: "firewall/access_rules/rules")
45
38
  end
46
39
 
47
40
  def logs
48
- self.with(Logs::Received, path: 'logs/received')
41
+ self.with(Logs::Received, path: "logs/received")
49
42
  end
50
43
 
51
- DEFAULT_PURGE_CACHE_PARAMS = {
44
+ DEFAULT_PURGE_CACHE_PARAMETERS = {
52
45
  purge_everything: true
53
46
  }.freeze
54
47
 
55
- def purge_cache(parameters = DEFAULT_PURGE_CACHE_PARAMS)
56
- self.with(Zone, path: 'purge_cache').post(parameters)
48
+ def purge_cache(**options)
49
+ if options.empty?
50
+ options = DEFAULT_PURGE_CACHE_PARAMETERS
51
+ end
57
52
 
58
- return self
53
+ self.class.post(@resource.with(path: "purge_cache"), options)
54
+ end
55
+
56
+ def activation_check
57
+ self.class.put(@resource.with(path: "activation_check"))
59
58
  end
60
59
 
61
60
  def name
62
- value[:name]
61
+ result[:name]
63
62
  end
64
63
 
65
64
  alias to_s name
@@ -71,13 +70,25 @@ module Cloudflare
71
70
  def representation
72
71
  Zone
73
72
  end
74
-
75
- def create(name, account, jump_start = false)
76
- represent_message(self.post(name: name, account: account.to_hash, jump_start: jump_start))
73
+
74
+ def create(name, account, jump_start: false, **options)
75
+ payload = {name: name, account: account.to_id, jump_start: jump_start, **options}
76
+
77
+ Zone.post(@resource, payload) do |resource, response|
78
+ value = response.read
79
+ result = value[:result]
80
+ metadata = response.headers
81
+
82
+ if id = result[:id]
83
+ resource = resource.with(path: id)
84
+ end
85
+
86
+ Zone.new(resource, value: value, metadata: metadata)
87
+ end
77
88
  end
78
-
89
+
79
90
  def find_by_name(name)
80
- each(name: name).first
91
+ each(name: name).find{|zone| zone.name == name}
81
92
  end
82
93
  end
83
94
  end
data/lib/cloudflare.rb CHANGED
@@ -1,47 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2012, by Marcin Prokop.
4
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2012-2016, by Marcin Prokop.
5
+ # Copyright, 2013, by Eric McKay.
6
+ # Copyright, 2014, by Jason Green.
7
+ # Copyright, 2014-2024, by Samuel Williams.
8
+ # Copyright, 2014, by Greg Retkowski.
9
+ # Copyright, 2018, by Leonhardt Wille.
10
+ # Copyright, 2019, by Akinori Musha.
23
11
 
24
- require 'async'
25
- require_relative 'cloudflare/connection'
12
+ require "async"
13
+ require_relative "cloudflare/connection"
26
14
 
27
15
  module Cloudflare
28
- DEFAULT_ENDPOINT = Async::HTTP::Endpoint.parse('https://api.cloudflare.com/client/v4')
29
-
30
- def self.connect(endpoint = DEFAULT_ENDPOINT, **auth_info)
31
- representation = Connection.for(endpoint)
16
+ def self.connect(*arguments, **auth_info)
17
+ connection = Connection.open(*arguments)
32
18
 
33
19
  if !auth_info.empty?
34
- representation = representation.authenticated(**auth_info)
20
+ connection = connection.authenticated(**auth_info)
35
21
  end
36
22
 
37
- return representation unless block_given?
23
+ return connection unless block_given?
38
24
 
39
- Async do
40
- begin
41
- yield representation
42
- ensure
43
- representation.close
44
- end
25
+ Sync do
26
+ yield connection
27
+ ensure
28
+ connection.close
45
29
  end
46
30
  end
47
31
  end
data/license.md ADDED
@@ -0,0 +1,42 @@
1
+ # MIT License
2
+
3
+ Copyright, 2012-2017, by Marcin Prokop.
4
+ Copyright, 2013, by Eric McKay.
5
+ Copyright, 2014, by Jason Green.
6
+ Copyright, 2014-2024, by Samuel Williams.
7
+ Copyright, 2014, by Greg Retkowski.
8
+ Copyright, 2015, by Kyle Corbitt.
9
+ Copyright, 2015, by Guillaume Leseur.
10
+ Copyright, 2017, by Denis Sadomowski.
11
+ Copyright, 2017, by 莫粒.
12
+ Copyright, 2018, by Leonhardt Wille.
13
+ Copyright, 2018, by Mike Perham.
14
+ Copyright, 2018, by Michael Kalygin.
15
+ Copyright, 2018, by Sherman Koa.
16
+ Copyright, 2018, by Kugayama Nana.
17
+ Copyright, 2018, by Casey Lopez.
18
+ Copyright, 2019, by Akinori Musha.
19
+ Copyright, 2019, by Rob Widmer.
20
+ Copyright, 2019, by Fedishin Nazar.
21
+ Copyright, 2019, by David Wegman.
22
+ Copyright, 2020, by Olle Jonsson.
23
+ Copyright, 2021, by Terry Kerr.
24
+ Copyright, 2025, by Travis Skindzier.
25
+
26
+ Permission is hereby granted, free of charge, to any person obtaining a copy
27
+ of this software and associated documentation files (the "Software"), to deal
28
+ in the Software without restriction, including without limitation the rights
29
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
30
+ copies of the Software, and to permit persons to whom the Software is
31
+ furnished to do so, subject to the following conditions:
32
+
33
+ The above copyright notice and this permission notice shall be included in all
34
+ copies or substantial portions of the Software.
35
+
36
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
42
+ SOFTWARE.
data/readme.md ADDED
@@ -0,0 +1,108 @@
1
+ # Cloudflare
2
+
3
+ It is a Ruby wrapper for the Cloudflare V4 API. It provides a light weight wrapper using `RestClient::Resource`. The wrapper functionality is limited to zones and DNS records at this time, *PRs welcome*.
4
+
5
+ [![Development Status](https://github.com/socketry/cloudflare/workflows/Test/badge.svg)](https://github.com/socketry/cloudflare/actions?workflow=Test)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ``` ruby
12
+ gem "cloudflare"
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install cloudflare
22
+
23
+ ## Usage
24
+
25
+ Here are some basic examples. For more details, refer to the code and specs.
26
+
27
+ ``` ruby
28
+ require "cloudflare"
29
+
30
+ # Grab some details from somewhere:
31
+ email = ENV["CLOUDFLARE_EMAIL"]
32
+ key = ENV["CLOUDFLARE_KEY"]
33
+
34
+ Cloudflare.connect(key: key, email: email) do |connection|
35
+ # Get all available zones:
36
+ zones = connection.zones
37
+
38
+ # Get a specific zone:
39
+ zone = connection.zones.find_by_id("...")
40
+ zone = connection.zones.find_by_name("example.com")
41
+
42
+ # Get DNS records for a given zone:
43
+ dns_records = zone.dns_records
44
+
45
+ # Show some details of the DNS record:
46
+ dns_record = dns_records.first
47
+ puts dns_record.name
48
+
49
+ # Add a DNS record. Here we add an A record for `batman.example.com`:
50
+ zone = zones.find_by_name("example.com")
51
+ zone.dns_records.create("A", "batman", "1.2.3.4", proxied: false)
52
+
53
+ # Get firewall rules:
54
+ all_rules = zone.firewall_rules
55
+
56
+ # Block an ip:
57
+ rule = zone.firewall_rules.set("block", "1.2.3.4", notes: "ssh dictionary attack")
58
+ end
59
+ ```
60
+
61
+ ### Using a Bearer Token
62
+
63
+ You can read more about [bearer tokens here](https://blog.cloudflare.com/api-tokens-general-availability/). This allows you to limit priviledges.
64
+
65
+ ``` ruby
66
+ require "cloudflare"
67
+
68
+ token = "a_generated_api_token"
69
+
70
+ Cloudflare.connect(token: token) do |connection|
71
+ # ...
72
+ end
73
+ ```
74
+
75
+ ### Using with Async
76
+
77
+ ``` ruby
78
+ Async do
79
+ connection = Cloudflare.connect
80
+
81
+ # ... do something with connection ...
82
+ ensure
83
+ connection.close
84
+ end
85
+ ```
86
+
87
+ ## Contributing
88
+
89
+ We welcome contributions to this project.
90
+
91
+ 1. Fork it.
92
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
93
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
94
+ 4. Push to the branch (`git push origin my-new-feature`).
95
+ 5. Create new Pull Request.
96
+
97
+ ### Developer Certificate of Origin
98
+
99
+ In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
100
+
101
+ ### Community Guidelines
102
+
103
+ This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
104
+
105
+ ## See Also
106
+
107
+ - [Cloudflare::DNS::Update](https://github.com/ioquatix/cloudflare-dns-update) - A dynamic DNS updater based on this gem.
108
+ - [Rubyflare](https://github.com/trev/rubyflare) - Another implementation.
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,15 +1,63 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudflare
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
- - Marcin Prokop
8
7
  - Samuel Williams
9
- autorequire:
8
+ - Marcin Prokop
9
+ - Leonhardt Wille
10
+ - Rob Widmer
11
+ - Akinori Musha
12
+ - Sherman Koa
13
+ - Michael Kalygin
14
+ - Denis Sadomowski
15
+ - Eric McKay
16
+ - Fedishin Nazar
17
+ - Casey Lopez
18
+ - David Wegman
19
+ - Greg Retkowski
20
+ - Guillaume Leseur
21
+ - Jason Green
22
+ - Kugayama Nana
23
+ - Kyle Corbitt
24
+ - Mike Perham
25
+ - Olle Jonsson
26
+ - Terry Kerr
27
+ - Travis Skindzier
28
+ - 莫粒
10
29
  bindir: bin
11
- cert_chain: []
12
- date: 2021-06-14 00:00:00.000000000 Z
30
+ cert_chain:
31
+ - |
32
+ -----BEGIN CERTIFICATE-----
33
+ MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
34
+ ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
35
+ CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
36
+ MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
37
+ MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
38
+ bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
39
+ igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
40
+ 9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
41
+ sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
42
+ e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
43
+ XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
44
+ RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
45
+ tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
46
+ zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
47
+ xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
48
+ BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
49
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
50
+ aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
51
+ cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
52
+ xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
53
+ c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
54
+ 8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
55
+ JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
56
+ eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
57
+ Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
58
+ voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
59
+ -----END CERTIFICATE-----
60
+ date: 1980-01-02 00:00:00.000000000 Z
13
61
  dependencies:
14
62
  - !ruby/object:Gem::Dependency
15
63
  name: async-rest
@@ -17,98 +65,44 @@ dependencies:
17
65
  requirements:
18
66
  - - "~>"
19
67
  - !ruby/object:Gem::Version
20
- version: 0.12.3
68
+ version: '0.18'
21
69
  type: :runtime
22
70
  prerelease: false
23
71
  version_requirements: !ruby/object:Gem::Requirement
24
72
  requirements:
25
73
  - - "~>"
26
74
  - !ruby/object:Gem::Version
27
- version: 0.12.3
28
- - !ruby/object:Gem::Dependency
29
- name: async-rspec
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: bundler
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: '0'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: '0'
56
- - !ruby/object:Gem::Dependency
57
- name: covered
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- - !ruby/object:Gem::Dependency
71
- name: rspec
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '3.6'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: '3.6'
84
- description:
85
- email:
75
+ version: '0.18'
86
76
  executables: []
87
77
  extensions: []
88
78
  extra_rdoc_files: []
89
79
  files:
90
80
  - lib/cloudflare.rb
91
81
  - lib/cloudflare/accounts.rb
82
+ - lib/cloudflare/certificates.rb
92
83
  - lib/cloudflare/connection.rb
93
84
  - lib/cloudflare/custom_hostname/ssl_attribute.rb
94
85
  - lib/cloudflare/custom_hostname/ssl_attribute/settings.rb
95
86
  - lib/cloudflare/custom_hostnames.rb
96
87
  - lib/cloudflare/dns.rb
97
88
  - lib/cloudflare/firewall.rb
89
+ - lib/cloudflare/ips.rb
98
90
  - lib/cloudflare/kv/namespaces.rb
99
- - lib/cloudflare/kv/rest_wrapper.rb
91
+ - lib/cloudflare/kv/wrapper.rb
100
92
  - lib/cloudflare/logs.rb
101
93
  - lib/cloudflare/paginate.rb
102
94
  - lib/cloudflare/representation.rb
103
- - lib/cloudflare/rspec/connection.rb
95
+ - lib/cloudflare/request_error.rb
104
96
  - lib/cloudflare/user.rb
105
97
  - lib/cloudflare/version.rb
106
98
  - lib/cloudflare/zones.rb
99
+ - license.md
100
+ - readme.md
107
101
  homepage: https://github.com/socketry/cloudflare
108
102
  licenses:
109
103
  - MIT
110
- metadata: {}
111
- post_install_message:
104
+ metadata:
105
+ source_code_uri: https://github.com/socketry/cloudflare.git
112
106
  rdoc_options: []
113
107
  require_paths:
114
108
  - lib
@@ -116,15 +110,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
116
110
  requirements:
117
111
  - - ">="
118
112
  - !ruby/object:Gem::Version
119
- version: '2.5'
113
+ version: '3.2'
120
114
  required_rubygems_version: !ruby/object:Gem::Requirement
121
115
  requirements:
122
116
  - - ">="
123
117
  - !ruby/object:Gem::Version
124
118
  version: '0'
125
119
  requirements: []
126
- rubygems_version: 3.1.6
127
- signing_key:
120
+ rubygems_version: 4.0.3
128
121
  specification_version: 4
129
122
  summary: A Ruby wrapper for the Cloudflare API.
130
123
  test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ ����7+ul��ȻSt�>���j��N�\����K'U�� �,if~;OKM����~(
2
+ �vH�A���͟�:�YQqb���3Ⱦ� ϸ��s k��V�%�?Qp�����9M�{U;����sRQn �:V�2�H����B��[����ؠ
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'json'
4
-
5
- module Cloudflare
6
- module KV
7
- class RESTWrapper < Async::REST::Wrapper::Generic
8
- APPLICATION_OCTET_STREAM = 'application/octet-stream'
9
- APPLICATION_JSON = 'application/json'
10
- ACCEPT_HEADER = "#{APPLICATION_JSON}, #{APPLICATION_OCTET_STREAM}"
11
-
12
- def prepare_request(payload, headers)
13
- headers['accept'] ||= ACCEPT_HEADER
14
-
15
- if payload
16
- headers['content-type'] = APPLICATION_OCTET_STREAM
17
- ::Protocol::HTTP::Body::Buffered.new([payload.to_s])
18
- end
19
- end
20
-
21
- def parser_for(response)
22
- if response.headers['content-type'].start_with?(APPLICATION_OCTET_STREAM)
23
- OctetParser
24
- elsif response.headers['content-type'].start_with?(APPLICATION_JSON)
25
- JsonParser
26
- else
27
- Async::REST::Wrapper::Generic::Unsupported
28
- end
29
- end
30
-
31
- class OctetParser < ::Protocol::HTTP::Body::Wrapper
32
- def join
33
- super
34
- end
35
- end
36
-
37
- class JsonParser < ::Protocol::HTTP::Body::Wrapper
38
- def join
39
- JSON.parse(super, symbolize_names: true)
40
- end
41
- end
42
- end
43
- end
44
- end