Class: Headsail::HTTP
- Inherits:
-
Object
- Object
- Headsail::HTTP
- Defined in:
- lib/headsail/http.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #body ⇒ Object
- #code ⇒ Object
- #code_status ⇒ Object
-
#initialize(api) ⇒ HTTP
constructor
A new instance of HTTP.
- #run ⇒ Object
Constructor Details
#initialize(api) ⇒ HTTP
Returns a new instance of HTTP.
7 8 9 10 11 12 |
# File 'lib/headsail/http.rb', line 7 def initialize(api) @api = api @response = nil @oauth = determine_oauth @request = determine_request end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/headsail/http.rb', line 5 def response @response end |
Instance Method Details
#body ⇒ Object
18 19 20 |
# File 'lib/headsail/http.rb', line 18 def body @response.body end |
#code ⇒ Object
22 23 24 |
# File 'lib/headsail/http.rb', line 22 def code @response.code end |
#code_status ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/headsail/http.rb', line 26 def code_status case @response.code.to_i when 200 || 201 :SUCCESS when (400..499) :BAD_REQUEST when (500..599) :SERVER_PROBLEMS end end |
#run ⇒ Object
14 15 16 |
# File 'lib/headsail/http.rb', line 14 def run send(@request) end |