Class: Cloudhdr::HTTP::NetHTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudhdr/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.


26
27
28
29
30
31
32
33
34
35
# File 'lib/cloudhdr/http/net_http.rb', line 26

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

Instance Attribute Details

#bodyObject

Returns the value of attribute body


10
11
12
# File 'lib/cloudhdr/http/net_http.rb', line 10

def body
  @body
end

#headersObject

Returns the value of attribute headers


10
11
12
# File 'lib/cloudhdr/http/net_http.rb', line 10

def headers
  @headers
end

#methodObject

Returns the value of attribute method


10
11
12
# File 'lib/cloudhdr/http/net_http.rb', line 10

def method
  @method
end

#optionsObject

Returns the value of attribute options


10
11
12
# File 'lib/cloudhdr/http/net_http.rb', line 10

def options
  @options
end

#paramsObject

Returns the value of attribute params


10
11
12
# File 'lib/cloudhdr/http/net_http.rb', line 10

def params
  @params
end

#skip_ssl_verifyObject

Returns the value of attribute skip_ssl_verify


10
11
12
# File 'lib/cloudhdr/http/net_http.rb', line 10

def skip_ssl_verify
  @skip_ssl_verify
end

#timeoutObject

Returns the value of attribute timeout


10
11
12
# File 'lib/cloudhdr/http/net_http.rb', line 10

def timeout
  @timeout
end

#uri=(value) ⇒ Object

Sets the attribute uri

Parameters:

  • value

    the value to set the attribute uri to.


10
11
12
# File 'lib/cloudhdr/http/net_http.rb', line 10

def uri=(value)
  @uri = value
end

#urlObject

Returns the value of attribute url


10
11
12
# File 'lib/cloudhdr/http/net_http.rb', line 10

def url
  @url
end

Class Method Details

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


49
50
51
# File 'lib/cloudhdr/http/net_http.rb', line 49

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

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


45
46
47
# File 'lib/cloudhdr/http/net_http.rb', line 45

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

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


37
38
39
# File 'lib/cloudhdr/http/net_http.rb', line 37

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

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


41
42
43
# File 'lib/cloudhdr/http/net_http.rb', line 41

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

Instance Method Details

#performObject


53
54
55
# File 'lib/cloudhdr/http/net_http.rb', line 53

def perform
  deliver(http, request)
end