Class: Ungulate::CurlHttp
- Inherits:
-
Object
- Object
- Ungulate::CurlHttp
- Defined in:
- lib/ungulate/curl_http.rb
Instance Method Summary collapse
- #code ⇒ Object
- #get_body(url) ⇒ Object
-
#initialize(options = {}) ⇒ CurlHttp
constructor
A new instance of CurlHttp.
- #put(url) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ CurlHttp
Returns a new instance of CurlHttp.
5 6 7 8 |
# File 'lib/ungulate/curl_http.rb', line 5 def initialize( = {}) @easy = Curl::Easy @logger = [:logger] || ::Logger.new($stdout) end |
Instance Method Details
#code ⇒ Object
21 22 23 |
# File 'lib/ungulate/curl_http.rb', line 21 def code @response.response_code end |
#get_body(url) ⇒ Object
10 11 12 13 |
# File 'lib/ungulate/curl_http.rb', line 10 def get_body(url) @logger.info "GET via HTTP: #{url}" @easy.http_get(url).body_str end |
#put(url) ⇒ Object
15 16 17 18 19 |
# File 'lib/ungulate/curl_http.rb', line 15 def put(url) @logger.info "PUT #{url}" @response = @easy.http_put(url, '') self end |