Module: Smspilot::Configuration
- Included in:
- Smspilot
- Defined in:
- lib/smspilot/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[:endpoint, :user_agent, :adapter, :timeout, :api_key, :logger, :login, :password]
- DEFAULT_ADAPTER =
:net_http
- DEFAULT_ENDPOINT =
'http://smspilot.ru/api2.php'
- DEFAULT_USER_AGENT =
"smspilot gem #{Smspilot::VERSION}".freeze
- DEFAULT_TIMEOUT =
5
- DEFAILT_API_KEY =
nil
- DEFAILT_LOGIN =
nil
- DEFAILT_PASSWORD =
nil
- DEFAILT_LOGGER =
Logger.new("log/smspilot.log")
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
23 24 25 |
# File 'lib/smspilot/configuration.rb', line 23 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
19 20 21 |
# File 'lib/smspilot/configuration.rb', line 19 def configure yield self end |
#options ⇒ Object
27 28 29 30 31 |
# File 'lib/smspilot/configuration.rb', line 27 def = {} VALID_OPTIONS_KEYS.each{|k| [k] = send(k)} end |
#reset ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/smspilot/configuration.rb', line 33 def reset self.adapter = DEFAULT_ADAPTER self.endpoint = DEFAULT_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self.timeout = DEFAULT_TIMEOUT self.api_key = DEFAILT_API_KEY self.login = DEFAILT_LOGIN self.password = DEFAILT_PASSWORD self.logger = DEFAILT_LOGGER self end |