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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/README.md +30 -51
  4. data/lib/thetvdb_api/actor.rb +9 -9
  5. data/lib/thetvdb_api/banner.rb +9 -9
  6. data/lib/thetvdb_api/base.rb +10 -56
  7. data/lib/thetvdb_api/client.rb +6 -4
  8. data/lib/thetvdb_api/episode.rb +33 -34
  9. data/lib/thetvdb_api/search.rb +23 -35
  10. data/lib/thetvdb_api/series.rb +17 -17
  11. data/lib/thetvdb_api/update.rb +32 -32
  12. data/lib/thetvdb_api/version.rb +1 -1
  13. data/lib/thetvdb_api.rb +0 -12
  14. data/spec/fixtures/get_episode.xml +30 -0
  15. data/spec/fixtures/get_series.xml +24 -0
  16. data/spec/fixtures/get_series_by_remote.xml +14 -0
  17. data/spec/fixtures/updates.xml +35 -0
  18. data/spec/functionals/actor_spec.rb +30 -0
  19. data/spec/functionals/banner_spec.rb +30 -0
  20. data/spec/functionals/episode_spec.rb +85 -0
  21. data/spec/functionals/search_spec.rb +71 -0
  22. data/spec/functionals/series_spec.rb +48 -0
  23. data/spec/functionals/update_spec.rb +81 -0
  24. data/thetvdb_api.gemspec +2 -2
  25. metadata +34 -82
  26. data/lib/generators/templates/thetvdb_api.rb +0 -3
  27. data/lib/generators/thetvdb_api/install_generator.rb +0 -12
  28. data/lib/thetvdb_api/configuration.rb +0 -10
  29. data/lib/thetvdb_api/response/actors.rb +0 -7
  30. data/lib/thetvdb_api/response/banners.rb +0 -7
  31. data/lib/thetvdb_api/response/collection.rb +0 -9
  32. data/lib/thetvdb_api/response/episode.rb +0 -5
  33. data/lib/thetvdb_api/response/full_series.rb +0 -21
  34. data/lib/thetvdb_api/response/search_multiple_episode.rb +0 -7
  35. data/lib/thetvdb_api/response/search_multiple_series.rb +0 -7
  36. data/lib/thetvdb_api/response/search_series.rb +0 -5
  37. data/lib/thetvdb_api/response/series.rb +0 -5
  38. data/lib/thetvdb_api/response/update.rb +0 -31
  39. data/lib/thetvdb_api/response.rb +0 -52
  40. data/spec/functionals/classes/actor_spec.rb +0 -41
  41. data/spec/functionals/classes/banner_spec.rb +0 -42
  42. data/spec/functionals/classes/episode_spec.rb +0 -93
  43. data/spec/functionals/classes/series_spec.rb +0 -91
  44. data/spec/functionals/functional_spec_helper.rb +0 -7
  45. data/spec/functionals/support/stub_faraday.rb +0 -5
  46. data/spec/integrations/support/.keep +0 -0
  47. data/spec/units/classes/actor_spec.rb +0 -49
  48. data/spec/units/classes/banner_spec.rb +0 -49
  49. data/spec/units/classes/base_spec.rb +0 -123
  50. data/spec/units/classes/client_spec.rb +0 -41
  51. data/spec/units/classes/episode_spec.rb +0 -167
  52. data/spec/units/classes/response/actors_spec.rb +0 -15
  53. data/spec/units/classes/response/banners_spec.rb +0 -15
  54. data/spec/units/classes/response/collection_spec.rb +0 -38
  55. data/spec/units/classes/response/episode_spec.rb +0 -15
  56. data/spec/units/classes/response/full_series_spec.rb +0 -51
  57. data/spec/units/classes/response/search_multiple_episode_spec.rb +0 -15
  58. data/spec/units/classes/response/search_multiple_series_spec.rb +0 -15
  59. data/spec/units/classes/response/search_series_spec.rb +0 -15
  60. data/spec/units/classes/response/series_spec.rb +0 -15
  61. data/spec/units/classes/response/update_spec.rb +0 -79
  62. data/spec/units/classes/response_spec.rb +0 -100
  63. data/spec/units/classes/search_spec.rb +0 -178
  64. data/spec/units/classes/series_spec.rb +0 -92
  65. data/spec/units/classes/update_spec.rb +0 -178
  66. data/spec/units/unit_spec_helper.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d3d44fe8db10365aae54f5d1aee7c7496699b2c
4
- data.tar.gz: dc50fa8f9189685543359490fb3716963f6cb4d0
3
+ metadata.gz: 5501937cffeedf47be473a7d5c2bc4c3635236b1
4
+ data.tar.gz: 7f59cde79cdacb935f59c2351b85a96c2c8876a3
5
5
  SHA512:
6
- metadata.gz: b124defe4f619cfb943ef8eaa456809c7df0421a1b424f3ffc8488e23290892ed40154be2506c554f7435639ba66b3870d126f1a080124e15afc7702fe5d8656
7
- data.tar.gz: 68faa1b372bebb00aec6d064157ceec1fe2dba0b13bf4a4c065f1ebee0f6605ea16de4aca7ffac1f91d7124252c9bd5e8d82d66a0f261781a3be0d7713ffe444
6
+ metadata.gz: e0aff5f795d6e47a7097b61d720b8538408f442165c507165bb410de50848367fb92e842a0ec971291458801ae4eb8a165f7b13602598567f157436331cf65d2
7
+ data.tar.gz: a29e4a139f4707d9cbf5b8cee2466a911a85fb5010239926ab9ccd8f6643bb06333023f4a9289f74f71f08c7c7d4cc70880fe4195b7a07673a74a43980f8f15c
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  language: ruby
2
- script: 'bundle exec rspec spec/units && bundle exec rspec spec/functionals && bundle exec rspec spec/units'
2
+ script: 'bundle exec rspec spec/functionals'
3
3
  rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
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('buffy', options = {})
42
- client.search.get_series_url('buffy', options = {}) # return only full url
43
- client.search.get_series_by_imdb_id(id, options = {})
44
- client.search.get_series_by_imdb_id_url(id, options = {}) # return only full url
45
- client.search.get_series_by_zap2it_id(id)
46
- client.search.get_series_by_zap2it_id_url(id, options = {}) # return only full url
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('123', options = {})
56
- client.series.find_url('123', options = {}) # return only full url
57
- client.series.find_full('123', options = {})
58
- client.series.find_full_url('123', options = {}) # return only 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(series_id, options = {})
66
- client.actor.all_url(series_id, options = {}) # return only full 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(series_id, options = {})
74
- client.banner.all_url(series_id, options = {}) # return only full 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(series_id, season, episode, options = {})
82
- client.episode.find_by_default_order_url(series_id, season, episode, options = {}) # return only full url
83
- client.episode.find_by_dvd_order(series_id, season, episode, options = {})
84
- client.episode.find_by_dvd_order_url(series_id, season, episode, options = {}) # return only full url
85
- client.episode.find_by_absolute_order(series_id, absolute, options = {})
86
- client.episode.find_by_absolute_order_url(series_id, absolute, options = {}) # return only full url
87
- client.episode.find(episode_id, options = {})
88
- client.episode.find_url(episode_id, options = {}) # return only full 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(options = {})
96
- client.update.day_url(options = {}) # return only full url
97
- client.update.week(options = {})
98
- client.update.week_url(options = {}) # return only full url
99
- client.update.month(options = {})
100
- client.update.month_url(options = {}) # return only full url
101
- client.update.all(options = {})
102
- client.update.all_url(options = {}) # return only full 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
@@ -1,19 +1,19 @@
1
1
  class ThetvdbApi::Actor < ThetvdbApi::Base
2
- def find(series_id, options = {})
3
- find_get_with_params(series_id, options).response(ThetvdbApi::Response::Actors)
2
+ def find(options = {})
3
+ find_path_with_params(options).get
4
4
  end
5
5
 
6
- def find_url(series_id)
7
- find_get_with_params(series_id).url
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
- "#{series_uri}/actors.xml"
17
+ ':apikey/series/:series_id/actors.xml'
18
18
  end
19
19
  end
@@ -1,19 +1,19 @@
1
1
  class ThetvdbApi::Banner < ThetvdbApi::Base
2
- def find(series_id, options = {})
3
- find_get_with_params(series_id, options).response(ThetvdbApi::Response::Banners)
2
+ def find(options = {})
3
+ find_path_with_params(options).get
4
4
  end
5
5
 
6
- def find_url(series_id)
7
- find_get_with_params(series_id).url
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
- "#{series_uri}/banners.xml"
17
+ ':apikey/series/:series_id/banners.xml'
18
18
  end
19
19
  end
@@ -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
- def initialize(client)
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 series_uri
55
- '{api_key}/series/{series_id}'
8
+ def api_key_options
9
+ { apikey: @client.options[:api_key] }
56
10
  end
57
11
 
58
- def language
59
- @client.language
12
+ def language_options
13
+ { language: @client.options[:language] }
60
14
  end
61
15
 
62
- def api_key
63
- @client.api_key
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 assert_uri_template
69
- raise "Path doesn't exists, use get(path) to setup path for request" unless @uri_template
22
+ def uri_kind
23
+ :colon
70
24
  end
71
25
 
72
26
  def base_url
@@ -1,9 +1,11 @@
1
1
  class ThetvdbApi::Client
2
- attr_reader :api_key, :language
2
+ attr_reader :options
3
3
 
4
4
  def initialize(options = {})
5
- @api_key = options[:api_key] ? options[:api_key] : ThetvdbApi::Configuration.api_key
6
- @language = options[:language] ? options[:language] : ThetvdbApi::Configuration.language
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
@@ -1,68 +1,67 @@
1
1
  class ThetvdbApi::Episode < ThetvdbApi::Base
2
- def find_by_default_order(series_id, season, episode, options = {})
3
- find_by_order('default', series_id, season, episode, options)
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(series_id, season, episode, options = {})
7
- find_by_order_url('default', series_id, season, episode, options)
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(series_id, season, episode, options = {})
11
- find_by_order('dvd', series_id, season, episode, options)
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(series_id, season, episode, options = {})
15
- find_by_order_url('dvd', series_id, season, episode, options)
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(series_id, absolute, options = {})
19
- find_by_absolute_order_get_with_params(series_id, absolute, options).response(ThetvdbApi::Response::Episode)
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(series_id, absolute, options = {})
23
- find_by_absolute_order_get_with_params(series_id, absolute, options).url
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 find_by_absolute_order_get_with_params(series_id, absolute, options)
27
- get(find_by_absolute_order_path).params({ series_id: series_id, absolute: absolute }.merge(options))
26
+ def find(options = {})
27
+ find_path_with_params(options).get
28
28
  end
29
29
 
30
- def find(episode_id, options = {})
31
- find_get_with_params(episode_id, options).response(ThetvdbApi::Response::Episode)
30
+ def find_url(options = {})
31
+ find_path_with_params(options).url
32
32
  end
33
33
 
34
- def find_url(episode_id, options = {})
35
- find_get_with_params(episode_id, options).url
36
- end
34
+ private
37
35
 
38
- def find_get_with_params(episode_id, options)
39
- get(find_path).params({ episode_id: episode_id }.merge(options))
36
+ def find_by_order(options)
37
+ find_by_order_path_with_params(options).get
40
38
  end
41
39
 
42
- def find_by_order(order, series_id, season, episode, options)
43
- find_by_order_get_with_params(order, series_id, season, episode, options).response(ThetvdbApi::Response::Episode)
40
+ def find_by_order_url(options)
41
+ find_by_order_path_with_params(options).url
44
42
  end
45
43
 
46
- def find_by_order_url(order, series_id, season, episode, options)
47
- find_by_order_get_with_params(order, series_id, season, episode, options).url
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 find_by_order_get_with_params(order, series_id, season, episode, options)
51
- get(find_by_order_path).
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
- private
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
- "#{series_uri}/absolute/{absolute}/{language}.xml"
57
+ ':apikey/series/:series_id/absolute/:absolute/:language.xml'
59
58
  end
60
59
 
61
- def find_path
62
- '{api_key}/episodes/{episode_id}/{language}.xml'
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 find_by_order_path
66
- "#{series_uri}/{order}/{season}/{episode}/{language}.xml"
64
+ def find_path
65
+ ':apikey/episodes/:episode_id/:language.xml'
67
66
  end
68
67
  end
@@ -1,62 +1,50 @@
1
1
  class ThetvdbApi::Search < ThetvdbApi::Base
2
- def get_series(name, options = {})
3
- get_series_get_with_params(name, options).response(ThetvdbApi::Response::SearchMultipleSeries)
2
+ def get_series(options = {})
3
+ get_series_path_with_params(options).get
4
4
  end
5
5
 
6
- def get_series_url(name, options = {})
7
- get_series_get_with_params(name, options).url
6
+ def get_series_url(options = {})
7
+ get_series_path_with_params(options).url
8
8
  end
9
9
 
10
- def get_series_get_with_params(name, options)
11
- get(get_series_path).params({ seriesname: name }.merge(options))
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 get_series_by_imdb_id(id, options = {})
15
- get_series_by_imdb_id_get_with_params(id, options).response(ThetvdbApi::Response::SearchSeries)
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 get_series_by_imdb_id_url(id, options = {})
19
- get_series_by_imdb_id_get_with_params(id, options).url
18
+ def get_episode(options = {})
19
+ get_episode_path_with_params(options).get
20
20
  end
21
21
 
22
- def get_series_by_imdb_id_get_with_params(id, options)
23
- get(get_series_by_remote_id_path).params({ imdbid: id }.merge(options))
22
+ def get_episode_url(options = {})
23
+ get_episode_path_with_params(options).url
24
24
  end
25
25
 
26
- def get_series_by_zap2it_id(id, options = {})
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 get_episode_get_with_params(series_id, air_date, options)
47
- get(get_episode_path).params({ seriesid: series_id, airdate: air_date }.merge(options))
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
@@ -1,35 +1,35 @@
1
1
  class ThetvdbApi::Series < ThetvdbApi::Base
2
- def find(series_id, options = {})
3
- find_get_with_params(series_id, options).response(ThetvdbApi::Response::Series)
2
+ def find(options = {})
3
+ find_path_with_params(options).get
4
4
  end
5
5
 
6
- def find_url(series_id, options = {})
7
- find_get_with_params(series_id, options).url
6
+ def find_url(options = {})
7
+ find_path_with_params(options).url
8
8
  end
9
9
 
10
- def find_get_with_params(series_id, options)
11
- get(find_path).params({ series_id: series_id }.merge(options))
10
+ def find_full(options = {})
11
+ find_full_path_with_params(options).get
12
12
  end
13
13
 
14
- def find_full(series_id, options = {})
15
- find_full_get_with_params(series_id, options).response(ThetvdbApi::Response::FullSeries)
14
+ def find_full_url(options = {})
15
+ find_full_path_with_params(options).url
16
16
  end
17
17
 
18
- def find_full_url(series_id, options = {})
19
- find_full_get_with_params(series_id, options).url
20
- end
18
+ private
21
19
 
22
- def find_full_get_with_params(series_id, options)
23
- get(find_full_path).params({ series_id: series_id }.merge(options))
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
- "#{series_uri}/{language}.xml"
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
- "#{series_uri}/all/{language}.xml"
33
+ ':apikey/series/:series_id/all/:language.xml'
34
34
  end
35
35
  end
@@ -1,67 +1,67 @@
1
1
  class ThetvdbApi::Update < ThetvdbApi::Base
2
- def day(options = {})
3
- day_get_with_params(options).response(ThetvdbApi::Response::Update)
2
+ def day
3
+ day_path_with_params.get
4
4
  end
5
5
 
6
6
  def day_url
7
- day_get_with_params.url
7
+ day_path_with_params.url
8
8
  end
9
9
 
10
- def day_get_with_params(options = {})
11
- get(day_path).params(options)
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
- week_get_with_params.url
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(options = {})
27
- month_get_with_params(options).response(ThetvdbApi::Response::Update)
18
+ def month
19
+ month_path_with_params.get
28
20
  end
29
21
 
30
22
  def month_url
31
- month_get_with_params.url
23
+ month_path_with_params.url
32
24
  end
33
25
 
34
- def month_get_with_params(options = {})
35
- get(month_path).params(options)
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
- all_get_with_params.url
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
- '{api_key}/updates/updates_day.xml'
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
- '{api_key}/updates/updates_week.xml'
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
- '{api_key}/updates/updates_month.xml'
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
- '{api_key}/updates/updates_all.xml'
65
+ ':apikey/updates/updates_all.xml'
66
66
  end
67
67
  end
@@ -1,3 +1,3 @@
1
1
  module ThetvdbApi
2
- VERSION = '0.2.3.1'
2
+ VERSION = '0.2.4'
3
3
  end