Class: OSvCRuby::Client
- Inherits:
-
Object
- Object
- OSvCRuby::Client
- Defined in:
- lib/osvc_ruby/client.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
The top-level class that handles configuration and connection to the Oracle Service Cloud REST API.
Instance Method Summary collapse
- #check_config ⇒ Object
-
#initialize {|config| ... } ⇒ Client
constructor
A new instance of Client.
- #optional_check ⇒ Object
Constructor Details
#initialize {|config| ... } ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 17 18 19 |
# File 'lib/osvc_ruby/client.rb', line 12 def initialize raise ArgumentError, "block not given" unless block_given? self.config ||= OSvCRuby::Configuration.new yield(config) check_config optional_check end |
Instance Attribute Details
#config ⇒ Object
The top-level class that handles configuration and connection to the Oracle Service Cloud REST API.
10 11 12 |
# File 'lib/osvc_ruby/client.rb', line 10 def config @config end |
Instance Method Details
#check_config ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/osvc_ruby/client.rb', line 21 def check_config if config.interface =='' raise ArgumentError, "Interface cannot be nil or blank" elsif config.username =='' raise ArgumentError, "Username cannot be nil or blank" elsif config.password =='' raise ArgumentError, "Password cannot be nil or blank" end true end |
#optional_check ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/osvc_ruby/client.rb', line 33 def optional_check if config.no_ssl_verify.class != FalseClass && config.no_ssl_verify.class != TrueClass raise ArgumentError, "The no SSL verification setting must be set to true or false" elsif config.version.nil? raise ArgumentError, "Connect version cannot be null" end end |