tvrage_api 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.travis.yml +2 -1
- data/CHANGELOG.md +32 -0
- data/README.md +66 -82
- data/lib/tvrage_api.rb +11 -1
- data/lib/tvrage_api/attributes_mapping/recap/show.rb +5 -0
- data/lib/tvrage_api/attributes_mapping/search/by_name.rb +5 -0
- data/lib/tvrage_api/attributes_mapping/show/episode.rb +6 -0
- data/lib/tvrage_api/attributes_mapping/show/find.rb +5 -0
- data/lib/tvrage_api/info.rb +50 -10
- data/lib/tvrage_api/recap.rb +59 -13
- data/lib/tvrage_api/schedule.rb +74 -14
- data/lib/tvrage_api/search.rb +60 -14
- data/lib/tvrage_api/show.rb +116 -31
- data/lib/tvrage_api/update.rb +36 -10
- data/lib/tvrage_api/version.rb +1 -1
- data/spec/functionals/info_spec.rb +26 -6
- data/spec/functionals/recap_spec.rb +55 -15
- data/spec/functionals/schedule_spec.rb +53 -12
- data/spec/functionals/search_spec.rb +52 -12
- data/spec/functionals/show_spec.rb +104 -24
- data/spec/functionals/update_spec.rb +27 -6
- data/spec/integrations/info_spec.rb +6 -1
- data/spec/integrations/recap_spec.rb +18 -3
- data/spec/integrations/schedule_spec.rb +12 -2
- data/spec/integrations/search_spec.rb +12 -2
- data/spec/integrations/show_spec.rb +30 -5
- data/spec/integrations/update_spec.rb +7 -2
- data/spec/spec_helper.rb +1 -3
- data/tvrage_api.gemspec +5 -2
- metadata +55 -7
data/lib/tvrage_api/schedule.rb
CHANGED
@@ -1,43 +1,103 @@
|
|
1
1
|
class TvrageApi::Schedule < TvrageApi::Base
|
2
|
+
include Ov
|
3
|
+
|
4
|
+
# Quick access to TV schedule
|
5
|
+
#
|
6
|
+
# access: FREE
|
7
|
+
# param:
|
8
|
+
# quick
|
9
|
+
# output: Faraday::Response instance with string
|
10
|
+
let :quick do
|
11
|
+
quick({})
|
12
|
+
end
|
13
|
+
|
2
14
|
# Quick access to TV schedule
|
3
15
|
#
|
4
16
|
# access: FREE
|
5
|
-
# param:
|
6
|
-
#
|
17
|
+
# param:
|
18
|
+
# quick('US')
|
7
19
|
# output: Faraday::Response instance with string
|
8
|
-
|
20
|
+
let :quick, String do |country|
|
21
|
+
quick(country: country)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Quick access to TV schedule
|
25
|
+
#
|
26
|
+
# access: FREE
|
27
|
+
# param:
|
28
|
+
# quick(country: 'US')
|
29
|
+
# output: Faraday::Response instance with string
|
30
|
+
let :quick, Hash do |options|
|
9
31
|
quick_path_with_params(options).get
|
10
32
|
end
|
11
33
|
|
12
34
|
# Quick access to TV schedule - return only url
|
13
35
|
#
|
14
36
|
# access: FREE
|
15
|
-
# param:
|
16
|
-
#
|
37
|
+
# param:
|
38
|
+
# quick_url
|
39
|
+
# output: url string
|
40
|
+
let :quick_url do
|
41
|
+
quick_url({})
|
42
|
+
end
|
43
|
+
|
44
|
+
# Quick access to TV schedule - return only url
|
45
|
+
#
|
46
|
+
# access: FREE
|
47
|
+
# param:
|
48
|
+
# quick_url('US')
|
17
49
|
# output: url string
|
18
|
-
|
50
|
+
let :quick_url, String do |country|
|
51
|
+
quick_url(country: country)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Quick access to TV schedule - return only url
|
55
|
+
#
|
56
|
+
# access: FREE
|
57
|
+
# param:
|
58
|
+
# quick_url(country: 'US')
|
59
|
+
# output: url string
|
60
|
+
let :quick_url, Hash do |options|
|
19
61
|
quick_path_with_params(options).url
|
20
62
|
end
|
21
63
|
|
22
64
|
# Full Schedule
|
23
65
|
#
|
24
66
|
# access: FREE
|
25
|
-
# param:
|
26
|
-
#
|
27
|
-
#
|
67
|
+
# param:
|
68
|
+
# full
|
69
|
+
# output: Faraday::Response instance with parsed XML string
|
70
|
+
let :full do
|
71
|
+
full({})
|
72
|
+
end
|
73
|
+
|
74
|
+
# Full Schedule
|
75
|
+
#
|
76
|
+
# access: FREE
|
77
|
+
# param:
|
78
|
+
# full(country: 'US', 24_format: 1)
|
28
79
|
# output: Faraday::Response instance with parsed XML string
|
29
|
-
|
80
|
+
let :full, Hash do |options|
|
30
81
|
full_path_with_params(options).get
|
31
82
|
end
|
32
83
|
|
33
84
|
# Full Schedule - return only url
|
34
85
|
#
|
35
86
|
# access: FREE
|
36
|
-
# param:
|
37
|
-
#
|
38
|
-
#
|
87
|
+
# param:
|
88
|
+
# full_url
|
89
|
+
# output: url string
|
90
|
+
let :full_url do
|
91
|
+
full_url({})
|
92
|
+
end
|
93
|
+
|
94
|
+
# Full Schedule - return only url
|
95
|
+
#
|
96
|
+
# access: FREE
|
97
|
+
# param:
|
98
|
+
# full_url(country: 'US', 24_format: 1)
|
39
99
|
# output: url string
|
40
|
-
|
100
|
+
let :full_url, Hash do |options|
|
41
101
|
full_path_with_params(options).url
|
42
102
|
end
|
43
103
|
|
data/lib/tvrage_api/search.rb
CHANGED
@@ -1,48 +1,94 @@
|
|
1
1
|
class TvrageApi::Search < TvrageApi::Base
|
2
|
+
include Ov
|
3
|
+
|
4
|
+
# Search tv show by name
|
5
|
+
#
|
6
|
+
# access: FREE
|
7
|
+
# param:
|
8
|
+
# by_name('buffy')
|
9
|
+
# output: Faraday::Response instance with string
|
10
|
+
let :by_name, String do |name|
|
11
|
+
by_name(name: name)
|
12
|
+
end
|
13
|
+
|
2
14
|
# Search tv show by name
|
3
15
|
#
|
4
16
|
# access: FREE
|
5
|
-
# param:
|
6
|
-
#
|
17
|
+
# param:
|
18
|
+
# by_name(name: 'buffy')
|
7
19
|
# output: Faraday::Response instance with string
|
8
|
-
|
20
|
+
let :by_name, Hash do |options|
|
9
21
|
by_name_path_with_params(options).get
|
10
22
|
end
|
11
23
|
|
12
24
|
# Search tv show by name - return only url
|
13
25
|
#
|
14
26
|
# access: FREE
|
15
|
-
# param:
|
16
|
-
#
|
27
|
+
# param:
|
28
|
+
# by_name_url('buffy')
|
17
29
|
# output: url string
|
18
|
-
|
30
|
+
let :by_name_url, String do |name|
|
31
|
+
by_name_url(name: name)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Search tv show by name - return only url
|
35
|
+
#
|
36
|
+
# access: FREE
|
37
|
+
# param:
|
38
|
+
# by_name_url(name: 'buffy')
|
39
|
+
# output: url string
|
40
|
+
let :by_name_url, Hash do |options|
|
19
41
|
by_name_path_with_params(options).url
|
20
42
|
end
|
21
43
|
|
22
44
|
# Detailed Search tv show by name
|
23
45
|
#
|
24
46
|
# access: FREE
|
25
|
-
# param:
|
26
|
-
#
|
47
|
+
# param:
|
48
|
+
# full_by_name('buffy')
|
27
49
|
# output: Faraday::Response instance with string
|
28
|
-
|
50
|
+
let :full_by_name, String do |name|
|
51
|
+
full_by_name(name: name)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Detailed Search tv show by name
|
55
|
+
#
|
56
|
+
# access: FREE
|
57
|
+
# param (hash params):
|
58
|
+
# full_by_name(name: 'buffy')
|
59
|
+
# output: Faraday::Response instance with string
|
60
|
+
let :full_by_name, Hash do |options|
|
29
61
|
full_by_name_path_with_params(options).get
|
30
62
|
end
|
31
63
|
|
32
64
|
# Detailed Search tv show by name - return only url
|
33
65
|
#
|
34
66
|
# access: FREE
|
35
|
-
# param:
|
36
|
-
#
|
67
|
+
# param:
|
68
|
+
# full_by_name_url('buffy')
|
37
69
|
# output: url string
|
38
|
-
|
70
|
+
let :full_by_name_url, String do |name|
|
71
|
+
full_by_name_url(name: name)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Detailed Search tv show by name - return only url
|
75
|
+
#
|
76
|
+
# access: FREE
|
77
|
+
# param:
|
78
|
+
# full_by_name_url(name: 'buffy')
|
79
|
+
# output: url string
|
80
|
+
let :full_by_name_url, Hash do |options|
|
39
81
|
full_by_name_path_with_params(options).url
|
40
82
|
end
|
41
83
|
|
42
84
|
private
|
43
85
|
|
86
|
+
def mapped_options(options)
|
87
|
+
TvrageApi::AttributesMapping::Search::ByName.new(options).to_hash
|
88
|
+
end
|
89
|
+
|
44
90
|
def by_name_path_with_params(options)
|
45
|
-
path(by_name_path).params(options)
|
91
|
+
path(by_name_path).params(mapped_options(options))
|
46
92
|
end
|
47
93
|
|
48
94
|
def by_name_path
|
@@ -50,7 +96,7 @@ class TvrageApi::Search < TvrageApi::Base
|
|
50
96
|
end
|
51
97
|
|
52
98
|
def full_by_name_path_with_params(options)
|
53
|
-
path(full_by_name_path).params(options)
|
99
|
+
path(full_by_name_path).params(mapped_options(options))
|
54
100
|
end
|
55
101
|
|
56
102
|
def full_by_name_path
|
data/lib/tvrage_api/show.rb
CHANGED
@@ -1,85 +1,163 @@
|
|
1
1
|
class TvrageApi::Show < TvrageApi::Base
|
2
|
+
include Ov
|
3
|
+
|
4
|
+
# Show Info
|
5
|
+
#
|
6
|
+
# access: FREE
|
7
|
+
# param:
|
8
|
+
# find(123)
|
9
|
+
# output: Faraday::Response instance with string
|
10
|
+
let :find, Any do |id|
|
11
|
+
find(id: id)
|
12
|
+
end
|
13
|
+
|
2
14
|
# Show Info
|
3
15
|
#
|
4
16
|
# access: FREE
|
5
|
-
# param:
|
6
|
-
#
|
17
|
+
# param:
|
18
|
+
# find(id: 123)
|
7
19
|
# output: Faraday::Response instance with string
|
8
|
-
|
20
|
+
let :find, Hash do |options|
|
9
21
|
find_path_with_params(options).get
|
10
22
|
end
|
11
23
|
|
12
24
|
# Show Info - return only url
|
13
25
|
#
|
14
26
|
# access: FREE
|
15
|
-
# param:
|
16
|
-
#
|
27
|
+
# param:
|
28
|
+
# find_url(123)
|
29
|
+
# output: url string
|
30
|
+
let :find_url, Any do |id|
|
31
|
+
find_url(id: id)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Show Info - return only url
|
35
|
+
#
|
36
|
+
# access: FREE
|
37
|
+
# param:
|
38
|
+
# find_url(id: 123)
|
17
39
|
# output: url string
|
18
|
-
|
40
|
+
let :find_url, Hash do |options|
|
19
41
|
find_path_with_params(options).url
|
20
42
|
end
|
21
43
|
|
22
44
|
# Show Info + Episode List
|
23
45
|
#
|
24
46
|
# access: FREE
|
25
|
-
# param:
|
26
|
-
#
|
47
|
+
# param:
|
48
|
+
# find_full(123)
|
27
49
|
# output: Faraday::Response instance with string
|
28
|
-
|
50
|
+
let :find_full, Any do |id|
|
51
|
+
find_full(id: id)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Show Info + Episode List
|
55
|
+
#
|
56
|
+
# access: FREE
|
57
|
+
# param:
|
58
|
+
# find_full(id: 123)
|
59
|
+
# output: Faraday::Response instance with string
|
60
|
+
let :find_full, Hash do |options|
|
29
61
|
find_full_path_with_params(options).get
|
30
62
|
end
|
31
63
|
|
32
64
|
# Show Info + Episode List - return only url
|
33
65
|
#
|
34
66
|
# access: FREE
|
35
|
-
# param:
|
36
|
-
#
|
67
|
+
# param:
|
68
|
+
# find_full_url(123)
|
37
69
|
# output: url string
|
38
|
-
|
70
|
+
let :find_full_url, Any do |id|
|
71
|
+
find_full_url(id: id)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Show Info + Episode List - return only url
|
75
|
+
#
|
76
|
+
# access: FREE
|
77
|
+
# param:
|
78
|
+
# find_full_url(id: 123)
|
79
|
+
# output: url string
|
80
|
+
let :find_full_url, Hash do |options|
|
39
81
|
find_full_path_with_params(options).url
|
40
82
|
end
|
41
83
|
|
42
84
|
# Episode List
|
43
85
|
#
|
44
86
|
# access: FREE
|
45
|
-
# param:
|
46
|
-
#
|
87
|
+
# param:
|
88
|
+
# episodes(123)
|
89
|
+
# output: Faraday::Response instance with string
|
90
|
+
let :episodes, Any do |id|
|
91
|
+
episodes(id: id)
|
92
|
+
end
|
93
|
+
|
94
|
+
# Episode List
|
95
|
+
#
|
96
|
+
# access: FREE
|
97
|
+
# param:
|
98
|
+
# episodes(id: 123)
|
47
99
|
# output: Faraday::Response instance with string
|
48
|
-
|
100
|
+
let :episodes, Hash do |options|
|
49
101
|
episodes_path_with_params(options).get
|
50
102
|
end
|
51
103
|
|
104
|
+
# Episode List
|
105
|
+
#
|
106
|
+
# access: FREE
|
107
|
+
# param:
|
108
|
+
# episodes_url(123)
|
109
|
+
# output: url string
|
110
|
+
let :episodes_url, Any do |id|
|
111
|
+
episodes_url(id: id)
|
112
|
+
end
|
52
113
|
|
53
114
|
# Episode List
|
54
115
|
#
|
55
116
|
# access: FREE
|
56
|
-
# param:
|
57
|
-
#
|
117
|
+
# param:
|
118
|
+
# episodes_url(id: 123)
|
58
119
|
# output: url string
|
59
|
-
|
120
|
+
let :episodes_url, Hash do |options|
|
60
121
|
episodes_path_with_params(options).url
|
61
122
|
end
|
62
123
|
|
63
124
|
# Episode Info
|
64
125
|
#
|
65
126
|
# access: FREE
|
66
|
-
# param:
|
67
|
-
#
|
68
|
-
#
|
127
|
+
# param:
|
128
|
+
# episode(123, '1x01')
|
129
|
+
# output: Faraday::Response instance with string
|
130
|
+
let :episode, Any, String do |show_id, episode|
|
131
|
+
episode(show_id: show_id, episode: episode)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Episode Info
|
135
|
+
#
|
136
|
+
# access: FREE
|
137
|
+
# param:
|
138
|
+
# episode(show_id: 123, episode: '1x01')
|
69
139
|
# output: Faraday::Response instance with string
|
70
|
-
|
140
|
+
let :episode, Hash do |options|
|
71
141
|
episode_path_with_params(options).get
|
72
142
|
end
|
73
143
|
|
144
|
+
# Episode Info - return only url
|
145
|
+
#
|
146
|
+
# access: FREE
|
147
|
+
# param:
|
148
|
+
# episode_url(123, '1x01')
|
149
|
+
# output: url string
|
150
|
+
let :episode_url, Any, String do |show_id, episode|
|
151
|
+
episode_url(show_id: show_id, episode: episode)
|
152
|
+
end
|
74
153
|
|
75
154
|
# Episode Info - return only url
|
76
155
|
#
|
77
156
|
# access: FREE
|
78
|
-
# param:
|
79
|
-
#
|
80
|
-
# ep: episode name, format [Season Number]x[Episode Number, with zero at the beginning for 1-9]
|
157
|
+
# param:
|
158
|
+
# episode_url(show_id: 123, episode: '1x01')
|
81
159
|
# output: url string
|
82
|
-
|
160
|
+
let :episode_url, Hash do |options|
|
83
161
|
episode_path_with_params(options).url
|
84
162
|
end
|
85
163
|
|
@@ -91,7 +169,6 @@ class TvrageApi::Show < TvrageApi::Base
|
|
91
169
|
path(all_path).get
|
92
170
|
end
|
93
171
|
|
94
|
-
|
95
172
|
# Full Show List - return only url
|
96
173
|
#
|
97
174
|
# access: FREE
|
@@ -102,8 +179,12 @@ class TvrageApi::Show < TvrageApi::Base
|
|
102
179
|
|
103
180
|
private
|
104
181
|
|
182
|
+
def find_mapped_options(options)
|
183
|
+
TvrageApi::AttributesMapping::Show::Find.new(options).to_hash
|
184
|
+
end
|
185
|
+
|
105
186
|
def find_path_with_params(options)
|
106
|
-
path(find_path).params(options)
|
187
|
+
path(find_path).params(find_mapped_options(options))
|
107
188
|
end
|
108
189
|
|
109
190
|
def find_path
|
@@ -111,7 +192,7 @@ class TvrageApi::Show < TvrageApi::Base
|
|
111
192
|
end
|
112
193
|
|
113
194
|
def find_full_path_with_params(options)
|
114
|
-
path(find_full_path).params(options)
|
195
|
+
path(find_full_path).params(find_mapped_options(options))
|
115
196
|
end
|
116
197
|
|
117
198
|
def find_full_path
|
@@ -119,15 +200,19 @@ class TvrageApi::Show < TvrageApi::Base
|
|
119
200
|
end
|
120
201
|
|
121
202
|
def episodes_path_with_params(options)
|
122
|
-
path(episodes_path).params(options)
|
203
|
+
path(episodes_path).params(find_mapped_options(options))
|
123
204
|
end
|
124
205
|
|
125
206
|
def episodes_path
|
126
207
|
'feeds/episode_list.php'
|
127
208
|
end
|
128
209
|
|
210
|
+
def episode_mapped_options(options)
|
211
|
+
TvrageApi::AttributesMapping::Show::Episode.new(options).to_hash
|
212
|
+
end
|
213
|
+
|
129
214
|
def episode_path_with_params(options)
|
130
|
-
path(episode_path).params(options)
|
215
|
+
path(episode_path).params(episode_mapped_options(options))
|
131
216
|
end
|
132
217
|
|
133
218
|
def episode_path
|