Project

userstack

0.0
No commit activity in last 3 years
No release in over 3 years
Simple wrapper for the Userstack API https://userstack.com
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
>= 0
~> 10.0
~> 3.0
~> 0.52.x
 Project Readme

Userstack

Travis Status License Gem

This gem provides an access to Userstack.

Installation

Add this line to your application's Gemfile:

gem 'userstack'

And then execute:

$ bundle

Or install it yourself as:

$ gem install userstack

Usage

  1. Instantiate an instance of {Userstack::Client} with a valid Access key.

    client = Userstack::Client.new(ACCESS_KEY)
  2. Parse an useragent.

    result = client.parse('an useragent')

Use http

If you are Free plan user, you have to use http scheme.

client = Userstack::Client.new(ACCESS_KEY, use_ssl: false)
result = client.parse('an useragent')

Legacy response

Userstack supports Useragent API response.

client = Userstack::Client.new(ACCESS_KEY, legacy: true)
result = client.parse('an useragent')

example response

{
  "data": {
    "ua_type": "Desktop",
    "os_name": "macOS 10.14 Mojave",
    "os_version": "",
    "browser_name": "Chrome",
    "browser_version": "71.0.3578.98",
    "engine_name": "WebKit/Blink",
    "engine_version": ""
  }
}

refs. https://userstack.com/documentation#enable_legacy_format

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/feedforce/userstack.

License

The gem is available as open source under the terms of the MIT License.