Class: CFC::API

Inherits:
Object
  • Object
show all
Defined in:
lib/cfc/api.rb

Instance Method Summary collapse

Constructor Details

#initializeAPI

Returns a new instance of API.



11
12
13
14
# File 'lib/cfc/api.rb', line 11

def initialize
  @base = 'https://api.cloudflare.com/client/v4/'
  @cache = CFC::Cache.new
end

Instance Method Details

#get(path, params: nil, headers: nil, cache: true, expiry: nil) ⇒ Object



16
17
18
# File 'lib/cfc/api.rb', line 16

def get(path, params: nil, headers: nil, cache: true, expiry: nil)
  request(Net::HTTP::Get, build_uri(path, params), headers: headers, cache: cache, expiry: expiry)
end

#get_json(path, params: nil, headers: nil, cache: true, expiry: nil) ⇒ Object



20
21
22
# File 'lib/cfc/api.rb', line 20

def get_json(path, params: nil, headers: nil, cache: true, expiry: nil)
  request_json(Net::HTTP::Get, build_uri(path, params), headers: headers, cache: cache, expiry: expiry)
end