thetvdb_api 0.2.3.1 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +30 -51
- data/lib/thetvdb_api/actor.rb +9 -9
- data/lib/thetvdb_api/banner.rb +9 -9
- data/lib/thetvdb_api/base.rb +10 -56
- data/lib/thetvdb_api/client.rb +6 -4
- data/lib/thetvdb_api/episode.rb +33 -34
- data/lib/thetvdb_api/search.rb +23 -35
- data/lib/thetvdb_api/series.rb +17 -17
- data/lib/thetvdb_api/update.rb +32 -32
- data/lib/thetvdb_api/version.rb +1 -1
- data/lib/thetvdb_api.rb +0 -12
- data/spec/fixtures/get_episode.xml +30 -0
- data/spec/fixtures/get_series.xml +24 -0
- data/spec/fixtures/get_series_by_remote.xml +14 -0
- data/spec/fixtures/updates.xml +35 -0
- data/spec/functionals/actor_spec.rb +30 -0
- data/spec/functionals/banner_spec.rb +30 -0
- data/spec/functionals/episode_spec.rb +85 -0
- data/spec/functionals/search_spec.rb +71 -0
- data/spec/functionals/series_spec.rb +48 -0
- data/spec/functionals/update_spec.rb +81 -0
- data/thetvdb_api.gemspec +2 -2
- metadata +34 -82
- data/lib/generators/templates/thetvdb_api.rb +0 -3
- data/lib/generators/thetvdb_api/install_generator.rb +0 -12
- data/lib/thetvdb_api/configuration.rb +0 -10
- data/lib/thetvdb_api/response/actors.rb +0 -7
- data/lib/thetvdb_api/response/banners.rb +0 -7
- data/lib/thetvdb_api/response/collection.rb +0 -9
- data/lib/thetvdb_api/response/episode.rb +0 -5
- data/lib/thetvdb_api/response/full_series.rb +0 -21
- data/lib/thetvdb_api/response/search_multiple_episode.rb +0 -7
- data/lib/thetvdb_api/response/search_multiple_series.rb +0 -7
- data/lib/thetvdb_api/response/search_series.rb +0 -5
- data/lib/thetvdb_api/response/series.rb +0 -5
- data/lib/thetvdb_api/response/update.rb +0 -31
- data/lib/thetvdb_api/response.rb +0 -52
- data/spec/functionals/classes/actor_spec.rb +0 -41
- data/spec/functionals/classes/banner_spec.rb +0 -42
- data/spec/functionals/classes/episode_spec.rb +0 -93
- data/spec/functionals/classes/series_spec.rb +0 -91
- data/spec/functionals/functional_spec_helper.rb +0 -7
- data/spec/functionals/support/stub_faraday.rb +0 -5
- data/spec/integrations/support/.keep +0 -0
- data/spec/units/classes/actor_spec.rb +0 -49
- data/spec/units/classes/banner_spec.rb +0 -49
- data/spec/units/classes/base_spec.rb +0 -123
- data/spec/units/classes/client_spec.rb +0 -41
- data/spec/units/classes/episode_spec.rb +0 -167
- data/spec/units/classes/response/actors_spec.rb +0 -15
- data/spec/units/classes/response/banners_spec.rb +0 -15
- data/spec/units/classes/response/collection_spec.rb +0 -38
- data/spec/units/classes/response/episode_spec.rb +0 -15
- data/spec/units/classes/response/full_series_spec.rb +0 -51
- data/spec/units/classes/response/search_multiple_episode_spec.rb +0 -15
- data/spec/units/classes/response/search_multiple_series_spec.rb +0 -15
- data/spec/units/classes/response/search_series_spec.rb +0 -15
- data/spec/units/classes/response/series_spec.rb +0 -15
- data/spec/units/classes/response/update_spec.rb +0 -79
- data/spec/units/classes/response_spec.rb +0 -100
- data/spec/units/classes/search_spec.rb +0 -178
- data/spec/units/classes/series_spec.rb +0 -92
- data/spec/units/classes/update_spec.rb +0 -178
- data/spec/units/unit_spec_helper.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5501937cffeedf47be473a7d5c2bc4c3635236b1
|
4
|
+
data.tar.gz: 7f59cde79cdacb935f59c2351b85a96c2c8876a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0aff5f795d6e47a7097b61d720b8538408f442165c507165bb410de50848367fb92e842a0ec971291458801ae4eb8a165f7b13602598567f157436331cf65d2
|
7
|
+
data.tar.gz: a29e4a139f4707d9cbf5b8cee2466a911a85fb5010239926ab9ccd8f6643bb06333023f4a9289f74f71f08c7c7d4cc70880fe4195b7a07673a74a43980f8f15c
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -18,14 +18,6 @@ gem 'thetvdb_api'
|
|
18
18
|
|
19
19
|
Run the bundle command to install it.
|
20
20
|
|
21
|
-
After you install ThetvdbApi and add it to your Gemfile, you need to run the generator (if you use Ruby on Rails application):
|
22
|
-
|
23
|
-
```console
|
24
|
-
rails generate thetvdb_api:install
|
25
|
-
```
|
26
|
-
|
27
|
-
The generator will install an initializer where you must past your api_key, and can past: language (2 letters abbrevation).
|
28
|
-
|
29
21
|
## How to use
|
30
22
|
|
31
23
|
There is one entry point, in initialize you can past hash with api_key and language values, or leave empty:
|
@@ -38,80 +30,67 @@ Search series by name
|
|
38
30
|
|
39
31
|
```ruby
|
40
32
|
client = ThetvdbApi::Client.new
|
41
|
-
client.search.get_series(
|
42
|
-
client.search.get_series_url(
|
43
|
-
client.search.
|
44
|
-
client.search.
|
45
|
-
client.search.
|
46
|
-
client.search.
|
47
|
-
client.search.get_episode('123', air_date, options = {})
|
48
|
-
client.search.get_episode_url('123', air_date, options = {}) # return only full url
|
33
|
+
client.search.get_series(options = {})
|
34
|
+
client.search.get_series_url(options = {}) # return only full url
|
35
|
+
client.search.get_series_by_remote_id(options = {})
|
36
|
+
client.search.get_series_by_remote_id_url(options = {}) # return only full url
|
37
|
+
client.search.get_episode(options = {})
|
38
|
+
client.search.get_episode_url(options = {}) # return only full url
|
49
39
|
```
|
50
40
|
|
51
41
|
Search series by id
|
52
42
|
|
53
43
|
```ruby
|
54
44
|
client = ThetvdbApi::Client.new
|
55
|
-
client.series.find(
|
56
|
-
client.series.find_url(
|
57
|
-
client.series.find_full(
|
58
|
-
client.series.find_full_url(
|
45
|
+
client.series.find(options = {})
|
46
|
+
client.series.find_url(options = {}) # return only full url
|
47
|
+
client.series.find_full(options = {})
|
48
|
+
client.series.find_full_url(options = {}) # return only full url
|
59
49
|
```
|
60
50
|
|
61
51
|
Return series actors
|
62
52
|
|
63
53
|
```ruby
|
64
54
|
client = ThetvdbApi::Client.new
|
65
|
-
client.actor.all(
|
66
|
-
client.actor.all_url(
|
55
|
+
client.actor.all(options = {})
|
56
|
+
client.actor.all_url(options = {}) # return only full url
|
67
57
|
```
|
68
58
|
|
69
59
|
Return series banners
|
70
60
|
|
71
61
|
```ruby
|
72
62
|
client = ThetvdbApi::Client.new
|
73
|
-
client.banner.all(
|
74
|
-
client.banner.all_url(
|
63
|
+
client.banner.all(options = {})
|
64
|
+
client.banner.all_url(options = {}) # return only full url
|
75
65
|
```
|
76
66
|
|
77
67
|
Return series episode
|
78
68
|
|
79
69
|
```ruby
|
80
70
|
client = ThetvdbApi::Client.new
|
81
|
-
client.episode.find_by_default_order(
|
82
|
-
client.episode.find_by_default_order_url(
|
83
|
-
client.episode.find_by_dvd_order(
|
84
|
-
client.episode.find_by_dvd_order_url(
|
85
|
-
client.episode.find_by_absolute_order(
|
86
|
-
client.episode.find_by_absolute_order_url(
|
87
|
-
client.episode.find(
|
88
|
-
client.episode.find_url(
|
71
|
+
client.episode.find_by_default_order(options = {})
|
72
|
+
client.episode.find_by_default_order_url(options = {}) # return only full url
|
73
|
+
client.episode.find_by_dvd_order(options = {})
|
74
|
+
client.episode.find_by_dvd_order_url(options = {}) # return only full url
|
75
|
+
client.episode.find_by_absolute_order(options = {})
|
76
|
+
client.episode.find_by_absolute_order_url(options = {}) # return only full url
|
77
|
+
client.episode.find(options = {})
|
78
|
+
client.episode.find_url(options = {}) # return only full url
|
89
79
|
```
|
90
80
|
|
91
81
|
Get updates
|
92
82
|
|
93
83
|
```ruby
|
94
84
|
client = ThetvdbApi::Client.new
|
95
|
-
client.update.day
|
96
|
-
client.update.day_url
|
97
|
-
client.update.week
|
98
|
-
client.update.week_url
|
99
|
-
client.update.month
|
100
|
-
client.update.month_url
|
101
|
-
client.update.all
|
102
|
-
client.update.all_url
|
85
|
+
client.update.day
|
86
|
+
client.update.day_url # return only full url
|
87
|
+
client.update.week
|
88
|
+
client.update.week_url # return only full url
|
89
|
+
client.update.month
|
90
|
+
client.update.month_url # return only full url
|
91
|
+
client.update.all
|
92
|
+
client.update.all_url # return only full url
|
103
93
|
```
|
104
|
-
|
105
|
-
ThetvdbApi default return response class with pure xml (in body method) string fetched by Faraday. You can pass
|
106
|
-
|
107
|
-
```ruby
|
108
|
-
mapping: true
|
109
|
-
```
|
110
|
-
|
111
|
-
options, and ThetvdbApi will return hash/array objects.
|
112
|
-
|
113
|
-
ThetvdbApi give you chance to write own mapper where mapping preformance could be better.
|
114
|
-
|
115
94
|
## Contributing
|
116
95
|
|
117
96
|
1. Fork it
|
data/lib/thetvdb_api/actor.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
class ThetvdbApi::Actor < ThetvdbApi::Base
|
2
|
-
def find(
|
3
|
-
|
2
|
+
def find(options = {})
|
3
|
+
find_path_with_params(options).get
|
4
4
|
end
|
5
5
|
|
6
|
-
def find_url(
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
def find_get_with_params(series_id, options = {})
|
11
|
-
get(find_path).params({ series_id: series_id }.merge(options))
|
6
|
+
def find_url(options = {})
|
7
|
+
find_path_with_params(options).url
|
12
8
|
end
|
13
9
|
|
14
10
|
private
|
15
11
|
|
12
|
+
def find_path_with_params(options)
|
13
|
+
path(find_path).params(api_key_options.merge(options))
|
14
|
+
end
|
15
|
+
|
16
16
|
def find_path
|
17
|
-
|
17
|
+
':apikey/series/:series_id/actors.xml'
|
18
18
|
end
|
19
19
|
end
|
data/lib/thetvdb_api/banner.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
class ThetvdbApi::Banner < ThetvdbApi::Base
|
2
|
-
def find(
|
3
|
-
|
2
|
+
def find(options = {})
|
3
|
+
find_path_with_params(options).get
|
4
4
|
end
|
5
5
|
|
6
|
-
def find_url(
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
def find_get_with_params(series_id, options = {})
|
11
|
-
get(find_path).params({ series_id: series_id }.merge(options))
|
6
|
+
def find_url(options = {})
|
7
|
+
find_path_with_params(options).url
|
12
8
|
end
|
13
9
|
|
14
10
|
private
|
15
11
|
|
12
|
+
def find_path_with_params(options)
|
13
|
+
path(find_path).params(api_key_options.merge(options))
|
14
|
+
end
|
15
|
+
|
16
16
|
def find_path
|
17
|
-
|
17
|
+
':apikey/series/:series_id/banners.xml'
|
18
18
|
end
|
19
19
|
end
|
data/lib/thetvdb_api/base.rb
CHANGED
@@ -1,72 +1,26 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
require 'uri_template'
|
3
|
+
require 'service_api'
|
3
4
|
|
4
5
|
class ThetvdbApi::Base
|
5
|
-
|
6
|
-
@client = client
|
7
|
-
@params = {}
|
8
|
-
@mapping = false
|
9
|
-
end
|
10
|
-
|
11
|
-
def connection
|
12
|
-
@connection ||= Faraday.new(url: base_url) do |builder|
|
13
|
-
builder.adapter ThetvdbApi::Configuration.adapter
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def get(uri)
|
18
|
-
@uri_template = URITemplate.new(uri)
|
19
|
-
self
|
20
|
-
end
|
21
|
-
|
22
|
-
def params(options)
|
23
|
-
@mapping = options.delete(:mapping)
|
24
|
-
@params = { language: @client.language }.merge(options)
|
25
|
-
self
|
26
|
-
end
|
27
|
-
|
28
|
-
def response(klass = ThetvdbApi::Response)
|
29
|
-
assert_uri_template
|
30
|
-
klass.new(connection.get(uri, @params), @mapping)
|
31
|
-
end
|
32
|
-
|
33
|
-
def prepare_uri
|
34
|
-
assert_uri_template
|
35
|
-
@uri_template.expand(@params.merge(api_key: api_key))
|
36
|
-
end
|
37
|
-
|
38
|
-
def url
|
39
|
-
"#{base_url}#{uri}"
|
40
|
-
end
|
41
|
-
|
42
|
-
def uri
|
43
|
-
uri = prepare_uri
|
44
|
-
@params.reject!{ |param| restful_param_keys(uri).include?(param.to_s) }
|
45
|
-
|
46
|
-
uri
|
47
|
-
end
|
48
|
-
|
49
|
-
def restful_param_keys(uri_expanded)
|
50
|
-
@uri_template.extract(uri_expanded).keys
|
51
|
-
end
|
52
|
-
|
6
|
+
include ServiceApi::BaseFaraday
|
53
7
|
|
54
|
-
def
|
55
|
-
|
8
|
+
def api_key_options
|
9
|
+
{ apikey: @client.options[:api_key] }
|
56
10
|
end
|
57
11
|
|
58
|
-
def
|
59
|
-
@client.language
|
12
|
+
def language_options
|
13
|
+
{ language: @client.options[:language] }
|
60
14
|
end
|
61
15
|
|
62
|
-
def
|
63
|
-
|
16
|
+
def api_key_with_language_options
|
17
|
+
api_key_options.merge(language_options)
|
64
18
|
end
|
65
19
|
|
66
20
|
private
|
67
21
|
|
68
|
-
def
|
69
|
-
|
22
|
+
def uri_kind
|
23
|
+
:colon
|
70
24
|
end
|
71
25
|
|
72
26
|
def base_url
|
data/lib/thetvdb_api/client.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
class ThetvdbApi::Client
|
2
|
-
attr_reader :
|
2
|
+
attr_reader :options
|
3
3
|
|
4
4
|
def initialize(options = {})
|
5
|
-
@
|
6
|
-
|
5
|
+
@options = options
|
6
|
+
|
7
|
+
@options[:adapter] ||= :net_http
|
8
|
+
@options[:language] ||= 'en'
|
7
9
|
end
|
8
10
|
|
9
11
|
def search
|
@@ -29,4 +31,4 @@ class ThetvdbApi::Client
|
|
29
31
|
def update
|
30
32
|
@update ||= ThetvdbApi::Update.new(self)
|
31
33
|
end
|
32
|
-
end
|
34
|
+
end
|
data/lib/thetvdb_api/episode.rb
CHANGED
@@ -1,68 +1,67 @@
|
|
1
1
|
class ThetvdbApi::Episode < ThetvdbApi::Base
|
2
|
-
def find_by_default_order(
|
3
|
-
find_by_order('default'
|
2
|
+
def find_by_default_order(options = {})
|
3
|
+
find_by_order(options.merge(order: 'default'))
|
4
4
|
end
|
5
5
|
|
6
|
-
def find_by_default_order_url(
|
7
|
-
find_by_order_url('default'
|
6
|
+
def find_by_default_order_url(options = {})
|
7
|
+
find_by_order_url(options.merge(order: 'default'))
|
8
8
|
end
|
9
9
|
|
10
|
-
def find_by_dvd_order(
|
11
|
-
find_by_order('dvd'
|
10
|
+
def find_by_dvd_order(options = {})
|
11
|
+
find_by_order(options.merge(order: 'dvd'))
|
12
12
|
end
|
13
13
|
|
14
|
-
def find_by_dvd_order_url(
|
15
|
-
find_by_order_url('dvd'
|
14
|
+
def find_by_dvd_order_url(options = {})
|
15
|
+
find_by_order_url(options.merge(order: 'dvd'))
|
16
16
|
end
|
17
17
|
|
18
|
-
def find_by_absolute_order(
|
19
|
-
|
18
|
+
def find_by_absolute_order(options = {})
|
19
|
+
find_by_absolute_order_path_with_params(options).get
|
20
20
|
end
|
21
21
|
|
22
|
-
def find_by_absolute_order_url(
|
23
|
-
|
22
|
+
def find_by_absolute_order_url(options = {})
|
23
|
+
find_by_absolute_order_path_with_params(options).url
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
27
|
-
|
26
|
+
def find(options = {})
|
27
|
+
find_path_with_params(options).get
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
|
30
|
+
def find_url(options = {})
|
31
|
+
find_path_with_params(options).url
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
find_get_with_params(episode_id, options).url
|
36
|
-
end
|
34
|
+
private
|
37
35
|
|
38
|
-
def
|
39
|
-
|
36
|
+
def find_by_order(options)
|
37
|
+
find_by_order_path_with_params(options).get
|
40
38
|
end
|
41
39
|
|
42
|
-
def
|
43
|
-
|
40
|
+
def find_by_order_url(options)
|
41
|
+
find_by_order_path_with_params(options).url
|
44
42
|
end
|
45
43
|
|
46
|
-
def
|
47
|
-
|
44
|
+
def find_by_order_path_with_params(options)
|
45
|
+
path(find_by_order_path).params(api_key_with_language_options.merge(options))
|
48
46
|
end
|
49
47
|
|
50
|
-
def
|
51
|
-
|
52
|
-
params({ series_id: series_id, season: season, episode: episode, order: order }.merge(options))
|
48
|
+
def find_by_order_path
|
49
|
+
':apikey/series/:series_id/:order/:season/:episode/:language.xml'
|
53
50
|
end
|
54
51
|
|
55
|
-
|
52
|
+
def find_by_absolute_order_path_with_params(options)
|
53
|
+
path(find_by_absolute_order_path).params(api_key_with_language_options.merge(options))
|
54
|
+
end
|
56
55
|
|
57
56
|
def find_by_absolute_order_path
|
58
|
-
|
57
|
+
':apikey/series/:series_id/absolute/:absolute/:language.xml'
|
59
58
|
end
|
60
59
|
|
61
|
-
def
|
62
|
-
|
60
|
+
def find_path_with_params(options)
|
61
|
+
path(find_path).params(api_key_with_language_options.merge(options))
|
63
62
|
end
|
64
63
|
|
65
|
-
def
|
66
|
-
|
64
|
+
def find_path
|
65
|
+
':apikey/episodes/:episode_id/:language.xml'
|
67
66
|
end
|
68
67
|
end
|
data/lib/thetvdb_api/search.rb
CHANGED
@@ -1,62 +1,50 @@
|
|
1
1
|
class ThetvdbApi::Search < ThetvdbApi::Base
|
2
|
-
def get_series(
|
3
|
-
|
2
|
+
def get_series(options = {})
|
3
|
+
get_series_path_with_params(options).get
|
4
4
|
end
|
5
5
|
|
6
|
-
def get_series_url(
|
7
|
-
|
6
|
+
def get_series_url(options = {})
|
7
|
+
get_series_path_with_params(options).url
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
|
10
|
+
def get_series_by_remote_id(options = {})
|
11
|
+
get_series_by_remote_id_path_with_params(options).get
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
|
14
|
+
def get_series_by_remote_id_url(options = {})
|
15
|
+
get_series_by_remote_id_path_with_params(options).url
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
|
18
|
+
def get_episode(options = {})
|
19
|
+
get_episode_path_with_params(options).get
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
23
|
-
|
22
|
+
def get_episode_url(options = {})
|
23
|
+
get_episode_path_with_params(options).url
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
get_series_by_zap2it_id_get_with_params(id, options).response(ThetvdbApi::Response::SearchSeries)
|
28
|
-
end
|
29
|
-
|
30
|
-
def get_series_by_zap2it_id_url(id, options = {})
|
31
|
-
get_series_by_zap2it_id_get_with_params(id, options).url
|
32
|
-
end
|
33
|
-
|
34
|
-
def get_series_by_zap2it_id_get_with_params(id, options)
|
35
|
-
get(get_series_by_remote_id_path).params({ zap2it: id }.merge(options))
|
36
|
-
end
|
37
|
-
|
38
|
-
def get_episode(series_id, air_date, options = {})
|
39
|
-
get_episode_get_with_params(series_id, air_date, options).response(ThetvdbApi::Response::SearchMultipleEpisode)
|
40
|
-
end
|
41
|
-
|
42
|
-
def get_episode_url(series_id, air_date, options = {})
|
43
|
-
get_episode_get_with_params(series_id, air_date, options).url
|
44
|
-
end
|
26
|
+
private
|
45
27
|
|
46
|
-
def
|
47
|
-
|
28
|
+
def get_series_path_with_params(options)
|
29
|
+
path(get_series_path).params(language_options.merge(options))
|
48
30
|
end
|
49
31
|
|
50
|
-
private
|
51
|
-
|
52
32
|
def get_series_path
|
53
33
|
'GetSeries.php'
|
54
34
|
end
|
55
35
|
|
36
|
+
def get_series_by_remote_id_path_with_params(options)
|
37
|
+
path(get_series_by_remote_id_path).params(language_options.merge(options))
|
38
|
+
end
|
39
|
+
|
56
40
|
def get_series_by_remote_id_path
|
57
41
|
'GetSeriesByRemoteID.php'
|
58
42
|
end
|
59
43
|
|
44
|
+
def get_episode_path_with_params(options)
|
45
|
+
path(get_episode_path).params(api_key_with_language_options.merge(options))
|
46
|
+
end
|
47
|
+
|
60
48
|
def get_episode_path
|
61
49
|
'GetEpisodeByAirDate.php'
|
62
50
|
end
|
data/lib/thetvdb_api/series.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
class ThetvdbApi::Series < ThetvdbApi::Base
|
2
|
-
def find(
|
3
|
-
|
2
|
+
def find(options = {})
|
3
|
+
find_path_with_params(options).get
|
4
4
|
end
|
5
5
|
|
6
|
-
def find_url(
|
7
|
-
|
6
|
+
def find_url(options = {})
|
7
|
+
find_path_with_params(options).url
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
|
10
|
+
def find_full(options = {})
|
11
|
+
find_full_path_with_params(options).get
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
|
14
|
+
def find_full_url(options = {})
|
15
|
+
find_full_path_with_params(options).url
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
find_full_get_with_params(series_id, options).url
|
20
|
-
end
|
18
|
+
private
|
21
19
|
|
22
|
-
def
|
23
|
-
|
20
|
+
def find_path_with_params(options)
|
21
|
+
path(find_path).params(api_key_with_language_options.merge(options))
|
24
22
|
end
|
25
23
|
|
26
|
-
private
|
27
|
-
|
28
24
|
def find_path
|
29
|
-
|
25
|
+
':apikey/series/:series_id/:language.xml'
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_full_path_with_params(options)
|
29
|
+
path(find_full_path).params(api_key_with_language_options.merge(options))
|
30
30
|
end
|
31
31
|
|
32
32
|
def find_full_path
|
33
|
-
|
33
|
+
':apikey/series/:series_id/all/:language.xml'
|
34
34
|
end
|
35
35
|
end
|
data/lib/thetvdb_api/update.rb
CHANGED
@@ -1,67 +1,67 @@
|
|
1
1
|
class ThetvdbApi::Update < ThetvdbApi::Base
|
2
|
-
def day
|
3
|
-
|
2
|
+
def day
|
3
|
+
day_path_with_params.get
|
4
4
|
end
|
5
5
|
|
6
6
|
def day_url
|
7
|
-
|
7
|
+
day_path_with_params.url
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
get
|
12
|
-
end
|
13
|
-
|
14
|
-
def week(options = {})
|
15
|
-
week_get_with_params(options).response(ThetvdbApi::Response::Update)
|
10
|
+
def week
|
11
|
+
week_path_with_params.get
|
16
12
|
end
|
17
13
|
|
18
14
|
def week_url
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
def week_get_with_params(options = {})
|
23
|
-
get(week_path).params(options)
|
15
|
+
week_path_with_params.url
|
24
16
|
end
|
25
17
|
|
26
|
-
def month
|
27
|
-
|
18
|
+
def month
|
19
|
+
month_path_with_params.get
|
28
20
|
end
|
29
21
|
|
30
22
|
def month_url
|
31
|
-
|
23
|
+
month_path_with_params.url
|
32
24
|
end
|
33
25
|
|
34
|
-
def
|
35
|
-
get
|
36
|
-
end
|
37
|
-
|
38
|
-
def all(options = {})
|
39
|
-
all_get_with_params(options).response(ThetvdbApi::Response::Update)
|
26
|
+
def all
|
27
|
+
all_path_with_params.get
|
40
28
|
end
|
41
29
|
|
42
30
|
def all_url
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
def all_get_with_params(options = {})
|
47
|
-
get(all_path).params(options)
|
31
|
+
all_path_with_params.url
|
48
32
|
end
|
49
33
|
|
50
34
|
private
|
51
35
|
|
36
|
+
def day_path_with_params
|
37
|
+
path(day_path).params(api_key_options)
|
38
|
+
end
|
39
|
+
|
52
40
|
def day_path
|
53
|
-
'
|
41
|
+
':apikey/updates/updates_day.xml'
|
42
|
+
end
|
43
|
+
|
44
|
+
def week_path_with_params
|
45
|
+
path(week_path).params(api_key_options)
|
54
46
|
end
|
55
47
|
|
56
48
|
def week_path
|
57
|
-
'
|
49
|
+
':apikey/updates/updates_week.xml'
|
50
|
+
end
|
51
|
+
|
52
|
+
def month_path_with_params
|
53
|
+
path(month_path).params(api_key_options)
|
58
54
|
end
|
59
55
|
|
60
56
|
def month_path
|
61
|
-
'
|
57
|
+
':apikey/updates/updates_month.xml'
|
58
|
+
end
|
59
|
+
|
60
|
+
def all_path_with_params
|
61
|
+
path(all_path).params(api_key_options)
|
62
62
|
end
|
63
63
|
|
64
64
|
def all_path
|
65
|
-
'
|
65
|
+
':apikey/updates/updates_all.xml'
|
66
66
|
end
|
67
67
|
end
|
data/lib/thetvdb_api/version.rb
CHANGED