anilibria-api-ruby 1.0.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 +7 -0
- data/.rspec +3 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +65 -0
- data/LICENSE +21 -0
- data/README.md +72 -0
- data/Rakefile +8 -0
- data/bin/console +7 -0
- data/bin/setup +6 -0
- data/lib/anilibria/api/client/_methods.rb +28 -0
- data/lib/anilibria/api/client.rb +102 -0
- data/lib/anilibria/api/exceptions/api_error.rb +15 -0
- data/lib/anilibria/api/exceptions/auth_error.rb +16 -0
- data/lib/anilibria/api/exceptions/base.rb +8 -0
- data/lib/anilibria/api/exceptions/response_error.rb +14 -0
- data/lib/anilibria/api/exceptions.rb +4 -0
- data/lib/anilibria/api/types/base.rb +9 -0
- data/lib/anilibria/api/types/dry_types.rb +12 -0
- data/lib/anilibria/api/types/feed.rb +14 -0
- data/lib/anilibria/api/types/schedule.rb +10 -0
- data/lib/anilibria/api/types/seed_stats.rb +11 -0
- data/lib/anilibria/api/types/team.rb +11 -0
- data/lib/anilibria/api/types/title.rb +141 -0
- data/lib/anilibria/api/types/youtube.rb +14 -0
- data/lib/anilibria/api/types.rb +8 -0
- data/lib/anilibria/api/version.rb +6 -0
- data/lib/anilibria/api.rb +7 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 19108f3f24b1792bb2640d48a562bea69ff82c3d9ff3f372ae1efe7952cd8340
|
4
|
+
data.tar.gz: 0eecd5734d837d98156619f3ac864fd154113478c515cfbee8535cd00af468ad
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 34d6bbd2917aa045c0cf7c97a98b19dd6b8e07b9cc19629e322090d978e561e6c8156e9da9c0d4f303f4fa922a0131c87ae61f91fa561aa06de1682418f11e78
|
7
|
+
data.tar.gz: fceeca87a3a2bcba908deaddca452b27fe38d2e65cb527d55efab0ac8cc8284f475102be8d5264114ee606cd99dd98e83f883264291fb4da78abe1d8a6bfc8c5
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
anilibria-api-ruby (1.0.0)
|
5
|
+
dry-struct (~> 1.4)
|
6
|
+
faraday (~> 2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
concurrent-ruby (1.1.9)
|
12
|
+
diff-lcs (1.5.0)
|
13
|
+
dry-configurable (0.14.0)
|
14
|
+
concurrent-ruby (~> 1.0)
|
15
|
+
dry-core (~> 0.6)
|
16
|
+
dry-container (0.9.0)
|
17
|
+
concurrent-ruby (~> 1.0)
|
18
|
+
dry-configurable (~> 0.13, >= 0.13.0)
|
19
|
+
dry-core (0.7.1)
|
20
|
+
concurrent-ruby (~> 1.0)
|
21
|
+
dry-inflector (0.2.1)
|
22
|
+
dry-logic (1.2.0)
|
23
|
+
concurrent-ruby (~> 1.0)
|
24
|
+
dry-core (~> 0.5, >= 0.5)
|
25
|
+
dry-struct (1.4.0)
|
26
|
+
dry-core (~> 0.5, >= 0.5)
|
27
|
+
dry-types (~> 1.5)
|
28
|
+
ice_nine (~> 0.11)
|
29
|
+
dry-types (1.5.1)
|
30
|
+
concurrent-ruby (~> 1.0)
|
31
|
+
dry-container (~> 0.3)
|
32
|
+
dry-core (~> 0.5, >= 0.5)
|
33
|
+
dry-inflector (~> 0.1, >= 0.1.2)
|
34
|
+
dry-logic (~> 1.0, >= 1.0.2)
|
35
|
+
faraday (2.2.0)
|
36
|
+
faraday-net_http (~> 2.0)
|
37
|
+
ruby2_keywords (>= 0.0.4)
|
38
|
+
faraday-net_http (2.0.1)
|
39
|
+
ice_nine (0.11.2)
|
40
|
+
rake (13.0.6)
|
41
|
+
rspec (3.10.0)
|
42
|
+
rspec-core (~> 3.10.0)
|
43
|
+
rspec-expectations (~> 3.10.0)
|
44
|
+
rspec-mocks (~> 3.10.0)
|
45
|
+
rspec-core (3.10.2)
|
46
|
+
rspec-support (~> 3.10.0)
|
47
|
+
rspec-expectations (3.10.2)
|
48
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
+
rspec-support (~> 3.10.0)
|
50
|
+
rspec-mocks (3.10.3)
|
51
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
+
rspec-support (~> 3.10.0)
|
53
|
+
rspec-support (3.10.3)
|
54
|
+
ruby2_keywords (0.0.5)
|
55
|
+
|
56
|
+
PLATFORMS
|
57
|
+
x86_64-linux
|
58
|
+
|
59
|
+
DEPENDENCIES
|
60
|
+
anilibria-api-ruby!
|
61
|
+
rake (~> 13.0)
|
62
|
+
rspec (~> 3.0)
|
63
|
+
|
64
|
+
BUNDLED WITH
|
65
|
+
2.3.4
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Roman Kozachenko
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# anilibria-api-ruby
|
2
|
+
|
3
|
+
Ruby wrapper for [AniLibria API](https://github.com/anilibria/docs/blob/master/api_v2.md).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'anilibria-api-ruby'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```shell
|
16
|
+
$ bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
```shell
|
22
|
+
$ gem install anilibria-api-ruby
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Usage example:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require 'anilibria/api'
|
31
|
+
|
32
|
+
anilibria = Anilibria::Api::Client.new
|
33
|
+
|
34
|
+
anilibria.get_years # => [1996, 1998, 2001, 2003, 2004, 2005, 2006, ...]
|
35
|
+
|
36
|
+
title = anilibria.get_title(code: 'steinsgate') # => #<Anilibria::Api::Types::Title id=8674 code="steinsgate"...
|
37
|
+
title.names.en # => "Steins;Gate"
|
38
|
+
```
|
39
|
+
|
40
|
+
`anilibria` object implements [AniLibria API methods](https://github.com/anilibria/docs/blob/master/api_v2.md#method-list) as is. All methods are available in *snake_case* notation. Same with the `title` object - it implements the [Title](https://github.com/anilibria/docs/blob/master/api_v2.md#возвращаемые-значения-при-запросе-информации-о-тайтле) specification.
|
41
|
+
|
42
|
+
## Authorization
|
43
|
+
|
44
|
+
The client supports authorization:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
# session = anilibria.auth('wrongemail@example.com', 'WrongPassword') # => nil
|
48
|
+
# session = anilibria.auth!('wrongemail@example.com', 'WrongPassword') # raises an error Anilibria::Api::Exceptions::AuthError
|
49
|
+
session = anilibria.auth('correctemail@example.com', 'CorrectPassword') # returns the session string
|
50
|
+
|
51
|
+
anilibria.add_favorite(title_id: 9114, session: session) # => true
|
52
|
+
|
53
|
+
titles = anilibria.get_favorites(filter: 'id,code,names,description', session: session)
|
54
|
+
# => [#<Anilibria::Api::Types::Title id=9114 code="shingeki-no-k...
|
55
|
+
|
56
|
+
```
|
57
|
+
|
58
|
+
## API Version
|
59
|
+
|
60
|
+
You can get the currently used version of [AniLibria API](https://github.com/anilibria/docs/blob/master/api_v2.md):
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
anilibria.api_version # => "2.13.10"
|
64
|
+
```
|
65
|
+
|
66
|
+
## Contributing
|
67
|
+
|
68
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/psychosocial88/anilibria-api-ruby.
|
69
|
+
|
70
|
+
## License
|
71
|
+
|
72
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module Anilibria
|
2
|
+
module Api
|
3
|
+
class Client
|
4
|
+
# Public Methods
|
5
|
+
api_method :get_title, returns: Types::Title
|
6
|
+
api_method :get_titles, returns: DryTypes::Array.of(Types::Title)
|
7
|
+
api_method :get_updates, returns: DryTypes::Array.of(Types::Title)
|
8
|
+
api_method :get_changes, returns: DryTypes::Array.of(Types::Title)
|
9
|
+
api_method :get_schedule, returns: DryTypes::Array.of(Types::Schedule)
|
10
|
+
api_method :get_random_title, returns: Types::Title
|
11
|
+
api_method :get_youtube, 'getYouTube', returns: DryTypes::Array.of(Types::YouTube)
|
12
|
+
api_method :get_feed, returns: Types::Feed
|
13
|
+
api_method :get_years, returns: DryTypes::Array.of(DryTypes::Strict::Integer)
|
14
|
+
api_method :get_genres, returns: DryTypes::Array.of(DryTypes::Strict::String)
|
15
|
+
api_method :get_caching_nodes, returns: DryTypes::Array.of(DryTypes::Strict::String)
|
16
|
+
api_method :get_team, returns: DryTypes.Constructor(Types::Team) { |team| team[:team] }
|
17
|
+
api_method :get_rss, 'getRSS', returns: DryTypes::Strict::String | DryTypes::Strict::Hash
|
18
|
+
api_method :get_seed_stats, returns: DryTypes::Array.of(Types::SeedStats)
|
19
|
+
api_method :search_titles, returns: DryTypes::Array.of(Types::Title)
|
20
|
+
api_method :advanced_search, returns: DryTypes::Array.of(Types::Title)
|
21
|
+
|
22
|
+
# Methods that require authorization
|
23
|
+
api_method :get_favorites, returns: DryTypes::Array.of(Types::Title)
|
24
|
+
api_method :add_favorite, http_method: :put, returns: DryTypes::Success
|
25
|
+
api_method :del_favorite, http_method: :delete, returns: DryTypes::Success
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
module Anilibria
|
2
|
+
module Api
|
3
|
+
class Client
|
4
|
+
class << self
|
5
|
+
def api_method(method_name, api_method_name = nil, returns:, http_method: :get)
|
6
|
+
(@api_methods ||= []) << method_name.to_sym
|
7
|
+
api_method_name ||= camelize(method_name.to_s)
|
8
|
+
|
9
|
+
define_method(method_name) do |params = {}|
|
10
|
+
response_body = call(api_method_name, params, http_method)
|
11
|
+
returns[response_body]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def api_methods
|
16
|
+
(@api_methods ||= []).dup
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def camelize(method_name)
|
22
|
+
words = method_name.split('_')
|
23
|
+
words.drop(1).map(&:capitalize!)
|
24
|
+
words.join
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
DryTypes = Types::DryTypes
|
29
|
+
|
30
|
+
API_VERSION = '2.13'.freeze
|
31
|
+
public_constant :API_VERSION
|
32
|
+
|
33
|
+
ENDPOINT = "https://api.anilibria.tv/v#{API_VERSION}".freeze
|
34
|
+
public_constant :ENDPOINT
|
35
|
+
|
36
|
+
AUTH_ENDPOINT = 'https://www.anilibria.tv/public/login.php'.freeze
|
37
|
+
public_constant :AUTH_ENDPOINT
|
38
|
+
|
39
|
+
attr_reader :connection
|
40
|
+
|
41
|
+
def initialize(url: ENDPOINT)
|
42
|
+
@connection = Faraday.new(url: url) do |f|
|
43
|
+
f.request :url_encoded
|
44
|
+
f.response :json, parser_options: { symbolize_names: true }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def call(method_name, params = {}, http_method = :get)
|
49
|
+
http_method = :get unless %i[get post put patch delete].include?(http_method)
|
50
|
+
response = connection.public_send(http_method, method_name) do |req|
|
51
|
+
req.params.merge!(params)
|
52
|
+
end
|
53
|
+
|
54
|
+
check_response!(response)
|
55
|
+
response.body
|
56
|
+
end
|
57
|
+
|
58
|
+
def auth(mail, passwd)
|
59
|
+
response = auth_response(mail, passwd)
|
60
|
+
|
61
|
+
return unless response[:key] == 'success'
|
62
|
+
|
63
|
+
response[:sessionId]
|
64
|
+
end
|
65
|
+
|
66
|
+
def auth!(mail, passwd)
|
67
|
+
response = auth_response(mail, passwd)
|
68
|
+
|
69
|
+
raise Exceptions::AuthError, response unless response[:key] == 'success'
|
70
|
+
|
71
|
+
response[:sessionId]
|
72
|
+
end
|
73
|
+
|
74
|
+
def api_version
|
75
|
+
connection.get.headers['api-version']
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def auth_response(mail, passwd)
|
81
|
+
response = connection.post(
|
82
|
+
AUTH_ENDPOINT,
|
83
|
+
{ mail: mail, passwd: passwd }
|
84
|
+
)
|
85
|
+
|
86
|
+
JSON.parse(response.body, { symbolize_names: true })
|
87
|
+
end
|
88
|
+
|
89
|
+
def check_response!(response)
|
90
|
+
return if response.status == 200
|
91
|
+
|
92
|
+
if !response.body.respond_to?(:to_hash) || !response.body.key?(:error)
|
93
|
+
raise Exceptions::ResponseError.new('Unexpected response from API', response)
|
94
|
+
end
|
95
|
+
|
96
|
+
raise Exceptions::ApiError, response
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
require 'anilibria/api/client/_methods'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Anilibria
|
2
|
+
module Api
|
3
|
+
module Exceptions
|
4
|
+
class ApiError < ResponseError
|
5
|
+
attr_reader :code
|
6
|
+
|
7
|
+
def initialize(response)
|
8
|
+
error = response.body[:error].to_h
|
9
|
+
@code = error[:code]
|
10
|
+
super("#{error[:code]} #{error[:message]}", response)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Anilibria
|
2
|
+
module Api
|
3
|
+
module Exceptions
|
4
|
+
class AuthError < Base
|
5
|
+
attr_reader :err, :key, :mes
|
6
|
+
|
7
|
+
def initialize(response_body)
|
8
|
+
@err = response_body[:err]
|
9
|
+
@key = response_body[:key]
|
10
|
+
@mes = response_body[:mes]
|
11
|
+
super("#{mes} (#{key})")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Anilibria
|
2
|
+
module Api
|
3
|
+
module Types
|
4
|
+
Feed = DryTypes::Array.of(
|
5
|
+
DryTypes.Constructor(Types::Base) do |i|
|
6
|
+
case i.keys.first
|
7
|
+
when :title then Types::Title.new(i[:title])
|
8
|
+
when :youtube then Types::YouTube.new(i[:youtube])
|
9
|
+
end
|
10
|
+
end
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
module Anilibria
|
2
|
+
module Api
|
3
|
+
module Types
|
4
|
+
class Title < Base
|
5
|
+
class Series < Base
|
6
|
+
attribute? :first, DryTypes::Integer.optional
|
7
|
+
attribute? :last, DryTypes::Integer.optional
|
8
|
+
attribute? :string, DryTypes::String.optional
|
9
|
+
end
|
10
|
+
|
11
|
+
class Player < Base
|
12
|
+
class Playlist < Base
|
13
|
+
attribute? :serie, DryTypes::Strict::Integer
|
14
|
+
attribute? :created_timestamp, DryTypes::Timestamp
|
15
|
+
|
16
|
+
attribute? :hls do
|
17
|
+
attribute? :fhd, DryTypes::String.optional
|
18
|
+
attribute? :hd, DryTypes::String.optional
|
19
|
+
attribute? :sd, DryTypes::String.optional
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
attribute? :alternative_player, DryTypes::String.optional
|
24
|
+
attribute? :host, DryTypes::String.optional
|
25
|
+
attribute? :series, Title::Series
|
26
|
+
|
27
|
+
attribute?(
|
28
|
+
:playlist,
|
29
|
+
DryTypes::Hash.map(
|
30
|
+
DryTypes.Constructor(Integer) { |i| Integer(i.to_s) }, DryTypes.Constructor(Playlist)
|
31
|
+
) | DryTypes::Array.of(Playlist)
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
class Torrents < Base
|
36
|
+
class Torrent < Base
|
37
|
+
class Metadata < Base
|
38
|
+
class FilesList < Base
|
39
|
+
attribute? :file, DryTypes::Strict::String
|
40
|
+
attribute? :size, DryTypes::Strict::Integer
|
41
|
+
attribute? :offset, DryTypes::Strict::Integer
|
42
|
+
end
|
43
|
+
|
44
|
+
undef hash
|
45
|
+
|
46
|
+
attribute? :hash, DryTypes::Strict::String
|
47
|
+
attribute? :name, DryTypes::Strict::String
|
48
|
+
attribute? :announce, DryTypes::Array.of(DryTypes::Strict::String)
|
49
|
+
attribute? :created_timestamp, DryTypes::Timestamp
|
50
|
+
|
51
|
+
attribute? :files_list, DryTypes::Array.of(FilesList)
|
52
|
+
end
|
53
|
+
|
54
|
+
undef hash
|
55
|
+
|
56
|
+
attribute? :torrent_id, DryTypes::Strict::Integer
|
57
|
+
attribute? :series, Title::Series
|
58
|
+
|
59
|
+
attribute? :quality do
|
60
|
+
attribute? :string, DryTypes::Strict::String
|
61
|
+
attribute? :type, DryTypes::Strict::String
|
62
|
+
attribute? :resolution, DryTypes::Strict::Integer
|
63
|
+
attribute? :encoder, DryTypes::Strict::String
|
64
|
+
attribute? :lq_audio, DryTypes::Strict::Bool
|
65
|
+
end
|
66
|
+
|
67
|
+
%i[leechers seeders downloads total_size].each do |i|
|
68
|
+
attribute? i, DryTypes::Strict::Integer
|
69
|
+
end
|
70
|
+
|
71
|
+
attribute? :url, DryTypes::Strict::String
|
72
|
+
attribute? :uploaded_timestamp, DryTypes::Timestamp
|
73
|
+
attribute? :hash, DryTypes::Strict::String
|
74
|
+
attribute? :metadata, DryTypes::Strict::Nil | Metadata
|
75
|
+
attribute? :raw_base64_file, DryTypes::String.optional
|
76
|
+
end
|
77
|
+
|
78
|
+
attribute? :series, Title::Series
|
79
|
+
attribute? :list, DryTypes::Array.of(Torrent)
|
80
|
+
end
|
81
|
+
|
82
|
+
attribute? :id, DryTypes::Strict::Integer
|
83
|
+
attribute? :code, DryTypes::Strict::String
|
84
|
+
|
85
|
+
attribute? :names do
|
86
|
+
attribute? :ru, DryTypes::String.optional
|
87
|
+
attribute? :en, DryTypes::String.optional
|
88
|
+
attribute? :alternative, DryTypes::String.optional
|
89
|
+
end
|
90
|
+
|
91
|
+
attribute? :announce, DryTypes::String.optional
|
92
|
+
|
93
|
+
attribute? :status do
|
94
|
+
attribute? :string, DryTypes::Strict::String
|
95
|
+
attribute? :code, DryTypes::Strict::Integer
|
96
|
+
end
|
97
|
+
|
98
|
+
attribute? :posters do
|
99
|
+
%i[small medium original].each do |poster|
|
100
|
+
attribute? poster do
|
101
|
+
attribute? :url, DryTypes::String.optional
|
102
|
+
attribute? :raw_base64_file, DryTypes::String.optional
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
attribute? :updated, DryTypes::Timestamp.optional
|
108
|
+
attribute? :last_change, DryTypes::Timestamp.optional
|
109
|
+
|
110
|
+
attribute? :type do
|
111
|
+
attribute? :full_string, DryTypes::String.optional
|
112
|
+
attribute? :string, DryTypes::String.optional
|
113
|
+
attribute? :length, DryTypes::String.optional
|
114
|
+
attribute? :series, DryTypes::Integer.optional
|
115
|
+
attribute? :code, DryTypes::Integer.optional
|
116
|
+
end
|
117
|
+
|
118
|
+
attribute? :genres, DryTypes::Array.of(DryTypes::Strict::String)
|
119
|
+
attribute? :team, Types::Team
|
120
|
+
|
121
|
+
attribute? :season do
|
122
|
+
attribute? :string, DryTypes::String.optional
|
123
|
+
attribute? :code, DryTypes::Integer.optional
|
124
|
+
attribute? :year, DryTypes::Integer.optional
|
125
|
+
attribute? :week_day, DryTypes::Integer.optional
|
126
|
+
end
|
127
|
+
|
128
|
+
attribute? :description, DryTypes::String.optional
|
129
|
+
attribute? :in_favorites, DryTypes::Integer.optional
|
130
|
+
|
131
|
+
attribute? :blocked do
|
132
|
+
attribute? :blocked, DryTypes::Strict::Bool
|
133
|
+
attribute? :bakanim, DryTypes::Strict::Bool
|
134
|
+
end
|
135
|
+
|
136
|
+
attribute? :player, Player
|
137
|
+
attribute? :torrents, Torrents
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Anilibria
|
2
|
+
module Api
|
3
|
+
module Types
|
4
|
+
class YouTube < Base
|
5
|
+
attribute? :id, DryTypes::Strict::Integer
|
6
|
+
attribute? :image, DryTypes::Strict::String
|
7
|
+
attribute? :youtube_id, DryTypes::Strict::String
|
8
|
+
attribute? :comments, DryTypes::Strict::Integer
|
9
|
+
attribute? :views, DryTypes::Strict::Integer
|
10
|
+
attribute? :timestamp, DryTypes::Timestamp
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'anilibria/api/types/dry_types'
|
2
|
+
require 'anilibria/api/types/base'
|
3
|
+
require 'anilibria/api/types/team'
|
4
|
+
require 'anilibria/api/types/title'
|
5
|
+
require 'anilibria/api/types/youtube'
|
6
|
+
require 'anilibria/api/types/feed'
|
7
|
+
require 'anilibria/api/types/schedule'
|
8
|
+
require 'anilibria/api/types/seed_stats'
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: anilibria-api-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roman Kozachenko
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-02-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dry-struct
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- psychosocial88@tutanota.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".rspec"
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- LICENSE
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/console
|
55
|
+
- bin/setup
|
56
|
+
- lib/anilibria/api.rb
|
57
|
+
- lib/anilibria/api/client.rb
|
58
|
+
- lib/anilibria/api/client/_methods.rb
|
59
|
+
- lib/anilibria/api/exceptions.rb
|
60
|
+
- lib/anilibria/api/exceptions/api_error.rb
|
61
|
+
- lib/anilibria/api/exceptions/auth_error.rb
|
62
|
+
- lib/anilibria/api/exceptions/base.rb
|
63
|
+
- lib/anilibria/api/exceptions/response_error.rb
|
64
|
+
- lib/anilibria/api/types.rb
|
65
|
+
- lib/anilibria/api/types/base.rb
|
66
|
+
- lib/anilibria/api/types/dry_types.rb
|
67
|
+
- lib/anilibria/api/types/feed.rb
|
68
|
+
- lib/anilibria/api/types/schedule.rb
|
69
|
+
- lib/anilibria/api/types/seed_stats.rb
|
70
|
+
- lib/anilibria/api/types/team.rb
|
71
|
+
- lib/anilibria/api/types/title.rb
|
72
|
+
- lib/anilibria/api/types/youtube.rb
|
73
|
+
- lib/anilibria/api/version.rb
|
74
|
+
homepage: https://github.com/psychosocial88/anilibria-api-ruby
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata:
|
78
|
+
homepage_uri: https://github.com/psychosocial88/anilibria-api-ruby
|
79
|
+
source_code_uri: https://github.com/psychosocial88/anilibria-api-ruby
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 3.0.0
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubygems_version: 3.3.3
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Client for AniLibria API
|
99
|
+
test_files: []
|