Module: Aladtec::Configuration
- Included in:
- Aladtec
- Defined in:
- lib/aladtec/configuration.rb
Constant Summary collapse
- VALID_CONNECTION_KEYS =
[:endpoint, :method, :user_agent].freeze
- VALID_OPTIONS_KEYS =
[:acc_id, :acc_key].freeze
- VALID_CONFIG_KEYS =
VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS
- DEFAULT_ENDPOINT =
"https://secure.emsmanager.net/api/index.php".freeze
- DEFAULT_METHOD =
:post
- DEFAULT_USER_AGENT =
"Aladtec API Ruby Gem #{Aladtec::VERSION}".freeze
- DEFAULT_ACC_ID =
nil
- DEFAULT_ACC_KEY =
nil
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
16 17 18 |
# File 'lib/aladtec/configuration.rb', line 16 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
29 30 31 |
# File 'lib/aladtec/configuration.rb', line 29 def configure yield self end |
#options ⇒ Object
33 34 35 |
# File 'lib/aladtec/configuration.rb', line 33 def Hash[ * VALID_CONFIG_KEYS.map { |key| [key, public_send(key)] }.flatten ] end |
#reset ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/aladtec/configuration.rb', line 20 def reset self.endpoint = DEFAULT_ENDPOINT self.method = DEFAULT_METHOD self.user_agent = DEFAULT_USER_AGENT self.acc_id = DEFAULT_ACC_ID self.acc_key = DEFAULT_ACC_KEY end |