lib/osc_ruby/client.rb in osc_ruby-0.7.1 vs lib/osc_ruby/client.rb in osc_ruby-1.0.2

- old
+ new

@@ -1,41 +1,41 @@ -require 'osc_ruby/version' -require 'osc_ruby/configuration' - - -module OSCRuby - - class Client - # The top-level class that handles configuration and connection to the Oracle Service Cloud REST API. - - attr_accessor :config - - def initialize - raise ArgumentError, "block not given" unless block_given? - self.config ||= OSCRuby::Configuration.new - yield(config) - - check_config - optional_check - end - - 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 - - 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 - end +require 'osc_ruby/version' +require 'osc_ruby/configuration' + + +module OSCRuby + + class Client + # The top-level class that handles configuration and connection to the Oracle Service Cloud REST API. + + attr_accessor :config + + def initialize + raise ArgumentError, "block not given" unless block_given? + self.config ||= OSCRuby::Configuration.new + yield(config) + + check_config + optional_check + end + + 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 + + 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 + end end \ No newline at end of file