Class: CloudflareClient
- Inherits:
-
Object
- Object
- CloudflareClient
- Defined in:
- lib/cloudflare_client.rb,
lib/cloudflare_client/zone.rb,
lib/cloudflare_client/version.rb,
lib/cloudflare_client/middleware/response/raise_error.rb
Overview
General class for the client
Direct Known Subclasses
Certificate, Namespace, Organization, Railgun, VirtualDnsCluster, Zone
Defined Under Namespace
Modules: Middleware Classes: BadGateway, BadRequest, Certificate, ClientError, Conflict, Forbidden, GatewayTimeout, Gone, InternalServerError, Locked, Namespace, Organization, PreconditionFailed, Railgun, ResourceNotFound, ResponseError, ServerError, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, Value, VirtualDnsCluster, Zone
Constant Summary collapse
- API_BASE =
'https://api.cloudflare.com/client/v4'.freeze
- VALID_BUNDLE_METHODS =
%w[ubiquitous optimal force].freeze
- VALID_DIRECTIONS =
%w[asc desc].freeze
- VALID_MATCHES =
%w[any all].freeze
- POSSIBLE_API_SETTINGS =
%w[ advanced_ddos always_online automatic_https_rewrites browser_cache_ttl browser_check cache_level challenge_ttl development_mode email_obfuscation hotlink_protection ip_geolocation ipv6 minify mobile_redirect mirage origin_error_page_pass_thru opportunistic_encryption polish webp prefetch_preload response_buffering rocket_loader security_header security_level server_side_exclude sort_query_string_for_cache ssl tls_1_2_only tls_1_3 tls_client_auth true_client_ip_header waf http2 pseudo_ipv4 websockets ].freeze
- VERSION =
"5.0.0"
Instance Method Summary collapse
-
#initialize(auth_key: nil, email: nil, auth_token: nil, &block) ⇒ CloudflareClient
constructor
A new instance of CloudflareClient.
Constructor Details
#initialize(auth_key: nil, email: nil, auth_token: nil, &block) ⇒ CloudflareClient
Returns a new instance of CloudflareClient.
54 55 56 57 58 |
# File 'lib/cloudflare_client.rb', line 54 def initialize(auth_key: nil, email: nil, auth_token: nil, &block) raise('Missing auth_key or auth_token') if auth_key.nil? && auth_token.nil? raise('missing email') if email.nil? && !auth_key.nil? @cf_client ||= build_client(auth_key: auth_key, email: email, auth_token: auth_token, &block) end |