A ruby gem for the Kahuna Push API - https://app.usekahuna.com/tap/getstarted/pushapi/
Add this line to your application's Gemfile:
gem 'kahuna_client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install kahuna_client
require "rubygems"
require "kahuna_client"
client = KahunaClient::Client.new(secret_key: 'your secret key', api_key: 'your api key')
push_object = {
target: {
username: "iamawesome1989",
email: "awesome@mail.com",
fbid: "42",
user_id: "789"
},
notification: {
alert: "Look at this Push!"
},
params: {
sale_id: "1234",
landing_page: "share_page"
},
config: {
start_time: 1382652322,
optimal_hours: 8,
influence_rate_limiting: true,
observe_rate_limiting: true
}
}
# Send the pushes (one or more)
client.push([push_object])
For more information about extra parameters and error conditions check the specs folder
Because KahunaClient gem is based on Faraday, it supports the following adapters:
- Net::HTTP (default)
- Excon
- Typhoeus
- Patron
- EventMachine
Beside the adapter, you can change the following properties:
- endpoint
- user_agent
- proxy
- debug
- environment
For instance:
require 'typhoeus/adapters/faraday' # You will need the typhoeus gem
client = KahunaClient.client(adapter: :typhoeus, user_agent: "foobar v1", debug: true, secret_key: 'foo', api_key: 'bar')
client.push(push_array)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request