Module: Zendesk::Config
- Included in:
- Zendesk
- Defined in:
- lib/zendesk/config.rb
Overview
Defines constants and methods related to configuration
Constant Summary
- VALID_OPTIONS_KEYS =
An array of valid keys in the options hash when configuring a Zendesk::Client
[ :adapter, :consumer_key, :consumer_secret, :account, :email, :password, :format, :gateway, :oauth_token, :oauth_token_secret, :proxy, :user_agent ].freeze
- VALID_FORMATS =
Note:
Not all methods support the XML format.
An array of valid request/response formats
[ :json, :xml ].freeze
- DEFAULT_ADAPTER =
Note:
The default faraday adapter is Net::HTTP.
The adapter that will be used to connect if none is set
:patron- DEFAULT_CONSUMER_KEY =
By default, don't set an application key
nil- DEFAULT_CONSUMER_SECRET =
By default, don't set an application secret
nil- DEFAULT_FORMAT =
Note:
JSON is preferred over XML because it is more concise and faster to parse.
The response format appended to the path and sent in the 'Accept' header if none is set
:json- DEFAULT_OAUTH_TOKEN =
By default, don't set a user oauth token
nil- DEFAULT_OAUTH_TOKEN_SECRET =
By default, don't set a user oauth secret
nil- DEFAULT_PROXY =
By default, don't use a proxy server
nil- DEFAULT_USER_AGENT =
The user agent that will be sent to the API endpoint if none is set
"Zendesk Ruby Client #{Zendesk::VERSION}".freeze
- DEFAULT_GATEWAY =
nil
Class Method Summary (collapse)
-
+ (Object) extended(base)
When this module is extended, set all configuration options to their default values.
Instance Method Summary (collapse)
-
- (Object) options
Create a hash of options and their values.
-
- (Object) reset
Reset all configuration options to defaults.
Class Method Details
+ (Object) extended(base)
When this module is extended, set all configuration options to their default values
61 62 63 |
# File 'lib/zendesk/config.rb', line 61 def self.extended(base) base.reset end |
Instance Method Details
- (Object) options
Create a hash of options and their values
66 67 68 69 70 |
# File 'lib/zendesk/config.rb', line 66 def = {} VALID_OPTIONS_KEYS.each {|k| [k] = send(k)} end |
- (Object) reset
Reset all configuration options to defaults
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/zendesk/config.rb', line 73 def reset self.adapter = DEFAULT_ADAPTER self.account = nil self.email = nil self.password = nil self.consumer_key = DEFAULT_CONSUMER_KEY self.consumer_secret = DEFAULT_CONSUMER_SECRET self.format = DEFAULT_FORMAT self.oauth_token = DEFAULT_OAUTH_TOKEN self.oauth_token_secret = DEFAULT_OAUTH_TOKEN_SECRET self.proxy = DEFAULT_PROXY self.user_agent = DEFAULT_USER_AGENT self.gateway = DEFAULT_GATEWAY self end |