Class: Pubg::BaseConnection
- Inherits:
-
Object
- Object
- Pubg::BaseConnection
- Defined in:
- lib/pubg/base_connection.rb
Constant Summary collapse
- PUBG_API_VERSION =
"v2".freeze
- BASE_URL =
"https://api.pubgtracker.com/#{PUBG_API_VERSION}/".freeze
Instance Method Summary collapse
Instance Method Details
#call(service) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/pubg/base_connection.rb', line 9 def call(service) uri = URI(BASE_URL + service) req = Net::HTTP::Get.new(uri) req["TRN-Api-Key"] = Pubg.config.trn_api_key res = Net::HTTP.start(uri.hostname) {|http| http.request(req) } JSON.parse res.body, symbolize_names: true end |