plex_ruby_sdk 0.7.7 → 0.8.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.
- checksums.yaml +4 -4
- data/lib/plex_ruby_sdk/activities.rb +115 -12
- data/lib/plex_ruby_sdk/authentication.rb +233 -29
- data/lib/plex_ruby_sdk/butler.rb +283 -30
- data/lib/plex_ruby_sdk/hubs.rb +174 -21
- data/lib/plex_ruby_sdk/library.rb +913 -110
- data/lib/plex_ruby_sdk/log.rb +179 -24
- data/lib/plex_ruby_sdk/media.rb +288 -35
- data/lib/plex_ruby_sdk/playlists.rb +513 -60
- data/lib/plex_ruby_sdk/plex.rb +388 -38
- data/lib/plex_ruby_sdk/plex_api.rb +29 -10
- data/lib/plex_ruby_sdk/sdk_hooks/hooks.rb +103 -0
- data/lib/plex_ruby_sdk/sdk_hooks/registration.rb +35 -0
- data/lib/plex_ruby_sdk/sdk_hooks/types.rb +152 -0
- data/lib/plex_ruby_sdk/sdkconfiguration.rb +26 -7
- data/lib/plex_ruby_sdk/search.rb +174 -21
- data/lib/plex_ruby_sdk/server.rb +505 -53
- data/lib/plex_ruby_sdk/sessions.rb +228 -25
- data/lib/plex_ruby_sdk/statistics.rb +174 -21
- data/lib/plex_ruby_sdk/updater.rb +173 -20
- data/lib/plex_ruby_sdk/users.rb +56 -4
- data/lib/plex_ruby_sdk/utils/retries.rb +95 -0
- data/lib/plex_ruby_sdk/utils/utils.rb +10 -0
- data/lib/plex_ruby_sdk/video.rb +117 -14
- data/lib/plex_ruby_sdk/watchlist.rb +60 -7
- metadata +36 -4
@@ -5,7 +5,10 @@
|
|
5
5
|
|
6
6
|
require 'faraday'
|
7
7
|
require 'faraday/multipart'
|
8
|
+
require 'faraday/retry'
|
8
9
|
require 'sorbet-runtime'
|
10
|
+
require_relative 'sdk_hooks/hooks'
|
11
|
+
require_relative 'utils/retries'
|
9
12
|
|
10
13
|
module PlexRubySDK
|
11
14
|
extend T::Sig
|
@@ -25,8 +28,8 @@ module PlexRubySDK
|
|
25
28
|
end
|
26
29
|
|
27
30
|
|
28
|
-
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetWatchListRequest), server_url: T.nilable(String)).returns(::PlexRubySDK::Operations::GetWatchListResponse) }
|
29
|
-
def get_watch_list(request, server_url = nil)
|
31
|
+
sig { params(request: T.nilable(::PlexRubySDK::Operations::GetWatchListRequest), server_url: T.nilable(String), timeout_ms: T.nilable(Integer)).returns(::PlexRubySDK::Operations::GetWatchListResponse) }
|
32
|
+
def get_watch_list(request, server_url = nil, timeout_ms = nil)
|
30
33
|
# get_watch_list - Get User Watchlist
|
31
34
|
# Get User Watchlist
|
32
35
|
base_url = Utils.template_url(GET_WATCH_LIST_SERVERS[0], {
|
@@ -43,11 +46,61 @@ module PlexRubySDK
|
|
43
46
|
headers['Accept'] = 'application/json'
|
44
47
|
headers['user-agent'] = @sdk_configuration.user_agent
|
45
48
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
49
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
50
|
+
|
51
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
52
|
+
timeout ||= @sdk_configuration.timeout
|
53
|
+
|
54
|
+
connection = @sdk_configuration.client
|
55
|
+
|
56
|
+
hook_ctx = SDKHooks::HookContext.new(
|
57
|
+
base_url: base_url,
|
58
|
+
oauth2_scopes: nil,
|
59
|
+
operation_id: 'get-watch-list',
|
60
|
+
security_source: @sdk_configuration.security_source
|
61
|
+
)
|
62
|
+
|
63
|
+
error = T.let(nil, T.nilable(StandardError))
|
64
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
65
|
+
|
66
|
+
begin
|
67
|
+
r = connection.get(url) do |req|
|
68
|
+
req.headers.merge!(headers)
|
69
|
+
req.options.timeout = timeout unless timeout.nil?
|
70
|
+
req.params = query_params
|
71
|
+
Utils.configure_request_security(req, security)
|
72
|
+
|
73
|
+
@sdk_configuration.hooks.before_request(
|
74
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
75
|
+
hook_ctx: hook_ctx
|
76
|
+
),
|
77
|
+
request: req
|
78
|
+
)
|
79
|
+
end
|
80
|
+
rescue StandardError => e
|
81
|
+
error = e
|
82
|
+
ensure
|
83
|
+
if r.nil? || Utils.error_status?(r.status)
|
84
|
+
r = @sdk_configuration.hooks.after_error(
|
85
|
+
error: error,
|
86
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
87
|
+
hook_ctx: hook_ctx
|
88
|
+
),
|
89
|
+
response: r
|
90
|
+
)
|
91
|
+
else
|
92
|
+
r = @sdk_configuration.hooks.after_success(
|
93
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
94
|
+
hook_ctx: hook_ctx
|
95
|
+
),
|
96
|
+
response: r
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
if r.nil?
|
101
|
+
raise error if !error.nil?
|
102
|
+
raise 'no response'
|
103
|
+
end
|
51
104
|
end
|
52
105
|
|
53
106
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plex_ruby_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LukeHagar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday-retry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.2.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.2.1
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rack
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +128,28 @@ dependencies:
|
|
114
128
|
requirements:
|
115
129
|
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
131
|
+
version: 1.73.2
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.73.2
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop-minitest
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.37.1
|
118
146
|
type: :development
|
119
147
|
prerelease: false
|
120
148
|
version_requirements: !ruby/object:Gem::Requirement
|
121
149
|
requirements:
|
122
150
|
- - "~>"
|
123
151
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
152
|
+
version: 0.37.1
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: sorbet
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1052,6 +1080,9 @@ files:
|
|
1052
1080
|
- lib/plex_ruby_sdk/playlists.rb
|
1053
1081
|
- lib/plex_ruby_sdk/plex.rb
|
1054
1082
|
- lib/plex_ruby_sdk/plex_api.rb
|
1083
|
+
- lib/plex_ruby_sdk/sdk_hooks/hooks.rb
|
1084
|
+
- lib/plex_ruby_sdk/sdk_hooks/registration.rb
|
1085
|
+
- lib/plex_ruby_sdk/sdk_hooks/types.rb
|
1055
1086
|
- lib/plex_ruby_sdk/sdkconfiguration.rb
|
1056
1087
|
- lib/plex_ruby_sdk/search.rb
|
1057
1088
|
- lib/plex_ruby_sdk/server.rb
|
@@ -1061,6 +1092,7 @@ files:
|
|
1061
1092
|
- lib/plex_ruby_sdk/statistics.rb
|
1062
1093
|
- lib/plex_ruby_sdk/updater.rb
|
1063
1094
|
- lib/plex_ruby_sdk/users.rb
|
1095
|
+
- lib/plex_ruby_sdk/utils/retries.rb
|
1064
1096
|
- lib/plex_ruby_sdk/utils/utils.rb
|
1065
1097
|
- lib/plex_ruby_sdk/video.rb
|
1066
1098
|
- lib/plex_ruby_sdk/watchlist.rb
|