[DEPRECATED] The API is currently out of date as it's not been updated in over a year, from the time of writing this. The API still works and it can still be used to retrieve historical data, assuming your user was there when API was active. Use this to populate your PlayStation database if you must :)
If you need an active, maintained API, either contact psn@games.directory or check out https://github.com/games-directory/api-psn
The Store API is still working but not maintained. For a better, maintained version, use https://github.com/games-directory/api-psn
Retrieve User, Trophies and Game data from PlayStationNetwork.
Add this line to your application's Gemfile:
gem 'playstationnetwork-api', '~> 3.1'
And then execute:
$ bundle
Or install it yourself as:
$ gem install playstationnetwork-api
PlayStationNetwork::User.new('pacMakaveli90').profile
PlayStationNetwork::User.new('pacMakaveli90').games
PlayStationNetwork::User.new('pacMakaveli90').trophies('NPWR00132_00')
PlayStationNetwork::Game.new('NPWR00132_00').details
PlayStationNetwork::Game.new('NPWR00132_00').trophies
PlayStationNetwork::Game.new().all(platform: 'ps4') # you don't have to pass an argument. It will get all games by default.
PlayStationNetwork::Game.new().all(popular: true)
The new PlayStationNetwork::Store.new() endpoint takes two additional arguments, 'region' and 'language'. Defaults to GB/en.
More debugging is required, but so far the available regions are: ['GB/en', 'US/en']
ex: PlayStationNetwork::Store.new('Rocket League', region: 'US', language: 'en')
PlayStationNetwork::Store.new('Rocket League').search()
Optionally, you can pass a `game_type` argument which can be either 'Full Game' ( default ) or 'Bundle' . This will reduce the amount of data returned by the query.
Important!: You must use this endpoint only when you have a store_id, usually returned by the search() endpoint.
PlayStationNetwork::Store.new('EP2002-CUSA01433_00-ROCKETLEAGUEEU01').details()
In your app, create a new initializer playstationnetwork.rb
and add the following:
PlayStationNetwork::API.configure do |config|
config.key = '<API_KEY>',
config.secret = '<API_SECRET>'
config.url = '<API_URL>'
config.verify_ssl = boolean ( default is true )
})
# visit: http://www.psnleaderboard.com/ to get your key, secret and endpoint details
verify_ssl
was introduced in v2.1.0 in order to fix an error returned by the API when communicating through SSL.
If you get the following error when trying to access the API, set verify_ssl
to false
{
success: false,
code: 500,
message: #<OpenSSL::SSL::SSLError: hostname '<API_URL>' does not match the server certificate>
}
Please note this option may be removed in a future release when a proper fix will be implemented.
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
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 add any changes to the changelog
.
Bug reports and pull requests are welcome on GitHub at https://github.com/games-directory/api-playstationnetwork/. 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 MIT License (MIT)
Copyright (c) 2020 Vlad Radulescu, Studio51 Solutions, Studio51 Gaming Solutions
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.