
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
A ruby wrapper for the Public Transport Victoria API V3.
Add this line to your application's Gemfile:
gem 'ruby_ptv'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ruby_ptv
You must have a valid PTV developer API key. If you don't have one, you can find out how to register for one here.
Setup:
client = RubyPtv::Client.new(dev_id: "ID", secret_key: "SECRET")
client = RubyPtv.configure(
dev_id: "ID",
secret_key: "SECRET"
)
You can get the global configuration with:
RubyPtv.configuration # => { dev_id: "YOUR_ID", secret_key "YOUR_SECRET }
In case you need to reset the configuration:
RubyPtv.reset_configuration
You can search departures for all routes or for a single route. You can add any optional paramaters, as a hash, that are specified in the PTV api documentation (NOTE: the parameter keys MUST match the exact names specified by PTV).
client.departures(0, 1023, direction_id: 1)
client.departures_for_route(0, 1127, 14)
Searching departures will return a number of nested hashes due to the number of optional params available. You can loop through the results easily:
response = client.departures(0, 1023)
response["departures"].each do |departure|
departure["stop_id"] # => stop id
departure["platform_number"] # => platform number
end
You can search all routes or search for a route with a specified route id. There are no optional paramters available for the routes methods.
client.routes
client.route(2)
Searching routes will return a single array of hashes:
response = client.routes
routes.each do |route|
route["route_type"] # => route type
route["route_name"] # => route name
end
The search method allows you to query any stops, routes and myki ticket outlets with a specified search term. Just like departures, you can add any optional paramters that are specified by the PTV documentation.
client.search("Glen Waverley", route_types: 0)
The source code is fully commented with any required parameters and basic information you may need to use this wrapper. If you are unsure of any specifics of the API, such as any optional parameters available, check the official PTV documentation.
To run the test suite:
bundle exec rake test
Bug reports and pull requests are welcome. Just create a new branch for your feature, add the appropriate tests and open a pull request.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that ruby_ptv 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
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.