Class: Spidra::HTTP Private
- Inherits:
-
Object
- Object
- Spidra::HTTP
- Defined in:
- lib/spidra/http.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #delete(path) ⇒ Object private
- #get(path, params = {}) ⇒ Object private
-
#initialize(api_key:, base_url:, timeout:) ⇒ HTTP
constructor
private
A new instance of HTTP.
- #post(path, body = {}) ⇒ Object private
Constructor Details
#initialize(api_key:, base_url:, timeout:) ⇒ HTTP
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of HTTP.
8 9 10 11 12 |
# File 'lib/spidra/http.rb', line 8 def initialize(api_key:, base_url:, timeout:) @api_key = api_key @base_url = base_url @timeout = timeout end |
Instance Method Details
#delete(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 29 |
# File 'lib/spidra/http.rb', line 26 def delete(path) uri = build_uri(path) execute(Net::HTTP::Delete.new(uri)) end |
#get(path, params = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 |
# File 'lib/spidra/http.rb', line 14 def get(path, params = {}) uri = build_uri(path, params) execute(Net::HTTP::Get.new(uri)) end |
#post(path, body = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 22 23 24 |
# File 'lib/spidra/http.rb', line 19 def post(path, body = {}) uri = build_uri(path) req = Net::HTTP::Post.new(uri) req.body = JSON.generate(body) execute(req) end |