This library officially supports the following Ruby versions:
- MRI
>= 2.7.0
This gem is a wrapper for Beeswax Buzz API.
Add this line to your application's Gemfile:
gem 'beeswaxapi'
And then execute:
$ bundle
Or install it yourself as:
$ gem install beeswaxapi
To start work with Beeswaxapi
you need setup your config.
Available configs:
- auth_strategy: by default
basic
. Can be changed tocookies
. - cookie_file: path to file with cookies. Required for
cookies
auth_strategy. - base_uri: uri to beeswax api endpoint. Should be with
rest
path - user_name: email of user
- password: password of user
- logger: this option enable logging
Example configuration for basic auth authentication:
BeeswaxAPI::App.configure do |config|
config.auth_strategy = 'basic'
config.base_uri = 'https://sandbox.api.beeswax.com/rest'
config.user_name = '[email protected]'
config.password = 'password'
end
Example configuration for cookies authentication:
BeeswaxAPI::App.configure do |config|
config.auth_strategy = 'cookies'
config.cookie_file = '/path/to/cookies-file.txt'
config.base_uri = 'https://sandbox.api.beeswax.com/rest'
config.user_name = '[email protected]'
config.password = 'password'
end
Example of use:
params = {
advertiser_id: ENV["BEESWAX_ADVERTISER_ID"].to_i,
creative_asset_name: file_name.html,
size_in_bytes: 12001,
notes: "Created by API",
active: false
}
BeeswaxAPI::Campaign.create(body_params: params)
# if you need to upload asset you should use `body_file` key
BeeswaxAPI::HtmlAsset::Upload.create(body_file: {creative_content: @file}, path: create_id) # `path` will be added to url: base_uri/rest/html_asset/upload/<path>
- Clone this repo
- Ensure you have the ruby-version defined in
.ruby-version
bundle install
to install all the gemscp .env .env.development
then add your Beeswax credentials to.env.development
- Open an IRB console with the gem loaded:
irb -I lib -r ./lib/beeswaxapi.rb
- Run the script at
development_setup_script.rb
to configure the gem with your credentials from the.env.development
file
Beeswax Buzz API: [https://docs.beeswax.com/docs] (https://docs.beeswax.com/docs/getting-started)
This repo is a fork of https://github.com/valikos/beeswaxapi. When creating PRs, make sure you're adding them to the correct repo.
The gem is available as open source under the terms of the MIT License.