Sha256: 1866bd09bb76c8eb3115898f8b13b095670614c3112349d34b0e3d7747f42a72

Contents?: true

Size: 614 Bytes

Versions: 2

Compression:

Stored size: 614 Bytes

Contents

require "deviceatlasapi/version"
require "uri"
require 'httparty'

module DeviceAtlasApi
  autoload :ControllerHelpers, 'deviceatlasapi/controller'

  def self.setup
    yield self
  end


  class Client

    def initialize user_agent
      @user_agent = user_agent
      @cloud_host = 'api.deviceatlascloud.com'
    end

    def get_device_data
      HTTParty.get("http://#{@cloud_host}/#{prepare_request_header}")["properties"]
    end

    private

    def prepare_request_header
      "/v1/detect/properties?licencekey=#{ENV['DEVICE_ATLAS_LICENCE_KEY']}&useragent=#{URI.escape(@user_agent)}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
deviceatlasapi-0.0.2 lib/deviceatlasapi.rb
deviceatlasapi-0.0.1 lib/deviceatlasapi.rb