Sha256: 891ad3c25cbe4dda106e58b5cc9b0291ffb1fcb7e074bbf91c618c1bfcbf7c1d

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

require_relative "cloudflared/version"

module Cloudflared
  autoload :Client, "cloudflared/client"
  autoload :Collection, "cloudflared/collection"
  autoload :Config, "cloudflared/config"
  autoload :Error, "cloudflared/error"
  autoload :Object, "cloudflared/object"
  autoload :Resource, "cloudflared/resource"

  autoload :Image, "cloudflared/objects/image"
  autoload :ImagesResource, "cloudflared/resources/images"

  # Returns Cloudflared's configuration object.
  def self.config
    @config ||= Cloudflared::Config.new
  end

  # Creates a client instance with pre-configured values
  def self.client
    Cloudflared::Client.new(
      api_key: config.api_key,
      account_id: config.account_id,
      images_hash: config.images_hash,
      images_default_key: config.images_default_key,
      adapter: config.adapter || Faraday.default_adapter
    )
  end

  # Lets you set global configuration options.
  #
  # All available options and their defaults are in the example below:
  # @example Initializer for Rails
  #   Cloudflared.configure do |config|
  #     config.api_key      = "key"
  #     config.account_id   = "secret"
  #     config.images_hash  = "hash"
  #     config.images_default_key  = "key"
  #     config.adapter      = Faraday.default_adapter
  #   end
  def self.configure(&block)
    yield(config) if block
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cloudflared-0.1.1 lib/cloudflared.rb