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}".freeze
- DEFAULT_PAGINATION =
RequestPagination::PagingInfoPager
- DEFAULT_PAGE_SIZE =
25
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
21 22 23 |
# File 'lib/hudu/configuration.rb', line 21 def self.extended(base) base.reset end |
Instance Method Details
#options ⇒ Object
Create a hash of options and their values
26 27 28 29 30 |
# File 'lib/hudu/configuration.rb', line 26 def VALID_OPTIONS_KEYS.inject({}) do |option, key| option.merge!(key => send(key)) end end |
#reset ⇒ Object
Reset all configuration options to defaults
33 34 35 36 37 38 39 40 |
# File 'lib/hudu/configuration.rb', line 33 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 |