class PlayStationNetworkAPI::User

Public Instance Methods

available_to_play() click to toggle source

@private true

# 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
blocks() click to toggle source

@private true

# 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) click to toggle source

@private true type [Symbol] => :received, :sent

# 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) click to toggle source

@private false limit [Integer] {

min: 1,
max: 1000

}

# 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, account_id, 'friends'].join('/'),
    query: {
      limit: limit
    }
  ).parsed_response
end
friendship(friend_account_id) click to toggle source

@private true friend_account_id [Integer]

# File lib/play_station_network_api/user.rb, line 65
def friendship(friend_account_id)
  # https://m.np.playstation.net/api/userProfile/v1/internal/users/me/friends/9014970682312518995/summary
  get([path, 'me', 'friends', friend_account_id, 'summary'].join('/')).parsed_response
end
presence() click to toggle source

@private false

# 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, account_id, 'basicPresences'].join('/'),
    query: {
      type: 'primary'
    }
  ).parsed_response
end
presences(account_ids) click to toggle source

@private false account_ids [Array]

# File lib/play_station_network_api/user.rb, line 35
def presences(account_ids)
  raise 'account_ids size must be less than or equal to 100' if account_ids.length > 100

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

@private false

# 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, account_id, 'profiles'].join('/')).parsed_response
end
profiles(account_ids) click to toggle source

@private false account_ids [Array]

# File lib/play_station_network_api/user.rb, line 12
def profiles(account_ids)
  raise 'account_ids size must be less than or equal to 100' if account_ids.length > 100

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

Private Instance Methods

path() click to toggle source
# File lib/play_station_network_api/user.rb, line 91
def path
  '/userProfile/v1/internal/users'.freeze
end