Class: CloudflareStorage::Client
- Inherits:
-
Object
- Object
- CloudflareStorage::Client
- Defined in:
- lib/cloudflare_storage/client.rb
Instance Method Summary collapse
-
#initialize(account_id, namespace_id, token, connection = nil) ⇒ Client
constructor
A new instance of Client.
- #keys ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(account_id, namespace_id, token, connection = nil) ⇒ Client
Returns a new instance of Client.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/cloudflare_storage/client.rb', line 4 def initialize(account_id, namespace_id, token, connection = nil) raise MissingCredentialsError, "Please configure account_id" if account_id.nil? raise MissingCredentialsError, "Please configure namespace_id" if namespace_id.nil? raise MissingCredentialsError, "Please configure token" if token.nil? @conn = connection || Faraday.new(url: "https://api.cloudflare.com/client/v4/accounts/#{account_id}/storage/kv/namespaces/#{namespace_id}/" ) do |builder| builder.request :authorization, "Bearer", token builder.request :json builder.response :json builder.response :raise_error end end |