Module: PlayStationNetwork

Defined in:
lib/playstationnetwork-api.rb,
lib/playstationnetwork/api.rb,
lib/playstationnetwork/game.rb,
lib/playstationnetwork/user.rb,
lib/playstationnetwork/store.rb,
lib/playstationnetwork/version.rb

Defined Under Namespace

Classes: API, Configuration, Game, Store, User

Class Method Summary collapse

Class Method Details

.changelogObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/playstationnetwork/version.rb', line 4

def self.changelog
  puts "
    v0.0

    v0.0.1 - Initial
    v0.0.2 - Added Trophy Information
    v0.0.3 - Added Trophies offset
    v0.1.0 - Pluralized Renamed Trophy and TrophyGroup classes
    v0.1.1 - Added a convenient method 'all' on Trophies, without having to pass the group id as an argument

    v1.0  - This version is not backwards compatible! Read below for new API endpoints

    v1.0.0 - Introduces a new API source and a new format
    v1.0.1 - Fixes a bug where ActiveSupport version would cause an issue with existing rails apps
    v1.0.2 - Adds correct hash format to pass the api key and secret to each route

    v2.0 - This version is not backwards compatible! Read below for new API endpoints

    v2.0.0
      - Simplified API calls. Instead of separating each endpoint into its own file, use one file per class
      - Remove all dependencies except HTTParty and use native Ruby where dependency was required
      - No more parsing the data inside the gem, instead return the RAW data and let the application decide how to parse it

      ## Old method -> New method ( PlayStationNetwork:: removed for breviety )
      #
      # User
      #
      Profile:    ::U::User.profile('pacMakaveli90')                 -> ::User.new('pacMakaveli90').profile
      Games:      ::U::Games.all('pacMakaveli90')                    -> ::User.new('pacMakaveli90').games
      Trophies:   ::U::Trophies.all('pacMakaveli90', 'NPWR00132_00') -> ::User.new('pacMakaveli90').trophies('NPWR00132_00')

      # Games
      #
      Game:       ::G::Game.find('NPWR00132_00')                     -> ::Game.new('NPWR00132_00').details
      Trophies:   ::G::Trophies.all('NPWR00132_00')                  -> ::Game.new('NPWR00132_00').trophies
      All:        ::G::Games.all('all')                              -> ::Game.new().all(platform: 'ps4') # default 'all'
      Popular:    ::G::Games.popular()                               -> ::Game.new().all(popular: true)

    v2.0.1
      - When requesting Games for a specific user, return only the games instead of a full response which returns the same data that ::User.new('pacMakaveli90').profile already returns

    v2.1.0
      - Added 'verify: false' to HTTParty default options to skip any SSL certification errors. Temporary measure until we can figure how to fix this.

    v2.1.1
      - Tidy up the code and add a new option which should make internal calls cleaner

    v2.1.2
      - Added 'verify: false' option introduced in v2.1.0 as a configurable option in the initializer

    v2.2
      - Added experimental PlayStation Store endpoint

    v3.0
      - (major) The API now returns OpenStruct objects instead of plain JSON
      - Removed HTTParty dependency and used Ruby's Net::HTTP
      - Removed a lot of logic and simplified the code and classes
      - Integrated experimental PlayStation Stores endpoints into the gem
      - Added Cache

    v3.0.1
      - Fixed an issue caused by the User not having any earned trophies and trying to get last item from an empty array
  "
end

.configurationObject



19
20
21
# File 'lib/playstationnetwork/api.rb', line 19

def self.configuration
  @configuration ||= Configuration.new
end

.configure(&block) ⇒ Object

PlayStationNetwork.configure do |config|

config.key = ''
..

end



15
16
17
# File 'lib/playstationnetwork/api.rb', line 15

def self.configure(&block)
  block.call(configuration)
end

.valid?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
# File 'lib/playstationnetwork/api.rb', line 23

def self.valid?
  return MISSING_URL    if configuration.url.nil?
  return MISSING_KEY    if configuration.key.nil?
  return MISSING_SECRET if configuration.secret.nil?
  true
end