Class: OSCRuby::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/osc_ruby/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|config| ... } ⇒ Client

Returns a new instance of Client.

Yields:

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
# File 'lib/osc_ruby/client.rb', line 13

def initialize
    raise ArgumentError, "block not given" unless block_given?
    self.config ||= OSCRuby::Configuration.new
	yield(config)

	check_config
end

Instance Attribute Details

#configObject

The top-level class that handles configuration and connection to the Oracle Service Cloud REST API.



11
12
13
# File 'lib/osc_ruby/client.rb', line 11

def config
  @config
end

Instance Method Details

#check_configObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/osc_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