anilibria-api-ruby 1.0.0 → 1.0.1
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/Gemfile +0 -1
- data/Gemfile.lock +1 -1
- data/README.md +12 -8
- data/lib/anilibria/api/client.rb +2 -0
- data/lib/anilibria/api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e8f99d41325b4d8e4d22877388d0cdeb216acc3ee3f4ad57cd7c3076973d9e9
|
|
4
|
+
data.tar.gz: 2050b7e07d8dca2303ac52bc5097ff35ce39bb581f74533253c2caa46d7c64c6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 51ef2354baa68cba34551fff411ad549f3650423b961f89357d811f646bfa0885b178b98f394cfeff6cf463e03a2dc5af70e7756e62a87bcad02435949b6129f
|
|
7
|
+
data.tar.gz: ad841e35f03244b4f266288fa316ba4d43100003bdc9867d303e4dbde36ffec0a87c85f6efc441ccadaf0c42dd188f6af4593cf84f0492e79e1cb73865fcf248
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -24,6 +24,8 @@ $ gem install anilibria-api-ruby
|
|
|
24
24
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
|
27
|
+
### Client
|
|
28
|
+
|
|
27
29
|
Usage example:
|
|
28
30
|
|
|
29
31
|
```ruby
|
|
@@ -33,29 +35,31 @@ anilibria = Anilibria::Api::Client.new
|
|
|
33
35
|
|
|
34
36
|
anilibria.get_years # => [1996, 1998, 2001, 2003, 2004, 2005, 2006, ...]
|
|
35
37
|
|
|
36
|
-
title = anilibria.get_title(code: 'steinsgate') # => #<Anilibria::Api::Types::Title id=8674
|
|
38
|
+
title = anilibria.get_title(code: 'steinsgate') # => #<Anilibria::Api::Types::Title id=8674 ...
|
|
37
39
|
title.names.en # => "Steins;Gate"
|
|
38
40
|
```
|
|
39
41
|
|
|
40
42
|
`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
43
|
|
|
42
|
-
|
|
44
|
+
### Authorization
|
|
43
45
|
|
|
44
|
-
The
|
|
46
|
+
The gem supports authorization:
|
|
45
47
|
|
|
46
48
|
```ruby
|
|
47
|
-
# session = anilibria.auth('
|
|
48
|
-
|
|
49
|
-
session = anilibria.auth('
|
|
49
|
+
# session = anilibria.auth('wrong@example.com', 'WrongPassword') # => nil
|
|
50
|
+
|
|
51
|
+
# session = anilibria.auth!('wrong@example.com', 'WrongPassword')
|
|
52
|
+
# (raises an error Anilibria::Api::Exceptions::AuthError)
|
|
53
|
+
|
|
54
|
+
session = anilibria.auth('correct@example.com', 'CorrectPassword') # returns the session string
|
|
50
55
|
|
|
51
56
|
anilibria.add_favorite(title_id: 9114, session: session) # => true
|
|
52
57
|
|
|
53
58
|
titles = anilibria.get_favorites(filter: 'id,code,names,description', session: session)
|
|
54
59
|
# => [#<Anilibria::Api::Types::Title id=9114 code="shingeki-no-k...
|
|
55
|
-
|
|
56
60
|
```
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
### API Version
|
|
59
63
|
|
|
60
64
|
You can get the currently used version of [AniLibria API](https://github.com/anilibria/docs/blob/master/api_v2.md):
|
|
61
65
|
|
data/lib/anilibria/api/client.rb
CHANGED