Sha256: c3602985b5e70b32dba4d9d072d63fa7f97bf54d5eea8096fe533980a85294e7
Contents?: true
Size: 819 Bytes
Versions: 7
Compression:
Stored size: 819 Bytes
Contents
require 'jsonclient' require 'glare/api_response' module Glare class Client BASE_URL = 'https://api.cloudflare.com/client/v4'.freeze def initialize(email, auth_key) @headers = { 'X-Auth-Email' => email, 'X-Auth-Key' => auth_key } @http = JSONClient.new @http.debug_dev = STDERR if ENV['CF_DEBUG'] end def get(query, params) ApiResponse.new(@http.get(BASE_URL + query, params, @headers)).valid! end def post(query, data) ApiResponse.new(@http.post(BASE_URL + query, data, @headers)).valid! end def put(query, data) ApiResponse.new(@http.put(BASE_URL + query, data, @headers)).valid! end def delete(query, params=nil) ApiResponse.new(@http.delete(BASE_URL + query, params, @headers)).valid! end end end
Version data entries
7 entries across 7 versions & 1 rubygems