cloudflare 2.0.3 → 2.1.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 +5 -13
- data/cloudflare.gemspec +16 -16
- data/lib/cloudflare.rb +6 -6
- data/lib/cloudflare/connection.rb +39 -50
- data/lib/cloudflare/version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZjFlNzZlYjQ2NzJjY2I4ZTc4NzMwMGVlZjI2MTQ1MWI5ZTgxZmQ3Zg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0a37a8b92266e030c82969316e7c5cade2081069
|
4
|
+
data.tar.gz: bb4db11a47c0777ac96a6dd77fa7aec01c9b8a00
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NTNhZTMyY2RlNjAwNGQ3NzYyMGNhNjllNmI5Y2Q1YTM2NzVlNDBkZjNlNGQx
|
11
|
-
NWI2NDgyOWVlODQ5ZWFkMjFiY2QwODY5Y2ZhMjc4MWI5ZjNjYzU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZGUxZTY5MjIwMDU3ZjcwYTI2MzhiOGViMzdjYTQ2NmQ2Yzc2NmY3ZDAwZTli
|
14
|
-
ZWZmNmM4ZGM0ZmU2OGYxMTIyZmJkMWI2NWY1NjZkM2EwZjE2MmQzYjVmN2Qw
|
15
|
-
OTBmYzNlNDQ2YWEyY2RkYWYwZDM4OTI3M2JmNzJjNGNmOGM4ZDU=
|
6
|
+
metadata.gz: 1e5fb4101c0451643b585b005246c2f1803888d0def6278bf350ed23f2750f69311a491a78d33b281f97ee648ab618a0c195f916467d62be1d81e71d68613291
|
7
|
+
data.tar.gz: c6754b19bf2e6c32536113e3dc0747e4513ffaf0304bf268f833cda3ff5b119184b816fd8a3cef519806460b9761443aad2d46179c12f301004eb7b81b5e1aec
|
data/cloudflare.gemspec
CHANGED
@@ -3,23 +3,23 @@ $LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
require 'cloudflare/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
s.name = 'cloudflare'
|
7
|
+
s.version = CloudFlare::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
s.description = 'A Ruby wrapper for the CloudFlare API.'
|
11
|
+
s.summary = 'A Ruby wrapper for the CloudFlare API.'
|
12
|
+
s.authors = ['Marcin Prokop']
|
13
|
+
s.email = 'marcin@prokop.co'
|
14
|
+
s.homepage = 'https://github.com/b4k3r/cloudflare'
|
15
|
+
s.licenses = ['MIT']
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = ['test/test_cloudflare.rb']
|
19
|
+
s.rdoc_options = ['--main', 'README.md', '--charset=UTF-8']
|
20
|
+
s.extra_rdoc_files = ['README.md', 'LICENSE']
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
s.required_ruby_version = '>= 1.9.0'
|
23
|
+
s.add_runtime_dependency 'json', '~> 1'
|
24
|
+
s.add_development_dependency 'rake'
|
25
25
|
end
|
data/lib/cloudflare.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Copyright, 2012, by Marcin Prokop.
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the "Software"), to deal
|
5
5
|
# in the Software without restriction, including without limitation the rights
|
6
6
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
7
|
# copies of the Software, and to permit persons to whom the Software is
|
8
8
|
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# The above copyright notice and this permission notice shall be included in
|
11
11
|
# all copies or substantial portions of the Software.
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
14
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
15
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
@@ -21,7 +21,7 @@
|
|
21
21
|
require 'cloudflare/connection'
|
22
22
|
|
23
23
|
module CloudFlare
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
def self.connection(api_key, email = nil)
|
25
|
+
Connection.new(api_key, email)
|
26
|
+
end
|
27
27
|
end
|
@@ -56,7 +56,6 @@ module CloudFlare
|
|
56
56
|
@params[:api_key] = api_key
|
57
57
|
@params[:email] = email
|
58
58
|
end
|
59
|
-
|
60
59
|
end
|
61
60
|
|
62
61
|
# CLIENT
|
@@ -100,6 +99,7 @@ module CloudFlare
|
|
100
99
|
send_req({a: :zone_check, zones: zones.kind_of?(Array) ? zones.join(',') : zones})
|
101
100
|
end
|
102
101
|
|
102
|
+
# DEPRECATED!
|
103
103
|
# This function pulls recent IPs hitting your site.
|
104
104
|
#
|
105
105
|
# @see http://www.cloudflare.com/docs/client-api.html#s3.5
|
@@ -110,6 +110,7 @@ module CloudFlare
|
|
110
110
|
# @param geo [Fixnum] (optional)
|
111
111
|
|
112
112
|
def zone_ips(zone, classification = nil, hours = 24, geo = 1)
|
113
|
+
puts 'Warning! This method is deprecated.'
|
113
114
|
send_req({a: :zone_ips, z: zone, hours: hours, "class" => classification, geo: geo})
|
114
115
|
end
|
115
116
|
|
@@ -187,19 +188,9 @@ module CloudFlare
|
|
187
188
|
send_req({a: :zone_file_purge, z: zone, url: url})
|
188
189
|
end
|
189
190
|
|
190
|
-
# This function updates the snapshot of your site for CloudFlare's challenge page.
|
191
|
-
#
|
192
|
-
# @see http://www.cloudflare.com/docs/client-api.html#s4.6
|
193
|
-
#
|
194
|
-
# @param zoneid [Integer]
|
195
|
-
|
196
|
-
def zone_grab(zoneid)
|
197
|
-
send_req({a: :zone_grab, zid: zoneid})
|
198
|
-
end
|
199
|
-
|
200
191
|
# This function adds an IP address to your white lists.
|
201
192
|
#
|
202
|
-
# @see http://www.cloudflare.com/docs/client-api.html#s4.
|
193
|
+
# @see http://www.cloudflare.com/docs/client-api.html#s4.6
|
203
194
|
#
|
204
195
|
# @param ip [String]
|
205
196
|
|
@@ -210,7 +201,7 @@ module CloudFlare
|
|
210
201
|
|
211
202
|
# This function adds an IP address to your black lists.
|
212
203
|
#
|
213
|
-
# @see http://www.cloudflare.com/docs/client-api.html#s4.
|
204
|
+
# @see http://www.cloudflare.com/docs/client-api.html#s4.6
|
214
205
|
#
|
215
206
|
# @param ip [String]
|
216
207
|
|
@@ -220,7 +211,7 @@ module CloudFlare
|
|
220
211
|
|
221
212
|
# This function removes the IP from whitelist or blacklist.
|
222
213
|
#
|
223
|
-
# @see http://www.cloudflare.com/docs/client-api.html#s4.
|
214
|
+
# @see http://www.cloudflare.com/docs/client-api.html#s4.6
|
224
215
|
#
|
225
216
|
# @param ip [String]
|
226
217
|
|
@@ -230,7 +221,7 @@ module CloudFlare
|
|
230
221
|
|
231
222
|
# This function toggles IPv6 support.
|
232
223
|
#
|
233
|
-
# @see http://www.cloudflare.com/docs/client-api.html#s4.
|
224
|
+
# @see http://www.cloudflare.com/docs/client-api.html#s4.7
|
234
225
|
#
|
235
226
|
# @param zone [String]
|
236
227
|
# @param value [Boolean]
|
@@ -241,7 +232,7 @@ module CloudFlare
|
|
241
232
|
|
242
233
|
# This function changes Rocket Loader setting.
|
243
234
|
#
|
244
|
-
# @see http://www.cloudflare.com/docs/client-api.html#s4.
|
235
|
+
# @see http://www.cloudflare.com/docs/client-api.html#s4.8
|
245
236
|
#
|
246
237
|
# @param zone [String]
|
247
238
|
# @param value [Integer or String] values: 0|a|m
|
@@ -252,7 +243,7 @@ module CloudFlare
|
|
252
243
|
|
253
244
|
# This function changes minification settings.
|
254
245
|
#
|
255
|
-
# @see http://www.cloudflare.com/docs/client-api.html#s4.
|
246
|
+
# @see http://www.cloudflare.com/docs/client-api.html#s4.9
|
256
247
|
#
|
257
248
|
# @param zone [String]
|
258
249
|
# @param value [Integer] values: 0|2|3|4|5|6|7
|
@@ -264,7 +255,7 @@ module CloudFlare
|
|
264
255
|
|
265
256
|
# This function changes mirage2 settings.
|
266
257
|
#
|
267
|
-
# @see http://www.cloudflare.com/docs/client-api.html#s4.
|
258
|
+
# @see http://www.cloudflare.com/docs/client-api.html#s4.10
|
268
259
|
#
|
269
260
|
# @param zone [String]
|
270
261
|
# @param value [Integer] values: 0|1
|
@@ -289,8 +280,9 @@ module CloudFlare
|
|
289
280
|
# @param weight [Intger] (applies to SRV)
|
290
281
|
# @param port [Integer] (applies to SRV)
|
291
282
|
# @param target [String] (applies to SRV)
|
283
|
+
# @param service_mode [Boolean] (applies to A/AAAA/CNAME)
|
292
284
|
|
293
|
-
def rec_new(zone, type, name, content, ttl, prio = nil, service = nil, srvname = nil, protocol = nil, weight = nil, port = nil, target = nil)
|
285
|
+
def rec_new(zone, type, name, content, ttl, prio = nil, service = nil, srvname = nil, protocol = nil, weight = nil, port = nil, target = nil, service_mode = true)
|
294
286
|
send_req({
|
295
287
|
a: :rec_new,
|
296
288
|
z: zone,
|
@@ -305,7 +297,7 @@ module CloudFlare
|
|
305
297
|
weight: weight,
|
306
298
|
port: port,
|
307
299
|
target: target,
|
308
|
-
service_mode:
|
300
|
+
service_mode: service_mode ? 1 : 0,
|
309
301
|
})
|
310
302
|
end
|
311
303
|
|
@@ -319,7 +311,6 @@ module CloudFlare
|
|
319
311
|
# @param name [String]
|
320
312
|
# @param content [String]
|
321
313
|
# @param ttl [Integer] values: 1|120...4294967295
|
322
|
-
# @param service_mode [Boolean] (applies to A/AAAA/CNAME)
|
323
314
|
# @param prio [Integer] (applies to MX/SRV)
|
324
315
|
# @param service [String] (applies to SRV)
|
325
316
|
# @param srvname [String] (applies to SRV)
|
@@ -327,8 +318,9 @@ module CloudFlare
|
|
327
318
|
# @param weight [Intger] (applies to SRV)
|
328
319
|
# @param port [Integer] (applies to SRV)
|
329
320
|
# @param target [String] (applies to SRV)
|
321
|
+
# @param service_mode [Boolean] (applies to A/AAAA/CNAME)
|
330
322
|
|
331
|
-
def rec_edit(zone, type, record_id, name, content, ttl,
|
323
|
+
def rec_edit(zone, type, record_id, name, content, ttl, prio = nil, service = nil, srvname = nil, protocol = nil, weight = nil, port = nil, target = nil, service_mode = true)
|
332
324
|
send_req({
|
333
325
|
a: :rec_edit,
|
334
326
|
z: zone,
|
@@ -337,14 +329,14 @@ module CloudFlare
|
|
337
329
|
name: name,
|
338
330
|
content: content,
|
339
331
|
ttl: ttl,
|
340
|
-
service_mode: service_mode ? 1 : 0,
|
341
332
|
prio: prio,
|
342
333
|
service: service,
|
343
334
|
srvname: srvname,
|
344
335
|
protocol: protocol,
|
345
336
|
weight: weight,
|
346
337
|
port: port,
|
347
|
-
target: target
|
338
|
+
target: target,
|
339
|
+
service_mode: service_mode ? 1 : 0,
|
348
340
|
})
|
349
341
|
end
|
350
342
|
|
@@ -401,10 +393,25 @@ module CloudFlare
|
|
401
393
|
})
|
402
394
|
end
|
403
395
|
|
404
|
-
# This function
|
396
|
+
# This function adds a zone using the full setup.
|
405
397
|
#
|
406
398
|
# @see http://www.cloudflare.com/docs/host-api.html#s3.2.3
|
407
399
|
#
|
400
|
+
# @param user_key [String]
|
401
|
+
# @param zone [String]
|
402
|
+
|
403
|
+
def add_full_zone(user_key, zone)
|
404
|
+
send_req({
|
405
|
+
act: :full_zone_set,
|
406
|
+
user_key: user_key,
|
407
|
+
zone_name: zone
|
408
|
+
})
|
409
|
+
end
|
410
|
+
|
411
|
+
# This function lookups a user's CloudFlare account information.
|
412
|
+
#
|
413
|
+
# @see http://www.cloudflare.com/docs/host-api.html#s3.2.4
|
414
|
+
#
|
408
415
|
# *Example:*
|
409
416
|
#
|
410
417
|
# cf = CloudFlare('your_host_key')
|
@@ -425,7 +432,7 @@ module CloudFlare
|
|
425
432
|
|
426
433
|
# This function authorizes access to a user's existing CloudFlare account.
|
427
434
|
#
|
428
|
-
# @see http://www.cloudflare.com/docs/host-api.html#s3.2.
|
435
|
+
# @see http://www.cloudflare.com/docs/host-api.html#s3.2.5
|
429
436
|
#
|
430
437
|
# @param email [String]
|
431
438
|
# @param pass [String]
|
@@ -444,7 +451,7 @@ module CloudFlare
|
|
444
451
|
|
445
452
|
# This function lookups a specific user's zone.
|
446
453
|
#
|
447
|
-
# @see http://www.cloudflare.com/docs/host-api.html#s3.2.
|
454
|
+
# @see http://www.cloudflare.com/docs/host-api.html#s3.2.6
|
448
455
|
#
|
449
456
|
# @param user_key [String]
|
450
457
|
# @param zone [String]
|
@@ -455,7 +462,7 @@ module CloudFlare
|
|
455
462
|
|
456
463
|
# This function deletes a specific zone on behalf of a user.
|
457
464
|
#
|
458
|
-
# @see http://www.cloudflare.com/docs/host-api.html#s3.2.
|
465
|
+
# @see http://www.cloudflare.com/docs/host-api.html#s3.2.7
|
459
466
|
#
|
460
467
|
# @param user_key [String]
|
461
468
|
# @param zone [String]
|
@@ -464,26 +471,6 @@ module CloudFlare
|
|
464
471
|
send_req({act: :zone_delete, user_key: user_key, zone_name: zone})
|
465
472
|
end
|
466
473
|
|
467
|
-
# This function creates a new child host provider.
|
468
|
-
#
|
469
|
-
# @see http://www.cloudflare.com/docs/host-api.html#s3.2.7
|
470
|
-
#
|
471
|
-
# @param host_name [String]
|
472
|
-
# @param pub_name [String]
|
473
|
-
# @param prefix [String]
|
474
|
-
# @param website [String]
|
475
|
-
# @param email [String]
|
476
|
-
|
477
|
-
def host_child_new(host_name, pub_name, prefix, website, email)
|
478
|
-
send_req({
|
479
|
-
act: :host_child_new,
|
480
|
-
pub_name: pub_name,
|
481
|
-
prefix: prefix,
|
482
|
-
website: website,
|
483
|
-
email: email
|
484
|
-
})
|
485
|
-
end
|
486
|
-
|
487
474
|
# This function regenerates your host key.
|
488
475
|
#
|
489
476
|
# @see http://www.cloudflare.com/docs/host-api.html#s3.2.8
|
@@ -511,14 +498,16 @@ module CloudFlare
|
|
511
498
|
# @param name [String] (optional) zone_name
|
512
499
|
# @param sub_id [Integer] (optional) sub_id
|
513
500
|
# @param status [String] (optional) values: V|D|ALL
|
501
|
+
# @param sub_status [String] (optional) values: V|CNL|ALL
|
514
502
|
|
515
|
-
def zone_list(limit = 100, offset = 0, name = nil, sub_id = nil, status = nil)
|
503
|
+
def zone_list(limit = 100, offset = 0, name = nil, sub_id = nil, status = nil, sub_status = nil)
|
516
504
|
send_req({
|
517
505
|
act: :zone_list,
|
518
506
|
offset: offset,
|
519
507
|
zone_name: name,
|
520
508
|
sub_id: sub_id,
|
521
|
-
zone_status: status
|
509
|
+
zone_status: status,
|
510
|
+
sub_status: sub_status
|
522
511
|
})
|
523
512
|
end
|
524
513
|
|
data/lib/cloudflare/version.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudflare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcin Prokop
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: A Ruby wrapper for the CloudFlare API.
|
@@ -61,24 +61,24 @@ licenses:
|
|
61
61
|
metadata: {}
|
62
62
|
post_install_message:
|
63
63
|
rdoc_options:
|
64
|
-
- --main
|
64
|
+
- "--main"
|
65
65
|
- README.md
|
66
|
-
- --charset=UTF-8
|
66
|
+
- "--charset=UTF-8"
|
67
67
|
require_paths:
|
68
68
|
- lib
|
69
69
|
required_ruby_version: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: 1.9.0
|
74
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ">="
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
80
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
81
|
+
rubygems_version: 2.5.1
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: A Ruby wrapper for the CloudFlare API.
|