Class: Valvat::Configuration
- Inherits:
-
Object
- Object
- Valvat::Configuration
- Includes:
- Singleton
- Defined in:
- lib/valvat/configuration.rb
Constant Summary collapse
- DEFAULTS =
{ # Set to true to always raise error, even on temporary maintenance downtime errors, # set to false to suppress all errors and return nil instead raise_error: nil, # Set options for the http client. # These options are directly passed to `Net::HTTP.start` http: {}.freeze, # Return details hash on lookup instead of boolean detail: false, # Your own VAT number used on lookup requester: nil, # Skip local validation on lookup skip_local_validation: false, # Use lookup via HMRC for VAT numbers from the UK # if set to false lookup will always return false for UK VAT numbers # HMRC options: # :client_id and :client_secret API credentials for OAuth 2.0 Authentication # :sandbox Use sandboxed instead of production API (defaults to false) # See more details https://developer.service.hmrc.gov.uk/api-documentation/docs/development-practices # uk: false, # Rate limit for Lookup and HMRC authentication requests rate_limit: 5 }.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #configure(options) ⇒ Object
- #dig(*keys) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
72 73 74 |
# File 'lib/valvat/configuration.rb', line 72 def initialize @data = DEFAULTS.clone end |
Class Method Details
.initialize ⇒ Object
56 57 58 |
# File 'lib/valvat/configuration.rb', line 56 def self.initialize instance.send(:initialize) end |
Instance Method Details
#[](key) ⇒ Object
60 61 62 |
# File 'lib/valvat/configuration.rb', line 60 def [](key) @data[key] end |
#configure(options) ⇒ Object
68 69 70 |
# File 'lib/valvat/configuration.rb', line 68 def configure() @data = Utils.deep_merge(@data, Utils.deep_symbolize_keys()) end |
#dig(*keys) ⇒ Object
64 65 66 |
# File 'lib/valvat/configuration.rb', line 64 def dig(*keys) @data.dig(*keys) end |