Class: Phocoder::HTTP::NetHTTP

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



24
25
26
27
28
29
30
31
32
33
# File 'lib/phocoder/http/net_http.rb', line 24

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.



8
9
10
# File 'lib/phocoder/http/net_http.rb', line 8

def body
  @body
end

#headersObject

Returns the value of attribute headers.



8
9
10
# File 'lib/phocoder/http/net_http.rb', line 8

def headers
  @headers
end

#methodObject

Returns the value of attribute method.



8
9
10
# File 'lib/phocoder/http/net_http.rb', line 8

def method
  @method
end

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/phocoder/http/net_http.rb', line 8

def options
  @options
end

#paramsObject

Returns the value of attribute params.



8
9
10
# File 'lib/phocoder/http/net_http.rb', line 8

def params
  @params
end

#skip_ssl_verifyObject

Returns the value of attribute skip_ssl_verify.



8
9
10
# File 'lib/phocoder/http/net_http.rb', line 8

def skip_ssl_verify
  @skip_ssl_verify
end

#timeoutObject

Returns the value of attribute timeout.



8
9
10
# File 'lib/phocoder/http/net_http.rb', line 8

def timeout
  @timeout
end

#uri=(value) ⇒ Object

Sets the attribute uri

Parameters:

  • value

    the value to set the attribute uri to.



8
9
10
# File 'lib/phocoder/http/net_http.rb', line 8

def uri=(value)
  @uri = value
end

#urlObject

Returns the value of attribute url.



8
9
10
# File 'lib/phocoder/http/net_http.rb', line 8

def url
  @url
end

Class Method Details

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



47
48
49
# File 'lib/phocoder/http/net_http.rb', line 47

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

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



43
44
45
# File 'lib/phocoder/http/net_http.rb', line 43

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

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



35
36
37
# File 'lib/phocoder/http/net_http.rb', line 35

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

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



39
40
41
# File 'lib/phocoder/http/net_http.rb', line 39

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

Instance Method Details

#performObject



51
52
53
# File 'lib/phocoder/http/net_http.rb', line 51

def perform
  deliver(http, request)
end