Skip to content

Commit 2d2212b

Browse files
committed
📝 RBS documentation
1 parent 5ac37bf commit 2d2212b

File tree

10 files changed

+180
-0
lines changed

10 files changed

+180
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.
77
## [Unreleased]
88
### Added
99
- Inline yard documentation
10+
- Complete RBS types documentation
1011
### Changed
1112
- Upgrade Code of Conduct to Contributor Covenant 2.1 by @pboling
1213
### Deprecated

sig/oauth2.rbs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module OAuth2
2+
OAUTH_DEBUG: bool
3+
4+
DEFAULT_CONFIG: untyped
5+
@config: untyped
6+
7+
def self.config: () -> untyped
8+
def self.configure: () { (untyped) -> void } -> void
9+
end

sig/oauth2/access_token.rbs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module OAuth2
2+
class AccessToken
3+
def self.from_hash: (OAuth2::Client, Hash[untyped, untyped]) -> OAuth2::AccessToken
4+
def self.from_kvform: (OAuth2::Client, String) -> OAuth2::AccessToken
5+
6+
def initialize: (OAuth2::Client, String, ?Hash[Symbol, untyped]) -> void
7+
def []: (String | Symbol) -> untyped
8+
def expires?: () -> bool
9+
def expired?: () -> bool
10+
def refresh: (?Hash[untyped, untyped], ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::AccessToken
11+
def revoke: (?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
12+
def to_hash: () -> Hash[Symbol, untyped]
13+
def request: (Symbol, String, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
14+
def get: (String, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
15+
def post: (String, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
16+
def put: (String, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
17+
def patch: (String, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
18+
def delete: (String, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
19+
def headers: () -> Hash[String, String]
20+
def configure_authentication!: (Hash[Symbol, untyped]) -> void
21+
def convert_expires_at: (untyped) -> (Time | Integer | nil)
22+
23+
attr_accessor response: OAuth2::Response
24+
end
25+
end

sig/oauth2/authenticator.rbs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module OAuth2
2+
class Authenticator
3+
include OAuth2::FilteredAttributes
4+
5+
attr_reader mode: (Symbol | String)
6+
attr_reader id: String?
7+
attr_reader secret: String?
8+
9+
def initialize: (String? id, String? secret, (Symbol | String) mode) -> void
10+
11+
def apply: (Hash[untyped, untyped]) -> Hash[untyped, untyped]
12+
13+
def self.encode_basic_auth: (String, String) -> String
14+
15+
private
16+
17+
def apply_params_auth: (Hash[untyped, untyped]) -> Hash[untyped, untyped]
18+
def apply_client_id: (Hash[untyped, untyped]) -> Hash[untyped, untyped]
19+
def apply_basic_auth: (Hash[untyped, untyped]) -> Hash[untyped, untyped]
20+
def basic_auth_header: () -> Hash[String, String]
21+
end
22+
end

sig/oauth2/client.rbs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
module OAuth2
2+
class Client
3+
RESERVED_REQ_KEYS: Array[String]
4+
RESERVED_PARAM_KEYS: Array[String]
5+
6+
include OAuth2::FilteredAttributes
7+
8+
attr_reader id: String
9+
attr_reader secret: String
10+
attr_reader site: String?
11+
attr_accessor options: Hash[Symbol, untyped]
12+
attr_writer connection: untyped
13+
14+
def initialize: (String client_id, String client_secret, ?Hash[Symbol, untyped]) { (untyped) -> void } -> void
15+
16+
def site=: (String) -> String
17+
18+
def connection: () -> untyped
19+
20+
def authorize_url: (?Hash[untyped, untyped]) -> String
21+
def token_url: (?Hash[untyped, untyped]) -> String
22+
def revoke_url: (?Hash[untyped, untyped]) -> String
23+
24+
def request: (Symbol verb, String url, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
25+
26+
def get_token: (Hash[untyped, untyped] params, ?Hash[Symbol, untyped] access_token_opts, ?Proc) { (Hash[Symbol, untyped]) -> void } -> (OAuth2::AccessToken | nil)
27+
28+
def revoke_token: (String token, ?String token_type_hint, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
29+
30+
def http_method: () -> Symbol
31+
32+
def auth_code: () -> OAuth2::Strategy::AuthCode
33+
def implicit: () -> OAuth2::Strategy::Implicit
34+
def password: () -> OAuth2::Strategy::Password
35+
def client_credentials: () -> OAuth2::Strategy::ClientCredentials
36+
def assertion: () -> OAuth2::Strategy::Assertion
37+
38+
def redirection_params: () -> Hash[String, String]
39+
40+
private
41+
42+
def params_to_req_opts: (Hash[untyped, untyped]) -> Hash[Symbol, untyped]
43+
def parse_snaky_params_headers: (Hash[untyped, untyped]) -> [Symbol, bool, untyped, (Symbol | nil), Hash[untyped, untyped], Hash[String, String]]
44+
def execute_request: (Symbol verb, String url, ?Hash[Symbol, untyped]) { (Faraday::Request) -> void } -> OAuth2::Response
45+
def authenticator: () -> OAuth2::Authenticator
46+
def parse_response_legacy: (OAuth2::Response, Hash[Symbol, untyped], Proc) -> (OAuth2::AccessToken | nil)
47+
def parse_response: (OAuth2::Response, Hash[Symbol, untyped]) -> (OAuth2::AccessToken | nil)
48+
def build_access_token: (OAuth2::Response, Hash[Symbol, untyped], untyped) -> OAuth2::AccessToken
49+
def build_access_token_legacy: (OAuth2::Response, Hash[Symbol, untyped], Proc) -> (OAuth2::AccessToken | nil)
50+
def oauth_debug_logging: (untyped) -> void
51+
end
52+
end

sig/oauth2/error.rbs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module OAuth2
2+
class Error < StandardError
3+
def initialize: (OAuth2::Response) -> void
4+
def code: () -> (String | Integer | nil)
5+
def description: () -> (String | nil)
6+
def response: () -> OAuth2::Response
7+
end
8+
end

sig/oauth2/filtered_attributes.rbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module OAuth2
2+
module FilteredAttributes
3+
def self.included: (untyped) -> untyped
4+
def filtered_attributes: (*String) -> void
5+
end
6+
end

sig/oauth2/response.rbs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module OAuth2
2+
class Response
3+
DEFAULT_OPTIONS: Hash[Symbol, untyped]
4+
5+
def self.register_parser: (Symbol key, (Array[String] | String) mime_types) { (String) -> untyped } -> void
6+
7+
def initialize: (untyped response, parse: Symbol?, snaky: bool?, snaky_hash_klass: untyped? **untyped) -> void
8+
def headers: () -> Hash[untyped, untyped]
9+
def status: () -> Integer
10+
def body: () -> String
11+
def parsed: () -> untyped
12+
def content_type: () -> (String | nil)
13+
def parser: () -> (untyped | nil)
14+
15+
attr_reader response: untyped
16+
attr_accessor options: Hash[Symbol, untyped]
17+
end
18+
end

sig/oauth2/strategy.rbs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module OAuth2
2+
module Strategy
3+
class Base
4+
def initialize: (OAuth2::Client) -> void
5+
end
6+
7+
class AuthCode < Base
8+
def authorize_params: (?Hash[untyped, untyped]) -> Hash[untyped, untyped]
9+
def authorize_url: (?Hash[untyped, untyped]) -> String
10+
def get_token: (String, ?Hash[untyped, untyped], ?Hash[Symbol, untyped]) -> OAuth2::AccessToken
11+
end
12+
13+
class Implicit < Base
14+
def authorize_params: (?Hash[untyped, untyped]) -> Hash[untyped, untyped]
15+
def authorize_url: (?Hash[untyped, untyped]) -> String
16+
def get_token: (*untyped) -> void
17+
end
18+
19+
class Password < Base
20+
def authorize_url: () -> void
21+
def get_token: (String, String, ?Hash[untyped, untyped], ?Hash[Symbol, untyped]) -> OAuth2::AccessToken
22+
end
23+
24+
class ClientCredentials < Base
25+
def authorize_url: () -> void
26+
def get_token: (?Hash[untyped, untyped], ?Hash[Symbol, untyped]) -> OAuth2::AccessToken
27+
end
28+
29+
class Assertion < Base
30+
def authorize_url: () -> void
31+
def get_token: (Hash[untyped, untyped], Hash[Symbol, untyped], ?Hash[Symbol, untyped], ?Hash[Symbol, untyped]) -> OAuth2::AccessToken
32+
end
33+
end
34+
end

sig/oauth2/version.rbs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module OAuth2
2+
module Version
3+
VERSION: String
4+
end
5+
end

0 commit comments

Comments
 (0)