class Cloudflarer::Client
Constants
- API_VERSION
- Error
- HOST
- PATH
- URL
Public Class Methods
new(api_key: nil, email: nil)
click to toggle source
# File lib/cloudflarer/client.rb, line 12 def initialize(api_key: nil, email: nil) api_key ||= ENV['CLOUDFLARE_API_KEY'] raise ArgumentError, "API Key is required." unless api_key email ||= ENV['CLOUDFLARE_EMAIL'] raise ArgumentError, "Email is required" unless email headers = { 'X-Auth-Key' => api_key, 'X-Auth-Email' => email, 'Content-Type': 'application/json' } @connection = Faraday.new(URL, headers: headers) end
Private Instance Methods
respond() { || ... }
click to toggle source
# File lib/cloudflarer/client.rb, line 39 def respond(&block) JSON.parse(yield.body) end