Class: Ip2Geo::Methods::ListConversions
- Inherits:
-
Object
- Object
- Ip2Geo::Methods::ListConversions
- Defined in:
- lib/ip2geo/methods/list_conversions.rb
Class Method Summary collapse
-
.call(options = {}) ⇒ Hash?
List conversions with pagination and optional filtering.
Class Method Details
.call(options = {}) ⇒ Hash?
List conversions with pagination and optional filtering.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ip2geo/methods/list_conversions.rb', line 15 def call( = {}) offset = .fetch(:offset, 0) limit = .fetch(:limit, 50) select = [:select] ip_search = [:ip_search] params = [] params << "offset=#{offset}" if offset.positive? params << "limit=#{limit}" if limit != 50 params << "select=#{select.map { |f| "data.#{f}" }.join(',')}" if select.is_a?(Array) && !select.empty? params << "ipSearch=#{ip_search}" if ip_search query_string = params.empty? ? '' : "?#{params.join('&')}" url = "#{Data::API_ENDPOINT}#{Data::ENDPOINTS[:CONVERSIONS][:LIST]}#{query_string}" Helpers::Http.request(url) rescue StandardError => e warn "[Ip2Geo::ListConversions] Error: #{e.}" nil end |