Class: Eris::ProxiedRequest
- Inherits:
-
Object
- Object
- Eris::ProxiedRequest
- Defined in:
- lib/eris/lib/proxied_request.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(params) ⇒ ProxiedRequest
constructor
A new instance of ProxiedRequest.
- #url ⇒ Object
Constructor Details
#initialize(params) ⇒ ProxiedRequest
Returns a new instance of ProxiedRequest.
3 4 5 6 |
# File 'lib/eris/lib/proxied_request.rb', line 3 def initialize(params) @url = params["url"] @body = params["body"] end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 |
# File 'lib/eris/lib/proxied_request.rb', line 13 def execute response = Curl::Easy.perform(url) [response.body_str, response.response_code] end |
#url ⇒ Object
8 9 10 11 |
# File 'lib/eris/lib/proxied_request.rb', line 8 def url query_params = @body.collect {|k,v| "#{URI.encode(k.to_s)}=#{URI.encode(v.to_s)}" }.join('&') "#{@url}?#{query_params}" end |