Class: RubyIsds::Configuration
- Inherits:
-
Object
- Object
- RubyIsds::Configuration
- Defined in:
- lib/ruby_isds/configuration.rb
Constant Summary collapse
- ALLOWED_PRODUCTION_SYNTAX =
[:production, 'production'].freeze
Instance Attribute Summary collapse
-
#api_url ⇒ Object
writeonly
Sets the attribute api_url.
- #data_box ⇒ Object
-
#env ⇒ Object
env values: :development (default) :production.
- #password ⇒ Object
- #username ⇒ Object
Instance Method Summary collapse
- #api_domain ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #production? ⇒ Boolean
- #xml_url ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 |
# File 'lib/ruby_isds/configuration.rb', line 7 def initialize @username = nil @password = nil @data_box = nil @env = nil end |
Instance Attribute Details
#api_url=(value) ⇒ Object (writeonly)
Sets the attribute api_url
3 4 5 |
# File 'lib/ruby_isds/configuration.rb', line 3 def api_url=(value) @api_url = value end |
#data_box ⇒ Object
14 15 16 17 |
# File 'lib/ruby_isds/configuration.rb', line 14 def data_box raise ConfigNotSet, 'data_box' unless @data_box @data_box end |
#env ⇒ Object
env values:
:development (default)
:production
34 35 36 37 |
# File 'lib/ruby_isds/configuration.rb', line 34 def env return :development unless @env @env end |
#password ⇒ Object
24 25 26 27 |
# File 'lib/ruby_isds/configuration.rb', line 24 def password raise ConfigNotSet, 'password' unless @password @password end |
#username ⇒ Object
19 20 21 22 |
# File 'lib/ruby_isds/configuration.rb', line 19 def username raise ConfigNotSet, 'username' unless @username @username end |
Instance Method Details
#api_domain ⇒ Object
39 40 41 42 |
# File 'lib/ruby_isds/configuration.rb', line 39 def api_domain return 'https://ws1.mojedatovaschranka.cz' if production? 'https://ws1.czebox.cz' end |
#production? ⇒ Boolean
49 50 51 |
# File 'lib/ruby_isds/configuration.rb', line 49 def production? ALLOWED_PRODUCTION_SYNTAX.include?(@env) end |
#xml_url ⇒ Object
44 45 46 47 |
# File 'lib/ruby_isds/configuration.rb', line 44 def xml_url return 'mojedatovaschranka.cz' if production? 'czechpoint.cz' end |