Class: HTTP::Client

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

Class Method Summary collapse

Class Method Details

.base_uriObject



38
39
40
# File 'lib/http/http.rb', line 38

def base_uri
  Basement.default_options[:base_uri].sub 'http://', ''
end

.base_uri=(value) ⇒ Object



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

def base_uri=(value)
  Basement.base_uri value
end

.basic_auth(u, v) ⇒ Object



42
43
44
# File 'lib/http/http.rb', line 42

def basic_auth(u, v)
  Basement.basic_auth u, v
end

.get(path, options = {}) ⇒ Object



28
29
30
31
# File 'lib/http/http.rb', line 28

def get(path, options = {})
  res = Basement.get(path, options);
  Response.new res.parsed_response, res.code, res.headers, res.response
end

.optionsObject



46
47
48
# File 'lib/http/http.rb', line 46

def options
  Basement.default_options
end

.post(path, options = {}) ⇒ Object



33
34
35
36
# File 'lib/http/http.rb', line 33

def post(path, options = {})
  res = Basement.post(path, options);
  Response.new res.parsed_response, res.code, res.headers, res.response
end