Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
A Ruby interface to Yandex Direct API. Supported versions 4, 4 Live, 5.
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file lib/ya/api/direct
. To experiment with that code, run bin/console
for an interactive prompt.
Add this line to your application's Gemfile:
gem 'ya-api-direct'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ya-api-direct
OAuth2 Yandex token is needed. Use omniauth-yandex to receive it. Install it according by following manual: Rails Authentication with OAuth 2.0 and OmniAuth.
Call methods of Yandex Direct API 5:
request = {
"SelectionCriteria" => {
"Types" => ["TEXT_CAMPAIGN"]
},
"FieldNames" => ["Id", "Name"],
"TextCampaignFieldNames" => ["BiddingStrategy"]
}
options = { token: Token }
@direct = Ya::API::Direct::Client.new(options)
json = @direct.campaigns.get request
Call methods from versions 4 and 4 Live:
@direct = Ya::API::Direct::Client.new({ token: Token })
json = @direct.v4.GetCampaignsList
All names of controllers and methods are equal to ones from Direct API help. 4 vs 4 Live is autodetected.
Allowed options:
token:
Yandex Direct API token. Required field.app_id:
Application ID. Isn't required. Used for Yandex stat.login:
Application login. Isn't required. Used for Yandex stat.locale:
One of locales, supported by Yandex API ('en' or 'ru'). By default: 'en'.mode:
Yandex Direct API server to send requests (:sandbox
or production
). By default: :sandbox
.cache:
send caching request after creating the instance. By default: true
.api:
used only to make caching request (:v5 or :v4), By default: :v5
.ssl:
use SSL connection. By default: true
.By default the client class sends request to clients. You can avoid it by turning this option off, like this:
@direct = Ya::API::Direct::Client.new({ token: Token, cache: false })
Check Yandex manuals for more info on caching.
Date returned with first call of caching method is stored in cache_timestamp
property.
Units data of last request is stored in units_data
property. There're 3 keys in this hash:
just_used
- units used by last request.units_left
- units left for the current session.units_limit
- units limit for a session of your account.They were added only in Yandex Direct API 5. Calling the methods from 4 or 4 Live doesn't update them.
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
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.
Bug reports and pull requests are welcome on GitHub at https://github.com/rikkimongoose/ya-api-direct. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that ya-api-direct demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.