Class: Zencoder::HTTP::NetHTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/zencoder/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
# File 'lib/zencoder/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)
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



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

def body
  @body
end

#headersObject

Returns the value of attribute headers.



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

def headers
  @headers
end

#methodObject

Returns the value of attribute method.



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

def method
  @method
end

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

#paramsObject

Returns the value of attribute params.



5
6
7
# File 'lib/zencoder/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/zencoder/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/zencoder/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/zencoder/http/net_http.rb', line 5

def uri=(value)
  @uri = value
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end

Class Method Details

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



30
31
32
# File 'lib/zencoder/http/net_http.rb', line 30

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

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



26
27
28
# File 'lib/zencoder/http/net_http.rb', line 26

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

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



18
19
20
# File 'lib/zencoder/http/net_http.rb', line 18

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

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



22
23
24
# File 'lib/zencoder/http/net_http.rb', line 22

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

Instance Method Details

#performObject



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

def perform
  deliver(http, request)
end