Module: Cloudflair

Extended by:
Communication, Dry::Configurable
Defined in:
lib/cloudflair.rb,
lib/cloudflair/api.rb,
lib/cloudflair/entity.rb,
lib/cloudflair/version.rb,
lib/cloudflair/api/zone.rb,
lib/cloudflair/connection.rb,
lib/cloudflair/api/railguns.rb,
lib/cloudflair/communication.rb,
lib/cloudflair/api/zone/railgun.rb,
lib/cloudflair/api/zone/settings.rb,
lib/cloudflair/api/zone/analytics.rb,
lib/cloudflair/api/zone__railguns.rb,
lib/cloudflair/api/zone/dns_record.rb,
lib/cloudflair/api/zone/purge_cache.rb,
lib/cloudflair/api/zone/settings/ssl.rb,
lib/cloudflair/api/zone/settings/waf.rb,
lib/cloudflair/api/zone__dns_records.rb,
lib/cloudflair/api/zone/settings/ipv6.rb,
lib/cloudflair/error/cloudflair_error.rb,
lib/cloudflair/error/cloudflare_error.rb,
lib/cloudflair/api/zone/available_plan.rb,
lib/cloudflair/api/zone/custom_hostname.rb,
lib/cloudflair/api/zone/settings/minify.rb,
lib/cloudflair/api/zone/settings/mirage.rb,
lib/cloudflair/api/zone/settings/polish.rb,
lib/cloudflair/api/zone/settings/tls_1_3.rb,
lib/cloudflair/api/zone__available_plans.rb,
lib/cloudflair/api/zone__custom_hostnames.rb,
lib/cloudflair/api/zone/available_rate_plan.rb,
lib/cloudflair/api/zone/settings/websockets.rb,
lib/cloudflair/api/zone/settings/cache_level.rb,
lib/cloudflair/api/zone/settings/tls_1_2_only.rb,
lib/cloudflair/api/zone/settings/advanced_ddos.rb,
lib/cloudflair/api/zone/settings/always_online.rb,
lib/cloudflair/api/zone/settings/browser_check.rb,
lib/cloudflair/api/zone/settings/challenge_ttl.rb,
lib/cloudflair/api/zone/settings/rocket_loader.rb,
lib/cloudflair/api/zone/settings/ip_geolocation.rb,
lib/cloudflair/api/zone/settings/security_level.rb,
lib/cloudflair/api/zone/settings/mobile_redirect.rb,
lib/cloudflair/api/zone/settings/security_header.rb,
lib/cloudflair/api/zone/settings/tls_client_auth.rb,
lib/cloudflair/api/zone/settings/development_mode.rb,
lib/cloudflair/api/zone/settings/prefetch_preload.rb,
lib/cloudflair/api/zone/settings/browser_cache_ttl.rb,
lib/cloudflair/api/zone/settings/email_obfuscation.rb,
lib/cloudflair/api/zone/settings/hotlink_protection.rb,
lib/cloudflair/api/zone/settings/response_buffering.rb,
lib/cloudflair/api/zone/settings/server_side_exclude.rb,
lib/cloudflair/api/zone/settings/true_client_ip_header.rb,
lib/cloudflair/api/zone/settings/origin_error_page_pass_thru.rb,
lib/cloudflair/api/zone/settings/sort_query_string_for_cache.rb

Overview

To configure cloudflair <code> require “cloudflair” Cloudflair.configure do |config|

config.cloudflare.auth.key = 'YOUR_API_KEY'
config.cloudflare.auth.email = 'YOUR_ACCOUNT_EMAIL'
# if you have a user_service_key, you don't need auth.key and auth.email
config.cloudflare.auth.user_service_key = 'YOUR_USER_SERVICE_KEY'

# these are optional:

config.cloudflare.api_base_url = 'https://your_cloudflare_mock.local'
config.faraday.adapter = :your_preferred_faraday_adapter
# built-in options: :logger, :detailed_logger; default: nil
config.faraday.logger = :logger

end </code>

Defined Under Namespace

Modules: Communication, Entity Classes: AdvancedDdos, AlwaysOnline, Analytics, AvailablePlan, AvailableRatePlan, BrowserCacheTtl, BrowserCheck, CacheLevel, ChallengeTtl, CloudflairError, CloudflareError, Connection, CustomHostname, DevelopmentMode, DnsRecord, EmailObfuscation, HotlinkProtection, IpGeolocation, Ipv6, Minify, Mirage, MobileRedirect, OriginErrorPagePassThru, Polish, PrefetchPreload, PurgeCache, Railgun, Railguns, ResponseBuffering, RocketLoader, SecurityHeader, SecurityLevel, ServerSideExclude, Settings, SortQueryStringForCache, Ssl, Tls12Only, Tls13, TlsClientAuth, TrueClientIpHeader, Waf, Websockets, Zone

Class Method Summary collapse

Methods included from Communication

connection, hash_to_object, response

Class Method Details

.railgun(railgun_id) ⇒ Object



24
25
26
# File 'lib/cloudflair/api.rb', line 24

def self.railgun(railgun_id)
  Railguns.new railgun_id
end

.railguns(filter = {}) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/cloudflair/api.rb', line 28

def self.railguns(filter = {})
  raw_railguns = response connection.get 'railguns', filter

  raw_railguns.map do |raw_railgun|
    railgun = Railguns.new(raw_railgun['id'])
    railgun.data = raw_railgun
    railgun
  end
end

.zone(zone_id) ⇒ Object



10
11
12
# File 'lib/cloudflair/api.rb', line 10

def self.zone(zone_id)
  Zone.new zone_id
end

.zones(filter = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/cloudflair/api.rb', line 14

def self.zones(filter = {})
  raw_zones = response connection.get 'zones', filter

  raw_zones.map do |raw_zone|
    zone = Zone.new(raw_zone['id'])
    zone.data = raw_zone
    zone
  end
end