Module: RestClientAdapter::API

Included in:
HttpAbstraction
Defined in:
lib/ibm_cloud_rest/core/adapters/restclient.rb

Instance Method Summary collapse

Instance Method Details

#copy(uri, headers) ⇒ Object



38
39
40
41
42
# File 'lib/ibm_cloud_rest/core/adapters/restclient.rb', line 38

def copy(uri, headers)
  RestClient::Request.execute(  :method   => :copy,
                                :url      => uri,
                                :headers  => headers) 
end

#delete(uri, headers = {:accept => 'application/json'}) ⇒ Object



34
35
36
# File 'lib/ibm_cloud_rest/core/adapters/restclient.rb', line 34

def delete(uri, headers={:accept => 'application/json'})
  RestClient.delete(uri, headers)
end

#get(uri, headers = {:accept => 'application/json'}) ⇒ Object



19
20
21
22
23
24
# File 'lib/ibm_cloud_rest/core/adapters/restclient.rb', line 19

def get(uri, headers={:accept => 'application/json'})
  #RestClient.get(uri, headers)
			config = read_config
			rest_get=RestClient::Request.new(:method => :get, :url => uri, :headers => headers,:user => config['user'], :password => config['password'])
			rest_get.execute
end

#post(uri, payload, headers = {:accept => 'application/json'}) ⇒ Object



26
27
28
# File 'lib/ibm_cloud_rest/core/adapters/restclient.rb', line 26

def post(uri, payload, headers={:accept => 'application/json'})
  RestClient.post(uri, payload, headers)
end

#proxyObject



15
16
17
# File 'lib/ibm_cloud_rest/core/adapters/restclient.rb', line 15

def proxy
  RestClient.proxy
end

#proxy=(url) ⇒ Object



11
12
13
# File 'lib/ibm_cloud_rest/core/adapters/restclient.rb', line 11

def proxy=(url)
  RestClient.proxy = url
end

#put(uri, payload, headers = {:accept => 'application/json'}) ⇒ Object



30
31
32
# File 'lib/ibm_cloud_rest/core/adapters/restclient.rb', line 30

def put(uri, payload, headers={:accept => 'application/json'})
  RestClient.put(uri, payload, headers)
end

#read_configObject



4
5
6
7
8
9
10
# File 'lib/ibm_cloud_rest/core/adapters/restclient.rb', line 4

def read_config
	if File.exists? File.expand_path('~/.isbdtcrc')
		return YAML.load(File.new(File.expand_path('~/.isbdtcrc')))
	else
      raise "Error while read config file"
	end
end