psn-client 0.2.0 → 0.3.0

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.
@@ -7,7 +7,11 @@ module PSN
7
7
  PRIVACY_PATTERN: Regexp
8
8
  USER_AGENT: String
9
9
 
10
- def initialize: (String access_token) -> void
10
+ @access_token: String
11
+ @http_options: Hash[Symbol, untyped]
12
+
13
+ def self.for: (String? access_token, ?Request? request, **untyped options) -> Request
14
+ def initialize: (String access_token, ?open_timeout: Numeric?, ?read_timeout: Numeric?, ?write_timeout: Numeric?) -> void
11
15
  def get: (String path, ?host: Symbol, ?params: Hash[untyped, untyped], ?headers: Hash[String, String]) -> untyped
12
16
  def post: (String path, untyped body, ?host: Symbol, ?headers: Hash[String, String]) -> untyped
13
17
  def graphql: (String operation_name, Hash[untyped, untyped] variables, String sha256_hash, ?host: Symbol, ?headers: Hash[String, String]) -> untyped
@@ -15,10 +19,13 @@ module PSN
15
19
  private
16
20
 
17
21
  def authorize: (Net::HTTPRequest request, Hash[String, String] headers) -> Net::HTTPRequest
18
- def raise_graphql_errors: (untyped result) -> void
22
+ def raise_graphql_errors: (untyped result, Net::HTTPResponse response) -> void
23
+ def check_graphql_result: (untyped result, Net::HTTPResponse response) -> void
19
24
  def build_uri: (Symbol host, String path, Hash[untyped, untyped] params) -> URI::Generic
20
- def perform: (URI::Generic uri, Net::HTTPRequest http_request) -> untyped
25
+ def perform: (URI::Generic uri, Net::HTTPRequest http_request) -> [untyped, Net::HTTPResponse]
21
26
  def parse_response: (Net::HTTPResponse response) -> untyped
27
+ def error_class_for: (Net::HTTPResponse response) -> singleton(Error)
28
+ def failure_message: (Net::HTTPResponse response) -> String
22
29
  def privacy_error?: (Net::HTTPResponse response) -> bool
23
30
  end
24
31
  end
@@ -0,0 +1,19 @@
1
+ module PSN
2
+ module Client
3
+ class Session
4
+ @trophies: Trophies?
5
+ @users: Users?
6
+ @account: Account?
7
+
8
+ attr_reader request: Request
9
+ attr_reader tokens: Tokens?
10
+
11
+ def self.authenticate: (?npsso: String?, ?client_id: String?, ?basic_token: String?, ?open_timeout: Numeric?, ?read_timeout: Numeric?, ?write_timeout: Numeric?) -> Session
12
+ def self.from_refresh_token: (String refresh_token, ?npsso: String?, ?client_id: String?, ?basic_token: String?, ?open_timeout: Numeric?, ?read_timeout: Numeric?, ?write_timeout: Numeric?) -> Session
13
+ def initialize: (?(String | Tokens)? access_token, ?request: Request?, ?open_timeout: Numeric?, ?read_timeout: Numeric?, ?write_timeout: Numeric?) -> void
14
+ def trophies: () -> Trophies
15
+ def users: () -> Users
16
+ def account: () -> Account
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ module PSN
2
+ module Client
3
+ class Tokens
4
+ attr_reader access_token: String
5
+ attr_reader expires_at: Time?
6
+ attr_reader refresh_token: String?
7
+ attr_reader refresh_token_expires_at: Time?
8
+
9
+ def self.from_oauth2: (OAuth2::AccessToken oauth_token, ?fallback_refresh_token: String?, ?now: Time) -> Tokens
10
+ def initialize: (access_token: String, ?expires_at: Time?, ?refresh_token: String?, ?refresh_token_expires_at: Time?) -> void
11
+ def expired?: (?Time now) -> bool
12
+ def refresh_token_expired?: (?Time now) -> bool
13
+ def inspect: () -> String
14
+ alias to_s inspect
15
+
16
+ private
17
+
18
+ def past?: (Time? time, Time now) -> bool
19
+ end
20
+ end
21
+ end
@@ -1,20 +1,31 @@
1
1
  module PSN
2
2
  module Client
3
3
  class Trophies
4
+ include Pagination
5
+
6
+ TROPHY_TITLES_MAX_LIMIT: Integer
7
+ USER_ID_PATTERN: Regexp
8
+ NP_COMMUNICATION_ID_PATTERN: Regexp
9
+ TROPHY_GROUP_ID_PATTERN: Regexp
10
+
4
11
  @request: Request
5
12
 
6
- def initialize: (String access_token) -> void
7
- def trophy_titles: (?user_id: String, ?limit: Integer, ?offset: Integer) -> untyped
8
- def trophy_summary: (?user_id: String) -> untyped
13
+ def initialize: (?String? access_token, ?request: Request?) -> void
14
+ def trophy_titles: (?user_id: String | Integer, ?limit: Integer, ?offset: Integer) -> untyped
15
+ def trophy_summary: (?user_id: String | Integer) -> untyped
9
16
  def title_trophy_groups: (np_communication_id: String, ?np_service_name: String?, ?platform: String?) -> untyped
10
- def earned_trophy_groups: (?user_id: String, np_communication_id: String, ?np_service_name: String?, ?platform: String?) -> untyped
11
- def title_trophies: (np_communication_id: String, ?trophy_group_id: String, ?np_service_name: String?, ?platform: String?, **untyped options) -> untyped
12
- def earned_trophies: (?user_id: String, np_communication_id: String, ?trophy_group_id: String, ?np_service_name: String?, ?platform: String?, **untyped options) -> untyped
13
-
17
+ def earned_trophy_groups: (?user_id: String | Integer, np_communication_id: String, ?np_service_name: String?, ?platform: String?) -> untyped
18
+ def title_trophies: (np_communication_id: String, ?trophy_group_id: String, ?np_service_name: String?, ?platform: String?, ?limit: Integer?, ?offset: Integer?) -> untyped
19
+ def earned_trophies: (?user_id: String | Integer, np_communication_id: String, ?trophy_group_id: String, ?np_service_name: String?, ?platform: String?, ?limit: Integer?, ?offset: Integer?) -> untyped
20
+
14
21
  private
15
22
 
23
+ def user: (untyped user_id) -> untyped
24
+ def title: (untyped np_communication_id) -> untyped
25
+ def group: (untyped trophy_group_id) -> untyped
26
+ def segment: (String name, untyped value, Regexp pattern) -> untyped
27
+ def title_params: (String? service_name, String? platform, ?limit: Integer?, ?offset: Integer?) -> Hash[String, String | Integer]
16
28
  def resolve_service_name: (String? service_name, String? platform) -> String?
17
- def build_query_string: (**untyped query_params) -> String
18
29
  end
19
30
  end
20
31
  end
@@ -18,7 +18,7 @@ module PSN
18
18
 
19
19
  @request: Request
20
20
 
21
- def initialize: (String access_token) -> void
21
+ def initialize: (?String? access_token, ?request: Request?) -> void
22
22
  def search: (String term) -> untyped
23
23
  def account_id: (String online_id) -> String
24
24
  def profile: (online_id: String) -> Hash[String, untyped]?
data/sig/psn/client.rbs CHANGED
@@ -2,12 +2,6 @@ module PSN
2
2
  module Client
3
3
  VERSION: String
4
4
 
5
- class Error < StandardError
6
- end
7
-
8
- class PrivacyError < Error
9
- end
10
-
11
5
  # See the writing guide of rbs: https://github.com/ruby/rbs#guides
12
6
  end
13
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psn-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Jacques
@@ -41,8 +41,11 @@ files:
41
41
  - lib/psn/client.rb
42
42
  - lib/psn/client/account.rb
43
43
  - lib/psn/client/auth.rb
44
+ - lib/psn/client/errors.rb
44
45
  - lib/psn/client/pagination.rb
45
46
  - lib/psn/client/request.rb
47
+ - lib/psn/client/session.rb
48
+ - lib/psn/client/tokens.rb
46
49
  - lib/psn/client/trophies.rb
47
50
  - lib/psn/client/users.rb
48
51
  - lib/psn/client/version.rb
@@ -50,8 +53,11 @@ files:
50
53
  - sig/psn/client.rbs
51
54
  - sig/psn/client/account.rbs
52
55
  - sig/psn/client/auth.rbs
56
+ - sig/psn/client/errors.rbs
53
57
  - sig/psn/client/pagination.rbs
54
58
  - sig/psn/client/request.rbs
59
+ - sig/psn/client/session.rbs
60
+ - sig/psn/client/tokens.rbs
55
61
  - sig/psn/client/trophies.rbs
56
62
  - sig/psn/client/users.rbs
57
63
  - sig/psn/logger.rbs