Class: CloudflareClient

Inherits:
Object
  • Object
show all
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, Organization, Railgun, VirtualDnsCluster, Zone

Defined Under Namespace

Modules: Middleware Classes: BadGateway, BadRequest, Certificate, ClientError, Conflict, Forbidden, GatewayTimeout, Gone, InternalServerError, Locked, Organization, PreconditionFailed, Railgun, ResourceNotFound, ResponseError, ServerError, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, 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 =
'4.1.0'

Instance Method Summary collapse

Constructor Details

#initialize(auth_key: nil, email: nil) ⇒ 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)
  raise('Missing auth_key') if auth_key.nil?
  raise('missing email') if email.nil?
  @cf_client ||= build_client(auth_key: auth_key, email: email)
end