Class: Authograph::Adapters::Http
- Defined in:
- lib/authograph/adapters/http.rb
Instance Method Summary collapse
- #body ⇒ Object
- #content_type ⇒ Object
- #get_header(_header) ⇒ Object
-
#initialize(_request) ⇒ Http
constructor
A new instance of Http.
- #method ⇒ Object
- #path ⇒ Object
- #set_header(_header, _value) ⇒ Object
Constructor Details
#initialize(_request) ⇒ Http
Returns a new instance of Http.
3 4 5 |
# File 'lib/authograph/adapters/http.rb', line 3 def initialize(_request) @request = _request end |
Instance Method Details
#body ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/authograph/adapters/http.rb', line 27 def body if !@request.body_stream.nil? data = @request.body_stream.read @request.body_stream.rewind data elsif !@request.body.nil? @request.body else '' end end |
#content_type ⇒ Object
23 24 25 |
# File 'lib/authograph/adapters/http.rb', line 23 def content_type @request['Content-Type'] || '' end |
#get_header(_header) ⇒ Object
7 8 9 |
# File 'lib/authograph/adapters/http.rb', line 7 def get_header(_header) @request[_header] end |
#method ⇒ Object
15 16 17 |
# File 'lib/authograph/adapters/http.rb', line 15 def method @request.method.to_s.upcase end |
#path ⇒ Object
19 20 21 |
# File 'lib/authograph/adapters/http.rb', line 19 def path @request.path end |
#set_header(_header, _value) ⇒ Object
11 12 13 |
# File 'lib/authograph/adapters/http.rb', line 11 def set_header(_header, _value) @request[_header] = _value end |