playstationnetwork-api 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b200498d44cfa623da83873e41dfff9940c7b00
4
- data.tar.gz: c92e1b10117b7f293e4a0ec8c59f28da4a72b760
3
+ metadata.gz: ddf360596a2accf62517c32f622fabc52164a7a9
4
+ data.tar.gz: ae3aa1a32e707693934b9ea77d15a1a27268b90b
5
5
  SHA512:
6
- metadata.gz: a552ef56dd945afa4c915503cd95071193ead38ad7267a39fb1083b9a114a825c1262b2ca1c82ba0743f20ff1b38a0c8d4e277772f09cc4e0f6e5ddf8ac937ca
7
- data.tar.gz: 20469b4951fdedf602d08316b513aa76b0dae4540a5eff7bc89b9539b71ba0dad389082baa36ba5a0f71e3120b3be9f211d853d229f1aaecb3f80d81b9970b8a
6
+ metadata.gz: be8c64c1178d3be54738ab91dde248db5d5c6aaf386dbd45f593881f5f74f7eb7c5ff5ab9dd83298278faba4dd6c5b4c054e6aac2efb0cbc368293c74e92fd07
7
+ data.tar.gz: c8e9b8328a3746ae83abf683d2d6ebde0350fa6cd52f29cef9f35e83cf369575c4834d0406eeab35579f252a9f7f877d8cce50d08ac790339aea08803c2db746
@@ -10,10 +10,10 @@ module PlayStationNetwork
10
10
  end
11
11
 
12
12
  def self.find(username)
13
- response = PSN::API.get("/#{username}/trophies")
13
+ response = PlayStationNetwork::API.get("/#{username}/trophies")
14
14
 
15
15
  if response.success?
16
- self.new(
16
+ new(
17
17
  response['totalResults'],
18
18
  response['offset'],
19
19
  response['limit'],
@@ -1,6 +1,7 @@
1
1
  module PlayStationNetwork
2
2
  class Profile
3
- attr_accessor :avatar,
3
+ attr_accessor :id,
4
+ :avatar,
4
5
  :username,
5
6
  :about,
6
7
  :membership,
@@ -8,7 +9,8 @@ module PlayStationNetwork
8
9
  :progress,
9
10
  :trophies
10
11
 
11
- def initialize(avatar, username, about, membership, level, progress, trophies)
12
+ def initialize(id, avatar, username, about, membership, level, progress, trophies)
13
+ self.id = id
12
14
  self.avatar = avatar
13
15
  self.username = username
14
16
  self.about = about
@@ -23,6 +25,7 @@ module PlayStationNetwork
23
25
 
24
26
  if response.success?
25
27
  self.new(
28
+ response['npId'],
26
29
  response['avatarUrl'],
27
30
  response['onlineId'],
28
31
  response['aboutMe'],
@@ -1,7 +1,42 @@
1
1
  module PlayStationNetwork
2
2
 
3
3
  class Trophy
4
+ attr_accessor :psn_id, :group_id, :trophies #, :trophy_id, :hidden, :type, :name, :description, :cover, :rarity, :earned_rate
4
5
 
6
+ def initialize(psn_id, group_id, trophies)# trophy_id, hidden, type, name, description, cover, rarity, earned_rate)
7
+ self.psn_id = psn_id
8
+ self.group_id = group_id
9
+ self.trophies = trophies
10
+ # self.trophy_id = trophy_id
11
+ # self.hidden = hidden
12
+ # self.type = type
13
+ # self.name = name
14
+ # self.description = description
15
+ # self.cover = cover
16
+ # self.rarity = rarity
17
+ # self.earned_rate = earned_rate
18
+ end
5
19
 
20
+ def self.find(username, game_id, group_id)
21
+ response = PlayStationNetwork::API.get("/#{username}/trophies/#{game_id}/groups/#{group_id}")
22
+
23
+ if response.success?
24
+ new(
25
+ game_id,
26
+ group_id,
27
+ response['trophies']
28
+ # response['trophyId'],
29
+ # response['trophyHidden'],
30
+ # response['trophyType'],
31
+ # response['trophyName'],
32
+ # response['trophyDetail'],
33
+ # response['trophyIconUrl'],
34
+ # response['trophyRare'],
35
+ # response['trophyEarnedRate']
36
+ )
37
+ else
38
+ raise response.response
39
+ end
40
+ end
6
41
  end
7
42
  end
@@ -1,7 +1,30 @@
1
1
  module PlayStationNetwork
2
2
 
3
3
  class TrophyGroup
4
+ attr_accessor :psn_id, :groups #:group_id, :name, :description, :cover, :defined_trophies
4
5
 
6
+ def initialize(psn_id, groups) # group_id, name, description, cover, defined_trophies)
5
7
 
8
+ self.psn_id = psn_id
9
+ self.groups = groups
10
+ # self.group_id = group_id
11
+ # self.name = name
12
+ # self.description = description
13
+ # self.cover = cover
14
+ # self.defined_trophies = defined_trophies
15
+ end
16
+
17
+ def self.find(username, game_id)
18
+ response = PlayStationNetwork::API.get("/#{username}/trophies/#{game_id}/groups")
19
+
20
+ if response.success?
21
+ new(
22
+ game_id,
23
+ response['trophyGroups']
24
+ )
25
+ else
26
+ raise response.response
27
+ end
28
+ end
6
29
  end
7
30
  end
@@ -1,3 +1,3 @@
1
1
  module PlayStationNetwork
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  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: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Radulescu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-17 00:00:00.000000000 Z
11
+ date: 2016-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty