Module: RestClient

Defined in:
lib/restclient_with_ssl_support.rb

Class Method Summary collapse

Class Method Details

.delete(url, headers = {}, &block) ⇒ Object



24
25
26
# File 'lib/restclient_with_ssl_support.rb', line 24

def self.delete(url, headers={}, &block)
  Request.execute(ssl_settings.merge(:method => :delete, :url => url, :headers => headers), &block)
end

.get(url, headers = {}, &block) ⇒ Object



12
13
14
# File 'lib/restclient_with_ssl_support.rb', line 12

def self.get(url, headers={}, &block)
  Request.execute(ssl_settings.merge(:method => :get, :url => url, :headers => headers), &block)
end

.post(url, payload, headers = {}, &block) ⇒ Object



16
17
18
# File 'lib/restclient_with_ssl_support.rb', line 16

def self.post(url, payload, headers={}, &block)
  Request.execute(ssl_settings.merge(:method => :post, :url => url, :payload => payload, :headers => headers), &block)
end

.put(url, payload, headers = {}, &block) ⇒ Object



20
21
22
# File 'lib/restclient_with_ssl_support.rb', line 20

def self.put(url, payload, headers={}, &block)
  Request.execute(ssl_settings.merge(:method => :put, :url => url, :payload => payload, :headers => headers), &block)
end

.ssl_settingsObject



5
6
7
8
9
10
# File 'lib/restclient_with_ssl_support.rb', line 5

def self.ssl_settings
  {
    :verify_ssl => OpenSSL::SSL::VERIFY_PEER,
    :ssl_ca_file => File.join(File.dirname(__FILE__), 'cert')
  }
end