Esriveter

A token manager for your all yer AGO token needs. Automagically manage app tokens and device tokens.

Installation

Add this line to your application's Gemfile:

gem 'esriveter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install esriveter

Usage

# Get a persisting app token
params = {client_id: 'client_id', client_secret: 'client_secret'}
t = Esriveter.new params
conn = Faraday.new(:url => geotriggers_url)
conn.get "/device/list?token=#{t.app_token}"

# Get a persisting device token
params = {client_id: 'client_id', client_secret: 'client_secret', device_id:
'device_id', refresh_token: 'refresh_token'}
t = Esriveter.new params
conn = Faraday.new(:url => geotriggers_url)
conn.get "/device/list?token=#{t.device_token}"

# If you don't specify device_id and refresh token, they'll be
# created for you
params = {client_id: 'client_id', client_secret: 'client_secret'}
t = Esriveter.new params
conn = Faraday.new(:url => geotriggers_url)
conn.get "/device/list?token=#{t.device_token}"
puts "Device: #{t.device_id}"

# Don't got an app? No prob.
params = {username: 'me', password: 'password', title: 'My App'}
t = Esriveter.new params
app_stuff = t.create_app

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request