Class: Glare::Client
- Inherits:
-
Object
- Object
- Glare::Client
- Defined in:
- lib/glare/client.rb
Constant Summary collapse
- BASE_URL =
'https://api.cloudflare.com/client/v4'.freeze
Instance Method Summary collapse
- #delete(query, params = nil) ⇒ Object
- #get(query, params) ⇒ Object
-
#initialize(email, auth_key) ⇒ Client
constructor
A new instance of Client.
- #post(query, data) ⇒ Object
- #put(query, data) ⇒ Object
Constructor Details
#initialize(email, auth_key) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 12 13 14 15 |
# File 'lib/glare/client.rb', line 7 def initialize(email, auth_key) @headers = { 'Content-Type' => 'application/json', 'X-Auth-Email' => email, 'X-Auth-Key' => auth_key } @http = JSONClient.new @http.debug_dev = STDERR if ENV['CF_DEBUG'] end |
Instance Method Details
#delete(query, params = nil) ⇒ Object
29 30 31 |
# File 'lib/glare/client.rb', line 29 def delete(query, params=nil) @http.delete(BASE_URL + query, params, @headers) end |
#get(query, params) ⇒ Object
17 18 19 |
# File 'lib/glare/client.rb', line 17 def get(query, params) @http.get(BASE_URL + query, params, @headers) end |
#post(query, data) ⇒ Object
21 22 23 |
# File 'lib/glare/client.rb', line 21 def post(query, data) @http.post(BASE_URL + query, data, @headers) end |
#put(query, data) ⇒ Object
25 26 27 |
# File 'lib/glare/client.rb', line 25 def put(query, data) @http.put(BASE_URL + query, data, @headers) end |