Class: HttpRequestImpl

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

Overview

© 2016-2019 Resurface Labs Inc.

Direct Known Subclasses

Resurfaceio::HttpRequestImpl

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHttpRequestImpl

Returns a new instance of HttpRequestImpl.



6
7
8
9
10
11
# File 'lib/resurfaceio/http_request_impl.rb', line 6

def initialize
  @form_hash = Hash.new
  @headers = Hash.new
  @query_hash = Hash.new
  @session = Hash.new
end

Instance Attribute Details

#request_methodObject

Returns the value of attribute request_method.



48
49
50
# File 'lib/resurfaceio/http_request_impl.rb', line 48

def request_method
  @request_method
end

#urlObject

Returns the value of attribute url.



49
50
51
# File 'lib/resurfaceio/http_request_impl.rb', line 49

def url
  @url
end

Instance Method Details

#add_header(key, value) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/resurfaceio/http_request_impl.rb', line 13

def add_header(key, value)
  unless value.nil?
    existing = @headers[key]
    if existing.nil?
      @headers[key] = value
    else
      @headers[key] = "#{existing}, #{value}"
    end
  end
end

#content_typeObject



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

def content_type
  @headers['CONTENT_TYPE']
end

#content_type=(content_type) ⇒ Object



28
29
30
# File 'lib/resurfaceio/http_request_impl.rb', line 28

def content_type=(content_type)
  @headers['CONTENT_TYPE'] = content_type
end

#form_hashObject



32
33
34
# File 'lib/resurfaceio/http_request_impl.rb', line 32

def form_hash
  @form_hash
end

#headersObject



36
37
38
# File 'lib/resurfaceio/http_request_impl.rb', line 36

def headers
  @headers
end

#query_hashObject



40
41
42
# File 'lib/resurfaceio/http_request_impl.rb', line 40

def query_hash
  @query_hash
end

#sessionObject



44
45
46
# File 'lib/resurfaceio/http_request_impl.rb', line 44

def session
  @session
end