Class: ZendeskAPI::Configuration
- Inherits:
-
Object
- Object
- ZendeskAPI::Configuration
- Defined in:
- lib/zendesk_api/configuration.rb
Overview
Holds the configuration options for the client and connection
Instance Attribute Summary (collapse)
-
- (String) access_token
OAuth2 access_token.
-
- (Symbol) adapter
Faraday adapter.
-
- (Boolean) allow_http
Whether to allow non-HTTPS connections for development purposes.
-
- (ZendeskAPI::LRUCache) cache
Use this cache instead of default ZendeskAPI::LRUCache.new
-
must respond to read/write/fetch e.g.
-
-
- (Hash) client_options
Client configurations (eg ssh config) to pass to Faraday.
-
- (Logger) logger
Logger to use when logging requests.
-
- (String) password
The basic auth password.
-
- (Boolean) retry
Whether to attempt to retry when rate-limited (http status: 429).
-
- (String) token
The basic auth token.
-
- (String) url
The API url.
-
- (String) username
The basic auth username.
Instance Method Summary (collapse)
-
- (Configuration) initialize
constructor
A new instance of Configuration.
-
- (Hash) options
Sets accept and user_agent headers, and url.
Constructor Details
- (Configuration) initialize
A new instance of Configuration
40 41 42 43 44 |
# File 'lib/zendesk_api/configuration.rb', line 40 def initialize @client_options = {} self.cache = ZendeskAPI::LRUCache.new(1000) end |
Instance Attribute Details
- (String) access_token
OAuth2 access_token
32 33 34 |
# File 'lib/zendesk_api/configuration.rb', line 32 def access_token @access_token end |
- (Symbol) adapter
Faraday adapter
26 27 28 |
# File 'lib/zendesk_api/configuration.rb', line 26 def adapter @adapter end |
- (Boolean) allow_http
Whether to allow non-HTTPS connections for development purposes.
29 30 31 |
# File 'lib/zendesk_api/configuration.rb', line 29 def allow_http @allow_http end |
- (ZendeskAPI::LRUCache) cache
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
38 39 40 |
# File 'lib/zendesk_api/configuration.rb', line 38 def cache @cache end |
- (Hash) client_options
Client configurations (eg ssh config) to pass to Faraday
23 24 25 |
# File 'lib/zendesk_api/configuration.rb', line 23 def @client_options end |
- (Logger) logger
Logger to use when logging requests.
20 21 22 |
# File 'lib/zendesk_api/configuration.rb', line 20 def logger @logger end |
- (String) password
The basic auth password.
8 9 10 |
# File 'lib/zendesk_api/configuration.rb', line 8 def password @password end |
- (Boolean) retry
Whether to attempt to retry when rate-limited (http status: 429).
17 18 19 |
# File 'lib/zendesk_api/configuration.rb', line 17 def retry @retry end |
- (String) token
The basic auth token.
11 12 13 |
# File 'lib/zendesk_api/configuration.rb', line 11 def token @token end |
- (String) url
The API url. Must be https unless #allow_http is set.
14 15 16 |
# File 'lib/zendesk_api/configuration.rb', line 14 def url @url end |
- (String) username
The basic auth username.
5 6 7 |
# File 'lib/zendesk_api/configuration.rb', line 5 def username @username end |
Instance Method Details
- (Hash) options
Sets accept and user_agent headers, and url.
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/zendesk_api/configuration.rb', line 49 def { :headers => { :accept => 'application/json', :accept_encoding => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', :user_agent => "ZendeskAPI API #{ZendeskAPI::VERSION}" }, :url => @url }.merge() end |