thetvdb_api 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5501937cffeedf47be473a7d5c2bc4c3635236b1
4
- data.tar.gz: 7f59cde79cdacb935f59c2351b85a96c2c8876a3
3
+ metadata.gz: 97791a043434b43dfd16cf2edc9e37a67315cb79
4
+ data.tar.gz: 3a7bb165e31c4bbc6d0ae4c97ef948bfc2f84282
5
5
  SHA512:
6
- metadata.gz: e0aff5f795d6e47a7097b61d720b8538408f442165c507165bb410de50848367fb92e842a0ec971291458801ae4eb8a165f7b13602598567f157436331cf65d2
7
- data.tar.gz: a29e4a139f4707d9cbf5b8cee2466a911a85fb5010239926ab9ccd8f6643bb06333023f4a9289f74f71f08c7c7d4cc70880fe4195b7a07673a74a43980f8f15c
6
+ metadata.gz: 78dfd626d8f116d3bbc52b64d4100e6fec6ff844a7ce408271625fef346bdb7f20856d3e041a3eada81e9d64d6f224b6372f66204a539c5c97f3f00c7e2aa949
7
+ data.tar.gz: 7980189c25c89468d433e8d885c45c566c6dcb3f57c07723bf2731699181c5030f732f1884026c4a254687e57725185f6a6fa681a230aee163abe69ec5ddfa6f
data/README.md CHANGED
@@ -20,16 +20,16 @@ Run the bundle command to install it.
20
20
 
21
21
  ## How to use
22
22
 
23
- There is one entry point, in initialize you can past hash with api_key and language values, or leave empty:
23
+ You have two way for access to api:
24
24
 
25
- ```ruby
26
- client = ThetvdbApi::Client.new(api_key: '...', language: 'en')
27
- ```
25
+ * I way (create client class, one entry point)
26
+
27
+ * II way (direct access to api class, many entry points)
28
28
 
29
- Search series by name
29
+ Search series (by name) methods - access by search method or Search class
30
30
 
31
31
  ```ruby
32
- client = ThetvdbApi::Client.new
32
+ client = ThetvdbApi::Client.new(api_key: '...', language: 'en')
33
33
  client.search.get_series(options = {})
34
34
  client.search.get_series_url(options = {}) # return only full url
35
35
  client.search.get_series_by_remote_id(options = {})
@@ -38,36 +38,66 @@ client.search.get_episode(options = {})
38
38
  client.search.get_episode_url(options = {}) # return only full url
39
39
  ```
40
40
 
41
- Search series by id
41
+ ```ruby
42
+ search = ThetvdbApi::Search.new(api_key: '...', language: 'en')
43
+ search.get_series(options = {})
44
+ search.get_series_url(options = {}) # return only full url
45
+ search.get_series_by_remote_id(options = {})
46
+ search.get_series_by_remote_id_url(options = {}) # return only full url
47
+ search.get_episode(options = {})
48
+ search.get_episode_url(options = {}) # return only full url
49
+ ```
50
+
51
+ Search series (by id) methods - access by series method or Series class
42
52
 
43
53
  ```ruby
44
- client = ThetvdbApi::Client.new
54
+ client = ThetvdbApi::Client.new(api_key: '...', language: 'en')
45
55
  client.series.find(options = {})
46
56
  client.series.find_url(options = {}) # return only full url
47
57
  client.series.find_full(options = {})
48
58
  client.series.find_full_url(options = {}) # return only full url
49
59
  ```
50
60
 
51
- Return series actors
61
+ ```ruby
62
+ client = ThetvdbApi::Series.new(api_key: '...', language: 'en')
63
+ series.find(options = {})
64
+ series.find_url(options = {}) # return only full url
65
+ series.find_full(options = {})
66
+ series.find_full_url(options = {}) # return only full url
67
+ ```
68
+
69
+ Return series actors - access by actor method or Actor class
52
70
 
53
71
  ```ruby
54
- client = ThetvdbApi::Client.new
72
+ client = ThetvdbApi::Client.new(api_key: '...', language: 'en')
55
73
  client.actor.all(options = {})
56
74
  client.actor.all_url(options = {}) # return only full url
57
75
  ```
58
76
 
59
- Return series banners
77
+ ```ruby
78
+ actor = ThetvdbApi::Actor.new(api_key: '...', language: 'en')
79
+ actor.all(options = {})
80
+ actor.all_url(options = {}) # return only full url
81
+ ```
82
+
83
+ Return series banners - access by banner method or Banner class
60
84
 
61
85
  ```ruby
62
- client = ThetvdbApi::Client.new
86
+ client = ThetvdbApi::Client.new(api_key: '...', language: 'en')
63
87
  client.banner.all(options = {})
64
88
  client.banner.all_url(options = {}) # return only full url
65
89
  ```
66
90
 
67
- Return series episode
91
+ ```ruby
92
+ banner = ThetvdbApi::Banner.new(api_key: '...', language: 'en')
93
+ banner.all(options = {})
94
+ banner.all_url(options = {}) # return only full url
95
+ ```
96
+
97
+ Return series episode - access by episode method or Episode class
68
98
 
69
99
  ```ruby
70
- client = ThetvdbApi::Client.new
100
+ client = ThetvdbApi::Client.new(api_key: '...', language: 'en')
71
101
  client.episode.find_by_default_order(options = {})
72
102
  client.episode.find_by_default_order_url(options = {}) # return only full url
73
103
  client.episode.find_by_dvd_order(options = {})
@@ -78,10 +108,22 @@ client.episode.find(options = {})
78
108
  client.episode.find_url(options = {}) # return only full url
79
109
  ```
80
110
 
81
- Get updates
111
+ ```ruby
112
+ episode = ThetvdbApi::Episode.new(api_key: '...', language: 'en')
113
+ episode.find_by_default_order(options = {})
114
+ episode.find_by_default_order_url(options = {}) # return only full url
115
+ episode.find_by_dvd_order(options = {})
116
+ episode.find_by_dvd_order_url(options = {}) # return only full url
117
+ episode.find_by_absolute_order(options = {})
118
+ episode.find_by_absolute_order_url(options = {}) # return only full url
119
+ episode.find(options = {})
120
+ episode.find_url(options = {}) # return only full url
121
+ ```
122
+
123
+ Get updates - access by update method or Update class
82
124
 
83
125
  ```ruby
84
- client = ThetvdbApi::Client.new
126
+ client = ThetvdbApi::Client.new(api_key: '...', language: 'en')
85
127
  client.update.day
86
128
  client.update.day_url # return only full url
87
129
  client.update.week
@@ -91,6 +133,19 @@ client.update.month_url # return only full url
91
133
  client.update.all
92
134
  client.update.all_url # return only full url
93
135
  ```
136
+
137
+ ```ruby
138
+ update = ThetvdbApi::Update.new(api_key: '...', language: 'en')
139
+ update.day
140
+ update.day_url # return only full url
141
+ update.week
142
+ update.week_url # return only full url
143
+ update.month
144
+ update.month_url # return only full url
145
+ update.all
146
+ update.all_url # return only full url
147
+ ```
148
+
94
149
  ## Contributing
95
150
 
96
151
  1. Fork it
@@ -1,8 +1,20 @@
1
1
  class ThetvdbApi::Actor < ThetvdbApi::Base
2
+ # Return all of the series actors.
3
+ #
4
+ # access: FREE
5
+ # param: options hash
6
+ # series_id: TV series name
7
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:actors.xml)
2
8
  def find(options = {})
3
9
  find_path_with_params(options).get
4
10
  end
5
11
 
12
+ # Return all of the series actors - return only url.
13
+ #
14
+ # access: FREE
15
+ # param: options hash
16
+ # series_id: TV series name
17
+ # output: url string
6
18
  def find_url(options = {})
7
19
  find_path_with_params(options).url
8
20
  end
@@ -1,8 +1,20 @@
1
1
  class ThetvdbApi::Banner < ThetvdbApi::Base
2
+ # Return all of the series banners.
3
+ #
4
+ # access: FREE
5
+ # param: options hash
6
+ # series_id: TV series name
7
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:banners.xml)
2
8
  def find(options = {})
3
9
  find_path_with_params(options).get
4
10
  end
5
11
 
12
+ # Return all of the series banners - return only url.
13
+ #
14
+ # access: FREE
15
+ # param: options hash
16
+ # series_id: TV series name
17
+ # output: url string
6
18
  def find_url(options = {})
7
19
  find_path_with_params(options).url
8
20
  end
@@ -1,16 +1,14 @@
1
- require 'faraday'
2
- require 'uri_template'
3
1
  require 'service_api'
4
2
 
5
3
  class ThetvdbApi::Base
6
4
  include ServiceApi::BaseFaraday
7
5
 
8
6
  def api_key_options
9
- { apikey: @client.options[:api_key] }
7
+ { apikey: @config[:api_key] }
10
8
  end
11
9
 
12
10
  def language_options
13
- { language: @client.options[:language] }
11
+ { language: @config[:language] }
14
12
  end
15
13
 
16
14
  def api_key_with_language_options
@@ -1,34 +1,34 @@
1
1
  class ThetvdbApi::Client
2
- attr_reader :options
2
+ attr_reader :config
3
3
 
4
- def initialize(options = {})
5
- @options = options
4
+ def initialize(config = {})
5
+ @config = config
6
6
 
7
- @options[:adapter] ||= :net_http
8
- @options[:language] ||= 'en'
7
+ @config[:adapter] ||= :net_http
8
+ @config[:language] ||= 'en'
9
9
  end
10
10
 
11
11
  def search
12
- @search ||= ThetvdbApi::Search.new(self)
12
+ @search ||= ThetvdbApi::Search.new(config)
13
13
  end
14
14
 
15
15
  def series
16
- @series ||= ThetvdbApi::Series.new(self)
16
+ @series ||= ThetvdbApi::Series.new(config)
17
17
  end
18
18
 
19
19
  def actor
20
- @actor ||= ThetvdbApi::Actor.new(self)
20
+ @actor ||= ThetvdbApi::Actor.new(config)
21
21
  end
22
22
 
23
23
  def banner
24
- @banner ||= ThetvdbApi::Banner.new(self)
24
+ @banner ||= ThetvdbApi::Banner.new(config)
25
25
  end
26
26
 
27
27
  def episode
28
- @episode ||= ThetvdbApi::Episode.new(self)
28
+ @episode ||= ThetvdbApi::Episode.new(config)
29
29
  end
30
30
 
31
31
  def update
32
- @update ||= ThetvdbApi::Update.new(self)
32
+ @update ||= ThetvdbApi::Update.new(config)
33
33
  end
34
34
  end
@@ -1,32 +1,90 @@
1
1
  class ThetvdbApi::Episode < ThetvdbApi::Base
2
+ # Find the episode data, sorts using the default ordering method.
3
+ #
4
+ # access: FREE
5
+ # param: options hash
6
+ # series_id: TV series ID
7
+ # season: season number
8
+ # episode: episode number in season
9
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:Base_Episode_Record)
2
10
  def find_by_default_order(options = {})
3
11
  find_by_order(options.merge(order: 'default'))
4
12
  end
5
13
 
14
+ # Find the episode data, sorts using the default ordering method - return only url.
15
+ #
16
+ # access: FREE
17
+ # param: options hash
18
+ # series_id: TV series ID
19
+ # season: season number
20
+ # episode: episode number in season
21
+ # output: url string
6
22
  def find_by_default_order_url(options = {})
7
23
  find_by_order_url(options.merge(order: 'default'))
8
24
  end
9
25
 
26
+ # Find the episode data, sorts using the dvd ordering method.
27
+ #
28
+ # access: FREE
29
+ # param: options hash
30
+ # series_id: TV series ID
31
+ # season: season number
32
+ # episode: episode number in season
33
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:Base_Episode_Record)
10
34
  def find_by_dvd_order(options = {})
11
35
  find_by_order(options.merge(order: 'dvd'))
12
36
  end
13
37
 
38
+ # Find the episode data, sorts using the dvd ordering method - return only url.
39
+ #
40
+ # access: FREE
41
+ # param: options hash
42
+ # series_id: TV series ID
43
+ # season: season number
44
+ # episode: episode number in season
45
+ # output: url string
14
46
  def find_by_dvd_order_url(options = {})
15
47
  find_by_order_url(options.merge(order: 'dvd'))
16
48
  end
17
49
 
50
+ # Find the episode data, sorts using the absolute ordering method.
51
+ #
52
+ # access: FREE
53
+ # param: options hash
54
+ # series_id: TV series ID
55
+ # absolute: absolute number in series
56
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:Base_Episode_Record)
18
57
  def find_by_absolute_order(options = {})
19
58
  find_by_absolute_order_path_with_params(options).get
20
59
  end
21
60
 
61
+ # Find the episode data, sorts using the absolute ordering method - return only url.
62
+ #
63
+ # access: FREE
64
+ # param: options hash
65
+ # series_id: TV series ID
66
+ # absolute: absolute number in series
67
+ # output: url string
22
68
  def find_by_absolute_order_url(options = {})
23
69
  find_by_absolute_order_path_with_params(options).url
24
70
  end
25
71
 
72
+ # Find the episode data by episode id.
73
+ #
74
+ # access: FREE
75
+ # param: options hash
76
+ # episode_id: TV episode ID
77
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:Base_Episode_Record)
26
78
  def find(options = {})
27
79
  find_path_with_params(options).get
28
80
  end
29
81
 
82
+ # Find the episode data by episode id - return only url.
83
+ #
84
+ # access: FREE
85
+ # param: options hash
86
+ # episode_id: TV episode ID
87
+ # output: url string
30
88
  def find_url(options = {})
31
89
  find_path_with_params(options).url
32
90
  end
@@ -1,24 +1,68 @@
1
1
  class ThetvdbApi::Search < ThetvdbApi::Base
2
+ # Find the series data based on its name.
3
+ #
4
+ # access: FREE
5
+ # param: options hash
6
+ # seriesname: TV series name
7
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:GetSeries)
2
8
  def get_series(options = {})
3
9
  get_series_path_with_params(options).get
4
10
  end
5
11
 
12
+ # Find the series data based on its name - return only url.
13
+ #
14
+ # access: FREE
15
+ # param: options hash
16
+ # seriesname: TV series name
17
+ # output: url string
6
18
  def get_series_url(options = {})
7
19
  get_series_path_with_params(options).url
8
20
  end
9
21
 
22
+ # Find the series data by unique ID's used on other sites.
23
+ #
24
+ # access: FREE
25
+ # param: options hash
26
+ # imdbid: IMDb ID (don't use with zap2itid)
27
+ # zap2itid: Zap2it ID (don't use with imdbid)
28
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:GetSeriesByRemoteID)
10
29
  def get_series_by_remote_id(options = {})
11
30
  get_series_by_remote_id_path_with_params(options).get
12
31
  end
13
32
 
33
+ # Find the series data by unique ID's used on other sites - return only url.
34
+ #
35
+ # access: FREE
36
+ # param: options hash
37
+ # seriesid: IMDb ID (don't use with zap2itid)
38
+ # zap2itid: Zap2it ID (don't use with imdbid)
39
+ # output: url string
14
40
  def get_series_by_remote_id_url(options = {})
15
41
  get_series_by_remote_id_path_with_params(options).url
16
42
  end
17
43
 
44
+
45
+ # Find the episode data by episode air date.
46
+ #
47
+ # access: FREE
48
+ # param: options hash
49
+ # seriesid: This is the seriesid for the series you want to use for finding episodes.
50
+ # airdate: This is the date the episode aired on you are trying to lookup. This can be supplied in any valid date
51
+ # type. Example: 2008-01-01, 2008-1-1, January 1, 2008, 1/1/2008, etc
52
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:GetEpisodeByAirDate)
18
53
  def get_episode(options = {})
19
54
  get_episode_path_with_params(options).get
20
55
  end
21
56
 
57
+
58
+ # Find the episode data by episode air date - return only url.
59
+ #
60
+ # access: FREE
61
+ # param: options hash
62
+ # seriesid: This is the seriesid for the series you want to use for finding episodes.
63
+ # airdate: This is the date the episode aired on you are trying to lookup. This can be supplied in any valid date
64
+ # type. Example: 2008-01-01, 2008-1-1, January 1, 2008, 1/1/2008, etc
65
+ # output: url string
22
66
  def get_episode_url(options = {})
23
67
  get_episode_path_with_params(options).url
24
68
  end
@@ -1,16 +1,40 @@
1
1
  class ThetvdbApi::Series < ThetvdbApi::Base
2
+ # Find the series data by series id.
3
+ #
4
+ # access: FREE
5
+ # param: options hash
6
+ # series_id: TV series ID
7
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:Base_Series_Record)
2
8
  def find(options = {})
3
9
  find_path_with_params(options).get
4
10
  end
5
11
 
12
+ # Find the series data by series id - return only url.
13
+ #
14
+ # access: FREE
15
+ # param: options hash
16
+ # series_id: TV series ID
17
+ # output: url string
6
18
  def find_url(options = {})
7
19
  find_path_with_params(options).url
8
20
  end
9
21
 
22
+ # Find the full series data by series id.
23
+ #
24
+ # access: FREE
25
+ # param: options hash
26
+ # series_id: TV series ID
27
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:Full_Series_Record)
10
28
  def find_full(options = {})
11
29
  find_full_path_with_params(options).get
12
30
  end
13
31
 
32
+ # Find the full series data by series id - return only url.
33
+ #
34
+ # access: FREE
35
+ # param: options hash
36
+ # series_id: TV series ID
37
+ # output: url string
14
38
  def find_full_url(options = {})
15
39
  find_full_path_with_params(options).url
16
40
  end
@@ -1,32 +1,64 @@
1
1
  class ThetvdbApi::Update < ThetvdbApi::Base
2
+ # Find update data.
3
+ #
4
+ # access: FREE
5
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:Update_Records)
2
6
  def day
3
7
  day_path_with_params.get
4
8
  end
5
9
 
10
+ # Find update data - url string.
11
+ #
12
+ # access: FREE
13
+ # output: url string
6
14
  def day_url
7
15
  day_path_with_params.url
8
16
  end
9
17
 
18
+ # Find update data.
19
+ #
20
+ # access: FREE
21
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:Update_Records)
10
22
  def week
11
23
  week_path_with_params.get
12
24
  end
13
25
 
26
+ # Find update data - url string.
27
+ #
28
+ # access: FREE
29
+ # output: url string
14
30
  def week_url
15
31
  week_path_with_params.url
16
32
  end
17
33
 
34
+ # Find update data.
35
+ #
36
+ # access: FREE
37
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:Update_Records)
18
38
  def month
19
39
  month_path_with_params.get
20
40
  end
21
41
 
42
+ # Find update data - url string.
43
+ #
44
+ # access: FREE
45
+ # output: url string
22
46
  def month_url
23
47
  month_path_with_params.url
24
48
  end
25
49
 
50
+ # Find update data.
51
+ #
52
+ # access: FREE
53
+ # output: XML string (example: http://thetvdb.com/wiki/index.php/API:Update_Records)
26
54
  def all
27
55
  all_path_with_params.get
28
56
  end
29
57
 
58
+ # Find update data - url string.
59
+ #
60
+ # access: FREE
61
+ # output: url string
30
62
  def all_url
31
63
  all_path_with_params.url
32
64
  end
@@ -1,3 +1,3 @@
1
1
  module ThetvdbApi
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
data/thetvdb_api.gemspec CHANGED
@@ -18,10 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_runtime_dependency 'faraday', '~> 0.9.0'
22
- spec.add_runtime_dependency 'uri_template', '~> 0.7.0'
23
- spec.add_runtime_dependency 'multi_xml', '~> 0.5.5'
24
- spec.add_runtime_dependency 'service_api', '~> 0.0.4'
21
+ spec.add_runtime_dependency 'service_api', '~> 0.0.5'
25
22
 
26
23
  spec.add_development_dependency 'bundler', '~> 1.3'
27
24
  spec.add_development_dependency 'rake'
metadata CHANGED
@@ -1,71 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thetvdb_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Wawer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-23 00:00:00.000000000 Z
11
+ date: 2014-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: faraday
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: 0.9.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ~>
25
- - !ruby/object:Gem::Version
26
- version: 0.9.0
27
- - !ruby/object:Gem::Dependency
28
- name: uri_template
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: 0.7.0
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: 0.7.0
41
- - !ruby/object:Gem::Dependency
42
- name: multi_xml
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ~>
46
- - !ruby/object:Gem::Version
47
- version: 0.5.5
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: 0.5.5
55
13
  - !ruby/object:Gem::Dependency
56
14
  name: service_api
57
15
  requirement: !ruby/object:Gem::Requirement
58
16
  requirements:
59
17
  - - ~>
60
18
  - !ruby/object:Gem::Version
61
- version: 0.0.4
19
+ version: 0.0.5
62
20
  type: :runtime
63
21
  prerelease: false
64
22
  version_requirements: !ruby/object:Gem::Requirement
65
23
  requirements:
66
24
  - - ~>
67
25
  - !ruby/object:Gem::Version
68
- version: 0.0.4
26
+ version: 0.0.5
69
27
  - !ruby/object:Gem::Dependency
70
28
  name: bundler
71
29
  requirement: !ruby/object:Gem::Requirement