
Product
Rubygems Ecosystem Support Now Generally Available
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.
Create, destroy and manage your heroku applications programmatically, using the Heroku Platform API.
Add this line to your application's Gemfile:
gem 'heroku-platform-api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install heroku-platform-api
require 'heroku_api'
# => true
Heroku::API.configure do |c|
c.api_key = "<Heroku API token>" # Mandatory
c.logger = Logger.new($stdout) # Optional
end
The Heroku::API.apps
object can be treated as though it were an Array
of applications
with the below methods added.
app = Heroku::API.apps.new(name: "example", region: {name: 'us'}, stack: 'cedar')
# => #<Heroku::Model::App id="01234567-89ab-cdef-0123-456789abcdef", name="example">
All the parameters provided are optional, if this end-point is called without them, then defaults will be chosen.
Heroku::API.apps.all
# => [#<Heroku::Model App...>,...]
Heroku::API.apps["example"]
# => #<Heroku::Model::App id="01234567-89ab-cdef-0123-456789abcdef", name="example">
OR
Heroku::API.apps.app("example")
# => #<Heroku::Model::App id="01234567-89ab-cdef-0123-456789abcdef", name="example">
app.name = "my_app" # Name and heroku based sub-domain of app.
app.maintenance = true # Maintenance mode on.
app.save
# => #<Heroku::Model::App id="01234567-89ab-cdef-0123-456789abcdef", name="my_app">
This gem provides rudimentary support for pushing a given git repo to be deployed as the app, by simplying providing the directory of the repo:
app.push("path/to/repository")
# => true
acc = Heroku::API.account
# => #<Heroku::Model::Account id="01234567-89ab-cdef-0123-456789abcdef", email="username@example.com">
acc.email = "joe-bloggs@example.com"
acc.allow_tracking = false # Let third party tracking services track you.
acc.save
# => #<Heroku::Model::Account id="01234567-89ab-cdef-0123-456789abcdef", email="joe-bloggs@example.com">
acc.update_password("new_password", "old_password")
# => true
OR
Heroku::API.update_password("new_password", "old_password")
# => true
You can check the number of requests left like so:
Heroku::API.account.rate_limits
# => 1200
OR
Heroku::API.rate_limits
# => 1200
Find out the available regions with:
Heroku::API.regions
# => [{"created_at"=>"2012-11-21T21:44:16Z", "description"=>"United States", "id"=>"59accabd-516d-4f0e-83e6-6e3757701145", "name"=>"us", "updated_at"=>"2013-04-05T10:13:06Z"}, {"created_at"=>"2012-11-21T22:05:26Z", "description"=>"Europe", "id"=>"ed30241c-ed8c-4bb6-9714-61953675d0b4", "name"=>"eu", "updated_at"=>"2013-04-05T07:07:28Z"}]
The Heroku Platform API Gem does not currently support any further API end-points natively. If you would like to add them, feel free to contribute, as directed below.
If you would like to test the various endpoints that are not currently fully
supported, please use the Heroku::Conn
class, which will return the requested
data as Ruby Arrays and Hashes:
Raw request for rate limit
etag, response = Heroku::Conn::Get('/account/rate-limits'); response
# => { 'remaining' => '1200' }
For further information, visit the Heroku Platform API.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that heroku-platform-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Product
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.
Research
The Socket Research Team investigates a malicious npm package that appears to be an Advcash integration but triggers a reverse shell during payment success, targeting servers handling transactions.
Security Fundamentals
The Socket Threat Research Team uncovers how threat actors weaponize shell techniques across npm, PyPI, and Go ecosystems to maintain persistence and exfiltrate data.