trakt_api 0.1.1 → 0.1.2
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/README.md +2 -0
- data/lib/trakt_api/shows/seasons.rb +16 -0
- data/lib/trakt_api/version.rb +1 -1
- data/spec/fixtures/episodes.json +122 -0
- data/spec/functionals/shows/seasons_spec.rb +19 -0
- data/spec/integrations/shows/seasons_spec.rb +12 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4023ca171edec809831cd589a3c9314604bc2243
|
4
|
+
data.tar.gz: 59a0219f13d48fbc76b7311bd2d708a73c2c3fba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b96c46f713b426c485152d48fa4fcba0b1a53dd92b58b219e76cd2d143bbc1a7fc19ea844305c2dd760dde29d9823d5381cd4eb0fd0162200e117500874d382
|
7
|
+
data.tar.gz: c0b54cce7fd1261dc7e120c4a6952ff00ed2295e75da0be0c0f3ad044e8e5a7ac72a4f5443ba71c75ff9f10919ab101fc3b31721627c532086c7764c2fe26069
|
data/README.md
CHANGED
@@ -7,6 +7,14 @@ class TraktApi::Shows::Seasons < TraktApi::Base
|
|
7
7
|
all_path_with_params(options).url
|
8
8
|
end
|
9
9
|
|
10
|
+
def find(options)
|
11
|
+
find_path_with_params(options).get
|
12
|
+
end
|
13
|
+
|
14
|
+
def find_url(options)
|
15
|
+
find_path_with_params(options).url
|
16
|
+
end
|
17
|
+
|
10
18
|
def episodes
|
11
19
|
@episodes ||= TraktApi::Shows::Seasons::Episodes.new(@config)
|
12
20
|
end
|
@@ -20,4 +28,12 @@ class TraktApi::Shows::Seasons < TraktApi::Base
|
|
20
28
|
def all_path
|
21
29
|
'shows/:id/seasons'
|
22
30
|
end
|
31
|
+
|
32
|
+
def find_path_with_params(options)
|
33
|
+
path(find_path).params(options)
|
34
|
+
end
|
35
|
+
|
36
|
+
def find_path
|
37
|
+
'shows/:id/seasons/:season'
|
38
|
+
end
|
23
39
|
end
|
data/lib/trakt_api/version.rb
CHANGED
@@ -0,0 +1,122 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"season": 1,
|
4
|
+
"number": 1,
|
5
|
+
"title": "Winter Is Coming",
|
6
|
+
"ids": {
|
7
|
+
"trakt": 456,
|
8
|
+
"tvdb": 3254641,
|
9
|
+
"imdb": "tt1480055",
|
10
|
+
"tmdb": 63056,
|
11
|
+
"tvrage": null
|
12
|
+
}
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"season": 1,
|
16
|
+
"number": 2,
|
17
|
+
"title": "The Kingsroad",
|
18
|
+
"ids": {
|
19
|
+
"trakt": 457,
|
20
|
+
"tvdb": 3436411,
|
21
|
+
"imdb": "tt1668746",
|
22
|
+
"tmdb": 63057,
|
23
|
+
"tvrage": null
|
24
|
+
}
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"season": 1,
|
28
|
+
"number": 3,
|
29
|
+
"title": "Lord Snow",
|
30
|
+
"ids": {
|
31
|
+
"trakt": 458,
|
32
|
+
"tvdb": 3436421,
|
33
|
+
"imdb": "tt1829962",
|
34
|
+
"tmdb": 63058,
|
35
|
+
"tvrage": null
|
36
|
+
}
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"season": 1,
|
40
|
+
"number": 4,
|
41
|
+
"title": "Cripples, Bastards, and Broken Things",
|
42
|
+
"ids": {
|
43
|
+
"trakt": 459,
|
44
|
+
"tvdb": 3436431,
|
45
|
+
"imdb": "tt1829963",
|
46
|
+
"tmdb": 63059,
|
47
|
+
"tvrage": null
|
48
|
+
}
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"season": 1,
|
52
|
+
"number": 5,
|
53
|
+
"title": "The Wolf and the Lion",
|
54
|
+
"ids": {
|
55
|
+
"trakt": 460,
|
56
|
+
"tvdb": 3436441,
|
57
|
+
"imdb": "tt1829964",
|
58
|
+
"tmdb": 63060,
|
59
|
+
"tvrage": null
|
60
|
+
}
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"season": 1,
|
64
|
+
"number": 6,
|
65
|
+
"title": "A Golden Crown",
|
66
|
+
"ids": {
|
67
|
+
"trakt": 461,
|
68
|
+
"tvdb": 3436451,
|
69
|
+
"imdb": "tt1837862",
|
70
|
+
"tmdb": 63061,
|
71
|
+
"tvrage": null
|
72
|
+
}
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"season": 1,
|
76
|
+
"number": 7,
|
77
|
+
"title": "You Win or You Die",
|
78
|
+
"ids": {
|
79
|
+
"trakt": 462,
|
80
|
+
"tvdb": 3436461,
|
81
|
+
"imdb": "tt1837863",
|
82
|
+
"tmdb": 63062,
|
83
|
+
"tvrage": null
|
84
|
+
}
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"season": 1,
|
88
|
+
"number": 8,
|
89
|
+
"title": "The Pointy End",
|
90
|
+
"ids": {
|
91
|
+
"trakt": 463,
|
92
|
+
"tvdb": 3360391,
|
93
|
+
"imdb": "tt1837864",
|
94
|
+
"tmdb": 63063,
|
95
|
+
"tvrage": null
|
96
|
+
}
|
97
|
+
},
|
98
|
+
{
|
99
|
+
"season": 1,
|
100
|
+
"number": 9,
|
101
|
+
"title": "Baelor",
|
102
|
+
"ids": {
|
103
|
+
"trakt": 464,
|
104
|
+
"tvdb": 4063481,
|
105
|
+
"imdb": "tt1851398",
|
106
|
+
"tmdb": 63064,
|
107
|
+
"tvrage": null
|
108
|
+
}
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"season": 1,
|
112
|
+
"number": 10,
|
113
|
+
"title": "Fire and Blood",
|
114
|
+
"ids": {
|
115
|
+
"trakt": 465,
|
116
|
+
"tvdb": 4063491,
|
117
|
+
"imdb": "tt1851397",
|
118
|
+
"tmdb": 63065,
|
119
|
+
"tvrage": null
|
120
|
+
}
|
121
|
+
}
|
122
|
+
]
|
@@ -9,6 +9,9 @@ describe TraktApi::Shows::Seasons do
|
|
9
9
|
stub.get('/shows/123/seasons') do
|
10
10
|
[200, { content_type: 'json' }, File.read('spec/fixtures/seasons.json')]
|
11
11
|
end
|
12
|
+
stub.get('/shows/123/seasons/1') do
|
13
|
+
[200, { content_type: 'json' }, File.read('spec/fixtures/episodes.json')]
|
14
|
+
end
|
12
15
|
end
|
13
16
|
end
|
14
17
|
|
@@ -28,6 +31,22 @@ describe TraktApi::Shows::Seasons do
|
|
28
31
|
end
|
29
32
|
end
|
30
33
|
|
34
|
+
describe '.find' do
|
35
|
+
it 'should return Faraday::Response class' do
|
36
|
+
expect(model.find(id: '123', season: 1)).to be_a(Faraday::Response)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should return Array class for body reponse' do
|
40
|
+
expect(model.find(id: '123', season: 1).body).to be_a(Array)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '.all_url' do
|
45
|
+
it 'should return String class' do
|
46
|
+
expect(model.find_url(id: '123', season: 1)).to eq('https://api.trakt.tv/shows/123/seasons/1')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
31
50
|
describe '.seasons' do
|
32
51
|
it 'should return TraktApi::Shows::Seasons::Episodes class' do
|
33
52
|
expect(model.episodes).to be_a(TraktApi::Shows::Seasons::Episodes)
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe TraktApi::Shows::Seasons do
|
4
4
|
let(:model) { TraktApi::Shows::Seasons.new(api_key: API_KEY) }
|
5
5
|
|
6
|
-
describe '.
|
6
|
+
describe '.all' do
|
7
7
|
it 'should return response class' do
|
8
8
|
response = model.all(id: 'game-of-thrones')
|
9
9
|
ap response.body
|
@@ -13,4 +13,15 @@ describe TraktApi::Shows::Seasons do
|
|
13
13
|
expect(response.body).to be_a(Array)
|
14
14
|
end
|
15
15
|
end
|
16
|
+
|
17
|
+
describe '.find' do
|
18
|
+
it 'should return response class' do
|
19
|
+
response = model.find(id: 'game-of-thrones', season: 1)
|
20
|
+
ap response.body
|
21
|
+
|
22
|
+
expect(response).to be_a(Faraday::Response)
|
23
|
+
expect(response.status).to eq(200)
|
24
|
+
expect(response.body).to be_a(Array)
|
25
|
+
end
|
26
|
+
end
|
16
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trakt_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Wawer
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/trakt_api/shows/seasons/episodes.rb
|
117
117
|
- lib/trakt_api/version.rb
|
118
118
|
- spec/fixtures/episode.json
|
119
|
+
- spec/fixtures/episodes.json
|
119
120
|
- spec/fixtures/search.json
|
120
121
|
- spec/fixtures/seasons.json
|
121
122
|
- spec/fixtures/show.json
|
@@ -156,6 +157,7 @@ specification_version: 4
|
|
156
157
|
summary: Ruby client for trakt.tv API
|
157
158
|
test_files:
|
158
159
|
- spec/fixtures/episode.json
|
160
|
+
- spec/fixtures/episodes.json
|
159
161
|
- spec/fixtures/search.json
|
160
162
|
- spec/fixtures/seasons.json
|
161
163
|
- spec/fixtures/show.json
|