Class: NintendoEshop::APIClient
- Inherits:
-
Object
- Object
- NintendoEshop::APIClient
- Defined in:
- lib/nintendo_eshop/api_client.rb
Class Method Summary collapse
Class Method Details
.post(uri, json: {}) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/nintendo_eshop/api_client.rb', line 4 def post(uri, json: {}) http = setup_http(uri) req = Net::HTTP::Post.new(uri) req.add_field "Accept", "application/json" req.add_field "Content-Type", "application/json" req.body = JSON.dump(json) http.request(req) end |
.setup_http(uri) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/nintendo_eshop/api_client.rb', line 13 def setup_http(uri) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_PEER http end |