Module: RestClient

Defined in:
lib/restclient_with_cert.rb

Class Method Summary collapse

Class Method Details

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



23
24
25
# File 'lib/restclient_with_cert.rb', line 23

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

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



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

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



15
16
17
# File 'lib/restclient_with_cert.rb', line 15

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



19
20
21
# File 'lib/restclient_with_cert.rb', line 19

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

.ssl_settingsObject



4
5
6
7
8
9
# File 'lib/restclient_with_cert.rb', line 4

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