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 |
# File 'lib/glib/json_crawler/http.rb', line 14 def initialize(context, user, router) @context = context @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
38 39 40 |
# File 'lib/glib/json_crawler/http.rb', line 38 def delete(url, action, params = {}) fetch(:delete, url, action, {}) end |
#get(url, action, params = {}, inspect_result = true) ⇒ Object
22 23 24 |
# File 'lib/glib/json_crawler/http.rb', line 22 def get(url, action, params = {}, inspect_result = true) fetch(:get, url, action, params, inspect_result) end |
#patch(url, action, params) ⇒ Object
30 31 32 |
# File 'lib/glib/json_crawler/http.rb', line 30 def patch(url, action, params) fetch(:patch, url, action, params) end |
#post(url, action, params) ⇒ Object
26 27 28 |
# File 'lib/glib/json_crawler/http.rb', line 26 def post(url, action, params) fetch(:post, url, action, params) end |
#put(url, action, params) ⇒ Object
34 35 36 |
# File 'lib/glib/json_crawler/http.rb', line 34 def put(url, action, params) fetch(:put, url, action, params) end |