Class: DeviceAtlas::Carrier::CarrierApiWeb

Inherits:
CarrierApi
  • Object
show all
Defined in:
lib/deviceatlas/carrier/carrier_api_web.rb

Overview

A small extension to the core CarrierApi to get IP from HTTP request for current client.

Constant Summary

Constants inherited from CarrierApi

DeviceAtlas::Carrier::CarrierApi::API_VERSION, DeviceAtlas::Carrier::CarrierApi::HEADERS_TO_CHECK

Instance Method Summary collapse

Methods inherited from CarrierApi

#get_api_version, #get_data_file_copyright, #get_data_file_creation_date, #get_data_file_version, #get_ip, #get_property, #get_property_names, #load_data_from_file, #public_ip?

Constructor Details

#initializeObject

Creates a new DeviceAtlas::Carrier::CarrierApiWeb instance.

Examples:

Create an object

carrier_api_web = DeviceAtlas::Carrier::CarrierApiWeb.new

Instance Method Details

#get_properties(request) ⇒ Hash<Symbol, Object>

Get the Carrier properties for a given HTTP request. The most suitable client IP is extracted and used to lookup the Carrier properties.

Parameters:

  • request (Net::HTTP)

    the request object to find the most suitable headers

Returns:

  • (Hash<Symbol, Object>)

    properties detected