Class: ZendeskAPI::Configuration
- Inherits:
-
Object
- Object
- ZendeskAPI::Configuration
- Defined in:
- lib/zendesk_api/configuration.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Symbol
Faraday adapter.
-
#allow_http ⇒ Boolean
Whether to allow non-HTTPS connections for development purposes.
-
#cache ⇒ ZendeskAPI::LRUCache
Use this cache instead of default ZendeskAPI::LRUCache.new - must respond to read/write/fetch e.g.
-
#client_options ⇒ Hash
Client configurations (eg ssh config) to pass to Faraday.
-
#logger ⇒ Logger
Logger to use when logging requests.
-
#password ⇒ String
The basic auth password.
-
#retry ⇒ Boolean
Whether to attempt to retry when rate-limited (http status: 429).
-
#url ⇒ String
The API url.
-
#username ⇒ String
The basic auth username.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#options ⇒ Hash
Sets accept and user_agent headers, and url.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
33 34 35 36 |
# File 'lib/zendesk_api/configuration.rb', line 33 def initialize @client_options = {} self.cache = ZendeskAPI::LRUCache.new(1000) end |
Instance Attribute Details
#adapter ⇒ Symbol
Returns Faraday adapter.
22 23 24 |
# File 'lib/zendesk_api/configuration.rb', line 22 def adapter @adapter end |
#allow_http ⇒ Boolean
Returns Whether to allow non-HTTPS connections for development purposes.
25 26 27 |
# File 'lib/zendesk_api/configuration.rb', line 25 def allow_http @allow_http end |
#cache ⇒ ZendeskAPI::LRUCache
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
31 32 33 |
# File 'lib/zendesk_api/configuration.rb', line 31 def cache @cache end |
#client_options ⇒ Hash
Returns Client configurations (eg ssh config) to pass to Faraday.
19 20 21 |
# File 'lib/zendesk_api/configuration.rb', line 19 def @client_options end |
#logger ⇒ Logger
Returns Logger to use when logging requests.
16 17 18 |
# File 'lib/zendesk_api/configuration.rb', line 16 def logger @logger end |
#password ⇒ String
Returns The basic auth password.
7 8 9 |
# File 'lib/zendesk_api/configuration.rb', line 7 def password @password end |
#retry ⇒ Boolean
Returns Whether to attempt to retry when rate-limited (http status: 429).
13 14 15 |
# File 'lib/zendesk_api/configuration.rb', line 13 def retry @retry end |
#url ⇒ String
Returns The API url. Must be https unless #allow_http is set.
10 11 12 |
# File 'lib/zendesk_api/configuration.rb', line 10 def url @url end |
#username ⇒ String
Returns The basic auth username.
4 5 6 |
# File 'lib/zendesk_api/configuration.rb', line 4 def username @username end |
Instance Method Details
#options ⇒ Hash
Sets accept and user_agent headers, and url.
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/zendesk_api/configuration.rb', line 41 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 |