Class: PassaporteWeb::Http

Inherits:
Object
  • Object
show all
Defined in:
lib/passaporte_web/http.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.custom_auth_get(user, password, path = '/', params = {}) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/passaporte_web/http.rb', line 23

def self.custom_auth_get(user, password, path='/', params={})
  credentials = "Basic #{::Base64.strict_encode64("#{user}:#{password}")}"
  custom_params = common_params('application').merge({authorization: credentials})
  RestClient.get(
    pw_url(path),
    {params: params}.merge(custom_params)
  )
end

.delete(path = '/', params = {}, type = 'application') ⇒ Object



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

def self.delete(path='/', params={}, type='application')
  get_or_delete(:delete, path, params, type)
end

.get(path = '/', params = {}, type = 'application') ⇒ Object



7
8
9
# File 'lib/passaporte_web/http.rb', line 7

def self.get(path='/', params={}, type='application')
  get_or_delete(:get, path, params, type)
end

.post(path = '/', body = {}, params = {}, type = 'application') ⇒ Object



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

def self.post(path='/', body={}, params={}, type='application')
  put_or_post(:post, path, body, params, type)
end

.put(path = '/', body = {}, params = {}, type = 'application') ⇒ Object



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

def self.put(path='/', body={}, params={}, type='application')
  put_or_post(:put, path, body, params, type)
end