playstationnetwork-api 2.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e44ca9df594def37247156fd28288a63c5ae9fd
4
- data.tar.gz: f266eb96a23753dfcd1b3f08e930159c4a6121bc
3
+ metadata.gz: 82391e1f2a2c4a615715c7c8f339a5031b1d6f5c
4
+ data.tar.gz: ea165570702a890daf8efccadc0d7db68db1badc
5
5
  SHA512:
6
- metadata.gz: c3dfb69b339de351972fa8c44b9b4f62170a6e3dd86ec55988f281d9366ebb6980b4a12ab344d92853cb249bb05bd998a996f624b04f09dc8230b1d29e48860a
7
- data.tar.gz: 7cc86eab3cf0c3ffdae34050ef1ad500dca2cb0f66c4e9618b7c76588b0fcb99fefe5de816b0652845a8d22c10728a0a7cc6424b366e64e16ced8fbd6cc3a6e1
6
+ metadata.gz: 1000db4ca3aca7e1415bfccc2266d3e4e7cab8a8c3fd2e727c12d7dc8e191241c200b873efa2e9eab88267259adb24ba54aad0a03d5d94918d8640ee8317d758
7
+ data.tar.gz: 2595edff1d55dcc9fe18dd25b498c551c1f6af644da25b81ae85bed5efa62461c7f297c6bceddde2a2dc012315e4ff8e248c804f00450e546b52643551ce873c
@@ -61,12 +61,16 @@ module PlayStationNetwork
61
61
  }
62
62
  end
63
63
 
64
- def parse_response(url, body)
65
- request = post(url, body)
64
+ def parse_response(url, options, reduce_to = {})
65
+ request = post(url, body: options)
66
66
 
67
67
  if request.success?
68
68
  begin
69
- JSON.parse(request)
69
+ if reduce_to.blank?
70
+ JSON.parse(request)
71
+ else
72
+ JSON.parse(request)[reduce_to]
73
+ end
70
74
  rescue
71
75
  raise "There was a problem parsing the JSON. Most likely an API problem."
72
76
  end
@@ -23,13 +23,13 @@ module PlayStationNetwork
23
23
 
24
24
  def details
25
25
  PlayStationNetwork::API.handle_response do
26
- PlayStationNetwork::API.parse_response('/psnGetGame', body: options)
26
+ PlayStationNetwork::API.parse_response('/psnGetGame', options)
27
27
  end
28
28
  end
29
29
 
30
30
  def trophies
31
31
  PlayStationNetwork::API.handle_response do
32
- PlayStationNetwork::API.parse_response('/psnGetTrophies', body: options)
32
+ PlayStationNetwork::API.parse_response('/psnGetTrophies', options)
33
33
  end
34
34
  end
35
35
 
@@ -15,13 +15,13 @@ module PlayStationNetwork
15
15
 
16
16
  def profile
17
17
  PlayStationNetwork::API.handle_response do
18
- PlayStationNetwork::API.parse_response('/psnGetUser', body: options)
18
+ PlayStationNetwork::API.parse_response('/psnGetUser', options)
19
19
  end
20
20
  end
21
21
 
22
22
  def games
23
23
  PlayStationNetwork::API.handle_response do
24
- PlayStationNetwork::API.parse_response('/psnGetUserGames', body: options)
24
+ PlayStationNetwork::API.parse_response('/psnGetUserGames', options, 'games')
25
25
  end
26
26
  end
27
27
 
@@ -30,7 +30,7 @@ module PlayStationNetwork
30
30
  raise INVALID_NPCOMMID_TYPE unless npcommid.is_a?(String)
31
31
 
32
32
  @options = options.merge(npcommid: npcommid)
33
- PlayStationNetwork::API.parse_response('/psnGetUserTrophies', body: options)
33
+ PlayStationNetwork::API.parse_response('/psnGetUserTrophies', options)
34
34
  end
35
35
  end
36
36
  end
@@ -1,5 +1,5 @@
1
1
  module PlayStationNetwork
2
- VERSION ||= '2.0'
2
+ VERSION ||= '2.0.1'
3
3
 
4
4
  def self.changelog
5
5
  puts "
@@ -38,6 +38,9 @@ module PlayStationNetwork
38
38
  Trophies: ::G::Trophies.all('NPWR00132_00') -> ::Game.new('NPWR00132_00').trophies
39
39
  All: ::G::Games.all('all') -> ::Game.new().all(platform: 'ps4') # default 'all'
40
40
  Popular: ::G::Games.popular() -> ::Game.new().all(popular: true)
41
+
42
+ v2.0.1
43
+ - 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
41
44
  "
42
45
  end
43
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playstationnetwork-api
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Radulescu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-11 00:00:00.000000000 Z
11
+ date: 2017-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty