Class: Glib::JsonCrawler::Http
- Inherits:
-
Object
- Object
- Glib::JsonCrawler::Http
- Defined in:
- lib/glib/json_crawler/http.rb
Defined Under Namespace
Classes: Response
Constant Summary collapse
- URI_REGEXP =
/\A#{URI.regexp}\z/
- VALID_RESPONSE_CODES =
[ (200..299).to_a, 401, ## UNAUTHORIZED Should be used for not-logged-in 403, ## FORBIDDEN Should be used for logged-in but not allowed to access ].flatten
Instance Attribute Summary collapse
-
#history ⇒ Object
Returns the value of attribute history.
-
#response_times ⇒ Object
Returns the value of attribute response_times.
-
#router ⇒ Object
Returns the value of attribute router.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #delete(url, action, params = {}) ⇒ Object
- #get(url, action, params = {}, inspect_result = true) ⇒ Object
-
#initialize(context, user, router) ⇒ Http
constructor
A new instance of Http.
- #patch(url, action, params) ⇒ Object
- #post(url, action, params) ⇒ Object
- #put(url, action, params) ⇒ Object
Constructor Details
#initialize(context, user, router) ⇒ Http
Returns a new instance of Http.
14 15 16 17 18 19 20 21 |
# File 'lib/glib/json_crawler/http.rb', line 14 def initialize(context, user, router) @context = context @history = [] @content_history = [] @response_times = [] @user = user @router = router end |
Instance Attribute Details
#history ⇒ Object
Returns the value of attribute history.
4 5 6 |
# File 'lib/glib/json_crawler/http.rb', line 4 def history @history end |
#response_times ⇒ Object
Returns the value of attribute response_times.
4 5 6 |
# File 'lib/glib/json_crawler/http.rb', line 4 def response_times @response_times end |
#router ⇒ Object
Returns the value of attribute router.
4 5 6 |
# File 'lib/glib/json_crawler/http.rb', line 4 def router @router end |
#user ⇒ Object
Returns the value of attribute user.
4 5 6 |
# File 'lib/glib/json_crawler/http.rb', line 4 def user @user end |
Instance Method Details
#delete(url, action, params = {}) ⇒ Object
39 40 41 |
# File 'lib/glib/json_crawler/http.rb', line 39 def delete(url, action, params = {}) fetch(:delete, url, action, {}) end |
#get(url, action, params = {}, inspect_result = true) ⇒ Object
23 24 25 |
# File 'lib/glib/json_crawler/http.rb', line 23 def get(url, action, params = {}, inspect_result = true) fetch(:get, url, action, params, inspect_result) end |
#patch(url, action, params) ⇒ Object
31 32 33 |
# File 'lib/glib/json_crawler/http.rb', line 31 def patch(url, action, params) fetch(:patch, url, action, params) end |
#post(url, action, params) ⇒ Object
27 28 29 |
# File 'lib/glib/json_crawler/http.rb', line 27 def post(url, action, params) fetch(:post, url, action, params) end |
#put(url, action, params) ⇒ Object
35 36 37 |
# File 'lib/glib/json_crawler/http.rb', line 35 def put(url, action, params) fetch(:put, url, action, params) end |