Class: PlayStationNetworkAPI::User

Inherits:
Client
  • Object
show all
Defined in:
lib/play_station_network_api/user.rb

Instance Attribute Summary

Attributes inherited from Client

#account_id, #age, #country, #default_headers, #language, #refresh_token

Instance Method Summary collapse

Methods inherited from Client

#catalog, #entitlement, #explore, #game, #get_account_devices, #get_account_id, #initialize, #search, #session, #trophy, #user

Constructor Details

This class inherits a constructor from PlayStationNetworkAPI::Client

Instance Method Details

#available_to_playObject



84
85
86
87
# File 'lib/play_station_network_api/user.rb', line 84

def available_to_play
  # https://m.np.playstation.net/api/userProfile/v1/internal/users/me/friends/subscribing/availableToPlay
  get([path, 'me', 'friends', 'subscribing', 'availableToPlay'].join('/')).parsed_response
end

#blocksObject



78
79
80
81
# File 'lib/play_station_network_api/user.rb', line 78

def blocks
  # https://m.np.playstation.net/api/userProfile/v1/internal/users/me/blocks
  get([path, 'me', 'blocks'].join('/')).parsed_response
end

#friend_requests(type: :received) ⇒ Object

type [Symbol] => :received, :sent



72
73
74
75
# File 'lib/play_station_network_api/user.rb', line 72

def friend_requests(type: :received)
  # https://m.np.playstation.net/api/userProfile/v1/internal/users/me/friends/9014970682312518995/summary
  get([path, 'me', 'friends', "#{ type.to_s }Requests"].join('/')).parsed_response
end

#friends(limit: 1000) ⇒ Object

limit [Integer]

min: 1,
max: 1000



52
53
54
55
56
57
58
59
60
61
# File 'lib/play_station_network_api/user.rb', line 52

def friends(limit: 1000)
  raise 'limit must be less than or equal to 1000' if limit > 1000
  
  # https://m.np.playstation.net/api/userProfile/v1/internal/users/me/friends?limit=1000
  get([path, , 'friends'].join('/'),
    query: {
      limit: limit
    }
  ).parsed_response
end

#friendship(friend_account_id) ⇒ Object

friend_account_id [Integer]



65
66
67
68
# File 'lib/play_station_network_api/user.rb', line 65

def friendship()
  # https://m.np.playstation.net/api/userProfile/v1/internal/users/me/friends/9014970682312518995/summary
  get([path, 'me', 'friends', , 'summary'].join('/')).parsed_response
end

#presenceObject



24
25
26
27
28
29
30
31
# File 'lib/play_station_network_api/user.rb', line 24

def presence
  # https://m.np.playstation.net/api/userProfile/v1/internal/users/6462910331343535058/basicPresences?type=primary
  get([path, , 'basicPresences'].join('/'),
    query: {
      type: 'primary'
    }
  ).parsed_response
end

#presences(account_ids) ⇒ Object

account_ids [Array]



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/play_station_network_api/user.rb', line 35

def presences()
  raise 'account_ids size must be less than or equal to 100' if .length > 100

  # https://m.np.playstation.net/api/userProfile/v1/internal/users/me/basicPresences?type=primary
  get([path, 'basicPresences'].join('/'),
    query: {
      type: 'primary',
      accountIds: .split.join(',')
    }
  ).parsed_response
end

#profileObject



5
6
7
8
# File 'lib/play_station_network_api/user.rb', line 5

def profile
  # https://m.np.playstation.net/api/userProfile/v1/internal/users/6462910331343535058/profiles
  get([path, , 'profiles'].join('/')).parsed_response
end

#profiles(account_ids) ⇒ Object

account_ids [Array]



12
13
14
15
16
17
18
19
20
21
# File 'lib/play_station_network_api/user.rb', line 12

def profiles()
  raise 'account_ids size must be less than or equal to 100' if .length > 100

  # https://m.np.playstation.net/api/userProfile/v1/internal/users/profiles?accountIds=6462910331343535058
  get([path, 'profiles'].join('/'),
    query: {
      accountIds: .split.join(',')
    }
  ).parsed_response
end