class ZendeskAPI::Configuration

Holds the configuration options for the client and connection

Attributes

access_token[RW]

@return [String] OAuth2 access_token

adapter[RW]

@return [Symbol] Faraday adapter

allow_http[RW]

@return [Boolean] Whether to allow non-HTTPS connections for development purposes.

cache[RW]

Use this cache instead of default ZendeskAPI::LRUCache.new

  • must respond to read/write/fetch e.g. ActiveSupport::Cache::MemoryStore.new)

  • pass false to disable caching

@return [ZendeskAPI::LRUCache]

client_options[RW]

@return [Hash] Client configurations (eg ssh config) to pass to Faraday

logger[RW]

@return [Logger] Logger to use when logging requests.

password[RW]

@return [String] The basic auth password.

raise_error_when_rate_limited[RW]

@return [Boolean] Whether to raise error when rate-limited (http status: 429).

retry[RW]

@return [Boolean] Whether to attempt to retry when rate-limited (http status: 429).

retry_codes[RW]

specify the server error codes in which you want a retry to be attempted

retry_on_exception[RW]

specify if you want a (network layer) exception to elicit a retry

token[RW]

@return [String] The basic auth token.

url[RW]

@return [String] The API url. Must be https unless {#allow_http} is set.

url_based_access_token[RW]
use_resource_cache[RW]

@return [Boolean] Whether to use resource_cache or not

username[RW]

@return [String] The basic auth username.

Public Class Methods

new() click to toggle source
# File lib/zendesk_api/configuration.rb, line 54
def initialize
  @client_options = {}
  @use_resource_cache = true

  self.cache = ZendeskAPI::LRUCache.new(1000)
end

Public Instance Methods

options() click to toggle source

Sets accept and user_agent headers, and url.

@return [Hash] Faraday-formatted hash of options.

# File lib/zendesk_api/configuration.rb, line 64
def options
  {
    :headers => {
      :accept => 'application/json',
      :accept_encoding => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
      :user_agent => "ZendeskAPI Ruby #{ZendeskAPI::VERSION}"
    },
    :request => {
      :open_timeout => 10,
      :timeout => 60
    },
    :url => @url
  }.merge(client_options)
end