Class: Xio::HTTP::NetHTTP

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, url, options) ⇒ NetHTTP

Returns a new instance of NetHTTP.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/xio/http/net_http.rb', line 7

def initialize(method, url, options)
  @method          = method
  @url             = url
  @options         = options.dup
  @body            = @options.delete(:body)
  @params          = @options.delete(:params)
  @headers         = @options.delete(:headers)
  @timeout         = @options.delete(:timeout)
  @skip_ssl_verify = @options.delete(:skip_ssl_verify)
  @ca_file         = @options.delete(:ca_file)
  @ca_path         = @options.delete(:ca_path)
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



5
6
7
# File 'lib/xio/http/net_http.rb', line 5

def body
  @body
end

#ca_fileObject

Returns the value of attribute ca_file.



5
6
7
# File 'lib/xio/http/net_http.rb', line 5

def ca_file
  @ca_file
end

#ca_pathObject

Returns the value of attribute ca_path.



5
6
7
# File 'lib/xio/http/net_http.rb', line 5

def ca_path
  @ca_path
end

#headersObject

Returns the value of attribute headers.



5
6
7
# File 'lib/xio/http/net_http.rb', line 5

def headers
  @headers
end

#methodObject

Returns the value of attribute method.



5
6
7
# File 'lib/xio/http/net_http.rb', line 5

def method
  @method
end

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/xio/http/net_http.rb', line 5

def options
  @options
end

#paramsObject

Returns the value of attribute params.



5
6
7
# File 'lib/xio/http/net_http.rb', line 5

def params
  @params
end

#skip_ssl_verifyObject

Returns the value of attribute skip_ssl_verify.



5
6
7
# File 'lib/xio/http/net_http.rb', line 5

def skip_ssl_verify
  @skip_ssl_verify
end

#timeoutObject

Returns the value of attribute timeout.



5
6
7
# File 'lib/xio/http/net_http.rb', line 5

def timeout
  @timeout
end

#uri=(value) ⇒ Object

Sets the attribute uri

Parameters:

  • value

    the value to set the attribute uri to.



5
6
7
# File 'lib/xio/http/net_http.rb', line 5

def uri=(value)
  @uri = value
end

#urlObject

Returns the value of attribute url.



5
6
7
# File 'lib/xio/http/net_http.rb', line 5

def url
  @url
end

Class Method Details

.delete(url, options = {}) ⇒ Object



32
33
34
# File 'lib/xio/http/net_http.rb', line 32

def self.delete(url, options={})
  new(:delete, url, options).perform
end

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



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

def self.get(url, options={})
  new(:get, url, options).perform
end

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



20
21
22
# File 'lib/xio/http/net_http.rb', line 20

def self.post(url, options={})
  new(:post, url, options).perform
end

.put(url, options = {}) ⇒ Object



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

def self.put(url, options={})
  new(:put, url, options).perform
end

Instance Method Details

#performObject



36
37
38
# File 'lib/xio/http/net_http.rb', line 36

def perform
  deliver(http, request)
end