Class: PlayStationNetworkAPI::Client
- Inherits:
-
Object
- Object
- PlayStationNetworkAPI::Client
show all
- Includes:
- HTTParty
- Defined in:
- lib/play_station_network_api/client.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(refresh_token, account_id: 'me', country: 'GB', language: 'en') ⇒ Client
Returns a new instance of Client.
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/play_station_network_api/client.rb', line 12
def initialize(refresh_token, account_id: 'me', country: 'GB', language: 'en')
@refresh_token = refresh_token
= {
'Accept-Language' => 'en-US',
'User-Agent' => "psn-api/#{ VERSION }"
}
@account_id = account_id
@country = country
@language = language
end
|
Instance Attribute Details
#account_id ⇒ Object
Returns the value of attribute account_id.
10
11
12
|
# File 'lib/play_station_network_api/client.rb', line 10
def account_id
@account_id
end
|
#age ⇒ Object
Returns the value of attribute age.
10
11
12
|
# File 'lib/play_station_network_api/client.rb', line 10
def age
@age
end
|
#country ⇒ Object
Returns the value of attribute country.
10
11
12
|
# File 'lib/play_station_network_api/client.rb', line 10
def country
@country
end
|
Returns the value of attribute default_headers.
10
11
12
|
# File 'lib/play_station_network_api/client.rb', line 10
def
end
|
#language ⇒ Object
Returns the value of attribute language.
10
11
12
|
# File 'lib/play_station_network_api/client.rb', line 10
def language
@language
end
|
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
10
11
12
|
# File 'lib/play_station_network_api/client.rb', line 10
def refresh_token
@refresh_token
end
|
Instance Method Details
#catalog ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/play_station_network_api/client.rb', line 27
def catalog
PlayStationNetworkAPI::Catalog.new(refresh_token,
account_id: account_id,
country: country,
language: language
)
end
|
#entitlement ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/play_station_network_api/client.rb', line 35
def entitlement
PlayStationNetworkAPI::Entitlement.new(refresh_token,
account_id: account_id,
country: country,
language: language
)
end
|
#explore ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/play_station_network_api/client.rb', line 43
def explore
PlayStationNetworkAPI::Explore.new(refresh_token,
account_id: account_id,
country: country,
language: language
)
end
|
#game ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/play_station_network_api/client.rb', line 51
def game
PlayStationNetworkAPI::Game.new(refresh_token,
account_id: account_id,
country: country,
language: language
)
end
|
#get_account_devices ⇒ Object
99
100
101
102
103
104
|
# File 'lib/play_station_network_api/client.rb', line 99
def get_account_devices
self.class.base_uri 'https://dms.api.playstation.com/api'
get('/v1/devices/accounts/me').parsed_response['accountDevices']
end
|
#get_account_id ⇒ Object
92
93
94
95
96
97
|
# File 'lib/play_station_network_api/client.rb', line 92
def get_account_id
self.class.base_uri 'https://dms.api.playstation.com/api'
get('/v1/devices/accounts/me').parsed_response['accountId']
end
|
#search ⇒ Object
59
60
61
62
63
64
65
|
# File 'lib/play_station_network_api/client.rb', line 59
def search
PlayStationNetworkAPI::Search.new(refresh_token,
account_id: account_id,
country: country,
language: language
)
end
|
#session ⇒ Object
67
68
69
70
71
72
73
|
# File 'lib/play_station_network_api/client.rb', line 67
def session
PlayStationNetworkAPI::Session.new(refresh_token,
account_id: account_id,
country: country,
language: language
)
end
|
#trophy ⇒ Object
75
76
77
78
79
80
81
|
# File 'lib/play_station_network_api/client.rb', line 75
def trophy
PlayStationNetworkAPI::Trophy.new(refresh_token,
account_id: account_id,
country: country,
language: language
)
end
|
#user ⇒ Object
83
84
85
86
87
88
89
|
# File 'lib/play_station_network_api/client.rb', line 83
def user
PlayStationNetworkAPI::User.new(refresh_token,
account_id: account_id,
country: country,
language: language
)
end
|