cloudflare_client_rb 4.5.0 → 5.0.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
- SHA1:
3
- metadata.gz: 6b750c4cf1d2406e217504fe9cbf195faf7dbc87
4
- data.tar.gz: 97a75d61e8d7f758425e3fb0c01d00bcf978f372
2
+ SHA256:
3
+ metadata.gz: 867624e2f37d6cf2f1709c151e9bd51cba5526863486debbaa7dfc99430950e1
4
+ data.tar.gz: 40ee55b856e35a064872391bbe4ec105b5cc149546ca6d9592e5ef0c67820c90
5
5
  SHA512:
6
- metadata.gz: b10b81567bd45527a8826e441cfb429158eaca341532d3cff5d1d02c895dea0334ea3e91c7040707cd714cedccc9b71fdae3236f8fefffedf618c538b5966e8b
7
- data.tar.gz: 05c0e5b3880770e0291107b7608a4d9bdb18be396404cdd5f720c9ea06fa1c6d94a0b16c9b2ba95dd70271d64fcec649de91c5ce38de09cfef97f248ac5b64cf
6
+ metadata.gz: 715cdb2ae1c2c8a4f37ae47665ffd1d146e1e31147984e57431aae7bc2afab9da6f1e155229db3aacba9ad45ae245dbfe46d6464d7ada0d72208dfc8c6adcdfb
7
+ data.tar.gz: 7ad6cf31ed7bfd150c99392d9213a50bf6a3fe1b949db77f3470a60b014c604b30ac99451ac35173d522582cc9834ae9de099b6c987bcfced9bbff275c5fabae
@@ -4,7 +4,7 @@ class CloudflareClient::Value < CloudflareClient::Namespace
4
4
  def initialize(args)
5
5
  @namespace_id = args.delete(:namespace_id)
6
6
  id_check(:namespace_id, namespace_id)
7
- super
7
+ super(**args)
8
8
  end
9
9
 
10
10
  def write(key:, value:, expiration_ttl: nil, metadata: nil)
@@ -6,7 +6,7 @@ class CloudflareClient::Namespace < CloudflareClient
6
6
  def initialize(args)
7
7
  @account_id = args.delete(:account_id)
8
8
  id_check(:account_id, account_id)
9
- super
9
+ super(**args)
10
10
  end
11
11
 
12
12
  end
@@ -8,7 +8,7 @@ class CloudflareClient::Organization < CloudflareClient
8
8
  def initialize(args)
9
9
  @org_id = args.delete(:org_id)
10
10
  id_check(:org_id, org_id)
11
- super
11
+ super(**args)
12
12
  end
13
13
 
14
14
  ##
@@ -1,9 +1,4 @@
1
1
  class CloudflareClient::Railgun < CloudflareClient
2
- ##
3
- # Railgun methods
4
- def initialize(*args)
5
- super
6
- end
7
2
 
8
3
  ##
9
4
  # create(name: 'name of railgun')
@@ -1,3 +1,3 @@
1
1
  class CloudflareClient
2
- VERSION = "4.5.0"
2
+ VERSION = "5.0.0"
3
3
  end
@@ -7,7 +7,7 @@ class CloudflareClient::VirtualDnsCluster::Analytic < CloudflareClient::VirtualD
7
7
  def initialize(args)
8
8
  @virtual_dns_id = args.delete(:virtual_dns_id)
9
9
  id_check(:virtual_dns_id, virtual_dns_id)
10
- super
10
+ super(**args)
11
11
  end
12
12
 
13
13
  def report(dimensions:, metrics:, since_ts:, until_ts:, filters: nil, sort: nil, limit: nil)
@@ -22,7 +22,7 @@ class CloudflareClient::VirtualDnsCluster < CloudflareClient
22
22
  @uri_prefix = "/organizations/#{org_id}"
23
23
  end
24
24
 
25
- super
25
+ super(**args)
26
26
  end
27
27
 
28
28
  ##
@@ -4,6 +4,6 @@ class CloudflareClient::Zone::Base < CloudflareClient::Zone
4
4
  def initialize(args)
5
5
  @zone_id = args.delete(:zone_id)
6
6
  id_check('zone_id', zone_id)
7
- super
7
+ super(**args)
8
8
  end
9
9
  end
@@ -4,6 +4,6 @@ class CloudflareClient::Zone::Firewall::WAFPackage::Base < CloudflareClient::Zon
4
4
  def initialize(args)
5
5
  @package_id = args.delete(:package_id)
6
6
  id_check('package_id', package_id)
7
- super
7
+ super(**args)
8
8
  end
9
9
  end
@@ -10,10 +10,10 @@ class CloudflareClient::Zone::Log < CloudflareClient::Zone::Base
10
10
  timestamp_check(:end_time, end_time) unless end_time.nil?
11
11
 
12
12
  params = Hash.new
13
-
13
+ minute = 60
14
14
 
15
15
  if start_time.nil?
16
- params[:start] = (Time.now - 20.minute).to_i
16
+ params[:start] = (Time.now - (20 * minute)).to_i
17
17
  else
18
18
  timestamp_check(:start_time, start_time)
19
19
  params[:start] = start_time
@@ -21,7 +21,7 @@ class CloudflareClient::Zone::Log < CloudflareClient::Zone::Base
21
21
 
22
22
 
23
23
  if end_time.nil?
24
- params[:end] = (Time.now - 5.minute).to_i
24
+ params[:end] = (Time.now - (5 * minute)).to_i
25
25
  else
26
26
  timestamp_check(:end_time, end_time)
27
27
  params[:end] = end_time
@@ -5,12 +5,6 @@ class CloudflareClient
5
5
 
6
6
  VALID_ZONE_STATUSES = %w[active pending initializing moved deleted deactivated].freeze
7
7
 
8
- ##
9
- # Zone based operations
10
- def initialize(*args)
11
- super
12
- end
13
-
14
8
  ##
15
9
  # list_zones will either list all zones or search for zones based on params
16
10
  # results are paginated!
@@ -133,7 +133,7 @@ class CloudflareClient
133
133
  def build_client(params)
134
134
  # we need multipart form encoding for some of these operations
135
135
  client = Faraday.new(url: API_BASE) do |conn|
136
- conn.request :multipart
136
+ # conn.request :multipart
137
137
  conn.request :url_encoded
138
138
  conn.use Middleware::Response::RaiseError
139
139
  end
@@ -183,7 +183,9 @@ class CloudflareClient
183
183
  def cf_put(path: nil, data: nil, params: nil)
184
184
  result = @cf_client.put do |request|
185
185
  request.url(API_BASE + path) unless path.nil?
186
- request.body = data.to_json unless data.nil?
186
+ unless data.nil?
187
+ request.body = data.kind_of?(String) ? data : data.to_json
188
+ end
187
189
  unless params.nil?
188
190
  request.params = params if params.values.any? { |i| !i.nil? }
189
191
  end
@@ -192,7 +194,7 @@ class CloudflareClient
192
194
  end
193
195
 
194
196
  def cf_patch(path: nil, data: {})
195
- result = @cf_client.patch do |request|
197
+ result = @cf_client.patch do |request|
196
198
  request.url(API_BASE + path) unless path.nil?
197
199
  request.body = data.to_json unless data.empty?
198
200
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudflare_client_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ian waters
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-13 00:00:00.000000000 Z
11
+ date: 2022-08-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: iwaters@zendesk.com
@@ -65,15 +65,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 2.3.0
68
+ version: 3.1.0
69
69
  required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  requirements:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  requirements: []
75
- rubyforge_project:
76
- rubygems_version: 2.6.11
75
+ rubygems_version: 3.3.7
77
76
  signing_key:
78
77
  specification_version: 4
79
78
  summary: lightweight cloudflare api client