Sha256: bb37f32a260bebf06c9a9c56c7ff8bda937c11d53729d47f28025866197f5bab

Contents?: true

Size: 534 Bytes

Versions: 6

Compression:

Stored size: 534 Bytes

Contents

module NintendoEshop
  class APIClient
    class << self
      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

      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
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nintendo_eshop-0.2.1 lib/nintendo_eshop/api_client.rb
nintendo_eshop-0.2.0 lib/nintendo_eshop/api_client.rb
nintendo_eshop-0.1.1 lib/nintendo_eshop/api_client.rb
nintendo_eshop-0.1.0 lib/nintendo_eshop/api_client.rb
nintendo_eshop-0.1.0.alpha4 lib/nintendo_eshop/api_client.rb
nintendo_eshop-0.1.0.alpha3 lib/nintendo_eshop/api_client.rb