Class: Ip2Geo::Methods::GetConversions
- Inherits:
-
Object
- Object
- Ip2Geo::Methods::GetConversions
- Defined in:
- lib/ip2geo/methods/get_conversions.rb
Class Method Summary collapse
-
.call(options = {}) ⇒ Hash?
Retrieve multiple conversions by their IDs.
Class Method Details
.call(options = {}) ⇒ Hash?
Retrieve multiple conversions by their IDs.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ip2geo/methods/get_conversions.rb', line 13 def call( = {}) conversion_ids = [:conversion_ids] select = [:select] unless conversion_ids.is_a?(Array) && !conversion_ids.empty? return error_response( Data.translate('conversions.conversion-ids-are-required') ) end params = [] params << "select=#{select.map { |f| "data.#{f}" }.join(',')}" if select.is_a?(Array) && !select.empty? query_string = params.empty? ? '' : "?#{params.join('&')}" url = "#{Data::API_ENDPOINT}#{Data::ENDPOINTS[:CONVERSIONS][:GET]}#{query_string}" Helpers::Http.request(url, { conversionIds: conversion_ids }) rescue StandardError => e warn "[Ip2Geo::GetConversions] Error: #{e.}" nil end |