Class: Kongfigure::HTTPClient
- Inherits:
-
Object
- Object
- Kongfigure::HTTPClient
- Defined in:
- lib/kongfigure/http_client.rb
Constant Summary collapse
- HTTP_HEADERS =
{ accept: "application/json; charset=UTF-8", content_type: "application/json; charset=UTF-8", accept_encoding: "gzip" }
Instance Method Summary collapse
- #delete(path) ⇒ Object
- #get(path, size = nil) ⇒ Object
-
#initialize(parser, url) ⇒ HTTPClient
constructor
A new instance of HTTPClient.
- #patch(path, payload) ⇒ Object
- #post(path, payload) ⇒ Object
- #put(path, payload) ⇒ Object
Constructor Details
#initialize(parser, url) ⇒ HTTPClient
Returns a new instance of HTTPClient.
12 13 14 15 16 17 18 19 |
# File 'lib/kongfigure/http_client.rb', line 12 def initialize(parser, url) @configuration = { ssl_ca_path: nil, verify_ssl: OpenSSL::SSL::VERIFY_NONE, url: url || parser.parse!.url } @inflector = Dry::Inflector.new end |
Instance Method Details
#delete(path) ⇒ Object
38 39 40 |
# File 'lib/kongfigure/http_client.rb', line 38 def delete(path) execute((:delete, path, nil)) end |
#get(path, size = nil) ⇒ Object
33 34 35 36 |
# File 'lib/kongfigure/http_client.rb', line 33 def get(path, size=nil) size = size = 1000 execute((:get, path, size)) end |
#patch(path, payload) ⇒ Object
29 30 31 |
# File 'lib/kongfigure/http_client.rb', line 29 def patch(path, payload) execute((:patch, path, nil, payload)) end |
#post(path, payload) ⇒ Object
21 22 23 |
# File 'lib/kongfigure/http_client.rb', line 21 def post(path, payload) execute((:post, path, nil, payload)) end |
#put(path, payload) ⇒ Object
25 26 27 |
# File 'lib/kongfigure/http_client.rb', line 25 def put(path, payload) execute((:put, path, nil, payload)) end |