0.0
No commit activity in last 3 years
No release in over 3 years
A wrapper for Revere Mobile API. Visit https://revolutionmessaging.com/revere/mobile/ for more information.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8, >= 1.8
~> 1.9.1, >= 1.9.1
~> 12.3.1, >= 12.3.1
~> 3.8.0, >= 3.8.0
~> 0.16.1, >= 0.16.1
~> 3.4.2, >= 3.4.2

Runtime

~> 0.15.3
~> 1.11, >= 1.11.0
 Project Readme

The Revere Mobile Ruby Gem

Build Status Gem Version

Quick Start

Add this line to your applications Gemfile:

gem 'revere_mobile'

And then execute

$ bundle

Or install as standalone gem:

$ gem install revere_mobile

Configuration

Revere Mobile takes a block to be configured:

RevereMobile.configure do |config|
  # Configure the API Endpoint
  # See https://mobile-developers.reverehq.com for more info for API Versions
  config.api_endpoint = 'https://mobile.reverehq.com/api/v1'
  # Configure an API Key
  config.api_key = 'd1286a1a-f2e7-421a-91b8-f8cc8201558f'
  # Defaults to "Revere Mobile Ruby Gem #{RevereMobile::VERSION}"
  config.user_agent = 'CustomUserAgent'
end

You can also configure options in a configuration object like so:

RevereMobile.configuration.api_key = 'd1286a1a-f2e7-421a-91b8-f8cc8201558f'

For workers, for many instances you can create multiple configurations. This is also helpful for switching sessions based on username and password authentication.

configuration = RevereMobile::Configuration.new
configuration.username = 'example'
configuration.password = 'example'
client = RevereMobile::Client.new(configuration)
client.login 

Requests

Using a Username and Password this sets the session via the #login method.

configuration = RevereMobile::Configuration.new
configuration.username = 'example'
configuration.password = 'example'
client = RevereMobile::Client.new(configuration)
client.login # saves the session cookie for the instance of the client
client.campaigns # returns lists of campaigns

You can also make requests directly with the module by just defining the api_key:

RevereMobile.configuration.api_key = 'd1286a1a-f2e7-421a-91b8-f8cc8201558f'
RevereMobile.campaigns

Development

Download this repo and run rake spec to run the tests.

A console method has also been included, run bin/console to get a pry prompt in which to experiment.

% bin/console
[1] pry(main)> RevereMobile::VERSION
# => "x.x.x"
[2] pry(main)> RevereMobile.configuration.api_key = 'd1286a1a-f2e7-421a-91b8-f8cc8201558f'
# => "d1286a1a-f2e7-421a-91b8-f8cc8201558f"
[3] pry(main)> RevereMobile.campaigns
# => {
#  "page"=>1,
# "size"=>-1,
# "total"=>119,
# "collection"=>
# ...}