Module: Hudu::Configuration
Overview
Defines constants and methods related to configuration
Constant Summary collapse
- VALID_OPTIONS_KEYS =
An array of additional valid keys in the options hash when configuring a [Hudu::API]
(WrAPI::Configuration::VALID_OPTIONS_KEYS + [:api_key]).freeze
- DEFAULT_UA =
"Ruby Hudu API wrapper #{Hudu::VERSION}"
- DEFAULT_PAGINATION =
RequestPagination::PagingInfoPager
- DEFAULT_PAGE_SIZE =
100
Class Method Summary collapse
-
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default values.
Instance Method Summary collapse
-
#options ⇒ Object
Create a hash of options and their values.
-
#reset ⇒ Object
Reset all configuration options to defaults.
Class Method Details
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default values
23 24 25 |
# File 'lib/hudu/configuration.rb', line 23 def self.extended(base) base.reset end |
Instance Method Details
#options ⇒ Object
Create a hash of options and their values
28 29 30 31 32 |
# File 'lib/hudu/configuration.rb', line 28 def VALID_OPTIONS_KEYS.inject({}) do |option, key| option.merge!(key => send(key)) end end |
#reset ⇒ Object
Reset all configuration options to defaults
35 36 37 38 39 40 41 42 |
# File 'lib/hudu/configuration.rb', line 35 def reset super self.api_key = nil self.endpoint = nil self.user_agent = DEFAULT_UA self.page_size = DEFAULT_PAGE_SIZE self.pagination_class = DEFAULT_PAGINATION end |