Class: Asana::Client::Configuration Private
- Inherits:
-
Object
- Object
- Asana::Client::Configuration
- Defined in:
- lib/asana/client/configuration.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Represents a configuration DSL for an Asana::Client.
Instance Method Summary collapse
-
#authentication(type, value) ⇒ void
Sets an authentication strategy.
-
#configure_faraday(&config) ⇒ void
Sets a custom configuration block for the Faraday connection.
-
#debug_mode ⇒ void
Configures the client in debug mode, which will print verbose information on STDERR.
-
#default_headers(value) ⇒ void
Configures the client to always send the given headers.
-
#faraday_adapter(adapter) ⇒ void
Sets a custom network adapter for Faraday.
-
#initialize ⇒ Configuration
constructor
Initializes an empty configuration object.
-
#log_asana_change_warnings(value) ⇒ void
Configures the client to log Asana-Change warnings on STDERR.
-
#to_h ⇒ Hash
Returns the configuration Hash.
Constructor Details
#initialize ⇒ Configuration
Initializes an empty configuration object.
18 19 20 21 22 |
# File 'lib/asana/client/configuration.rb', line 18 def initialize @configuration = { :log_asana_change_warnings => true } end |
Instance Method Details
#authentication(type, value) ⇒ void
This method returns an undefined value.
Sets an authentication strategy.
33 34 35 36 37 38 39 40 |
# File 'lib/asana/client/configuration.rb', line 33 def authentication(type, value) auth = case type when :oauth2 then oauth2(value) when :access_token then from_bearer_token(value) else error "unsupported authentication type #{type}" end @configuration[:authentication] = auth end |
#configure_faraday(&config) ⇒ void
This method returns an undefined value.
Sets a custom configuration block for the Faraday connection.
56 57 58 |
# File 'lib/asana/client/configuration.rb', line 56 def configure_faraday(&config) @configuration[:faraday_configuration] = config end |
#debug_mode ⇒ void
This method returns an undefined value.
Configures the client in debug mode, which will print verbose information on STDERR.
64 65 66 |
# File 'lib/asana/client/configuration.rb', line 64 def debug_mode @configuration[:debug_mode] = true end |
#default_headers(value) ⇒ void
This method returns an undefined value.
Configures the client to always send the given headers
78 79 80 |
# File 'lib/asana/client/configuration.rb', line 78 def default_headers(value) @configuration[:default_headers] = value end |
#faraday_adapter(adapter) ⇒ void
This method returns an undefined value.
Sets a custom network adapter for Faraday.
47 48 49 |
# File 'lib/asana/client/configuration.rb', line 47 def faraday_adapter(adapter) @configuration[:faraday_adapter] = adapter end |
#log_asana_change_warnings(value) ⇒ void
This method returns an undefined value.
Configures the client to log Asana-Change warnings on STDERR.
71 72 73 |
# File 'lib/asana/client/configuration.rb', line 71 def log_asana_change_warnings(value) @configuration[:log_asana_change_warnings] = !!value end |
#to_h ⇒ Hash
Returns the configuration Hash.
84 85 86 |
# File 'lib/asana/client/configuration.rb', line 84 def to_h @configuration end |