Class: Cloudflare::Connection
- Inherits:
-
Async::REST::Resource
- Object
- Async::REST::Resource
- Cloudflare::Connection
- Defined in:
- lib/cloudflare/connection.rb
Constant Summary collapse
- ENDPOINT =
Async::HTTP::Endpoint.parse("https://api.cloudflare.com/client/v4/")
Instance Method Summary collapse
- #accounts ⇒ Object
- #authenticated(token: nil, key: nil, email: nil) ⇒ Object
- #user ⇒ Object
- #zones ⇒ Object
Instance Method Details
#accounts ⇒ Object
44 45 46 |
# File 'lib/cloudflare/connection.rb', line 44 def accounts Accounts.new(self.with(path: "accounts")) end |
#authenticated(token: nil, key: nil, email: nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cloudflare/connection.rb', line 23 def authenticated(token: nil, key: nil, email: nil) headers = {} if token headers["authorization"] = "bearer #{token}" elsif key if email headers["x-auth-key"] = key headers["x-auth-email"] = email else headers["x-auth-user-service-key"] = key end end self.with(headers: headers) end |
#user ⇒ Object
48 49 50 |
# File 'lib/cloudflare/connection.rb', line 48 def user User.new(self.with(path: "user")) end |
#zones ⇒ Object
40 41 42 |
# File 'lib/cloudflare/connection.rb', line 40 def zones Zones.new(self.with(path: "zones/")) end |