Class: CurseClient::HTTP
- Inherits:
-
Object
- Object
- CurseClient::HTTP
- Defined in:
- lib/curse_client/http.rb
Class Method Summary collapse
Class Method Details
.get(uri, options = {}, &block) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/curse_client/http.rb', line 6 def self.get(uri, = {}, &block) uri = create_uri(uri) request = Net::HTTP::Get.new(uri.request_uri) request.initialize_http_header([:headers]) if [:headers] send_request(uri, request, &block) end |
.post(uri, body, options = {}, &block) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/curse_client/http.rb', line 13 def self.post(uri, body, = {}, &block) uri = create_uri(uri) request = Net::HTTP::Post.new(uri.request_uri) request.initialize_http_header([:headers]) if [:headers] request.body = parse_request_body(body, [:format] || :json) send_request(uri, request, &block) end |