thetvdb_party 0.0.10.pre → 0.0.11.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +63 -63
- data/Gemfile +4 -4
- data/LICENSE.txt +22 -22
- data/Rakefile +14 -9
- data/lib/thetvdb_party/actor.rb +42 -0
- data/lib/thetvdb_party/all.rb +34 -0
- data/lib/thetvdb_party/banner.rb +63 -0
- data/lib/thetvdb_party/baseseriesrecord.rb +14 -0
- data/lib/thetvdb_party/client.rb +56 -0
- data/lib/thetvdb_party/version.rb +4 -4
- data/lib/thetvdb_party.rb +4 -0
- data/spec/thetvdb_party/actor_spec.rb +26 -0
- data/spec/thetvdb_party/banner_spec.rb +26 -0
- data/spec/thetvdb_party/baseseriesrecord_spec.rb +21 -0
- data/spec/thetvdb_party_spec.rb +13 -0
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caaeef9e167cb8951dd7d04ce0ba6bfc23d56df1
|
4
|
+
data.tar.gz: 33c2b4c2cec606d65479e648e1816f6046b7b245
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b355f88c52e93986891f815a49a8bc0e6ce0124d9c78eb4ddfebda08a44e2e58aa6ccec3257a7735c67bac79f7ac881ba69a54b56385a365e8f7e02c6843cf18
|
7
|
+
data.tar.gz: 454d5ef95c960f476f0c1ce577620b72e8217bfbe4a3ccc600aa2a44c153ad5d5599956a8014d64453d7ed6c32f875b9a71bb651ab78ca8d190506fc54cb6717
|
data/.gitattributes
CHANGED
@@ -1,63 +1,63 @@
|
|
1
|
-
###############################################################################
|
2
|
-
# Set default behavior to automatically normalize line endings.
|
3
|
-
###############################################################################
|
4
|
-
* text=auto
|
5
|
-
|
6
|
-
###############################################################################
|
7
|
-
# Set default behavior for command prompt diff.
|
8
|
-
#
|
9
|
-
# This is need for earlier builds of msysgit that does not have it on by
|
10
|
-
# default for csharp files.
|
11
|
-
# Note: This is only used by command line
|
12
|
-
###############################################################################
|
13
|
-
#*.cs diff=csharp
|
14
|
-
|
15
|
-
###############################################################################
|
16
|
-
# Set the merge driver for project and solution files
|
17
|
-
#
|
18
|
-
# Merging from the command prompt will add diff markers to the files if there
|
19
|
-
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
20
|
-
# the diff markers are never inserted). Diff markers may cause the following
|
21
|
-
# file extensions to fail to load in VS. An alternative would be to treat
|
22
|
-
# these files as binary and thus will always conflict and require user
|
23
|
-
# intervention with every merge. To do so, just uncomment the entries below
|
24
|
-
###############################################################################
|
25
|
-
#*.sln merge=binary
|
26
|
-
#*.csproj merge=binary
|
27
|
-
#*.vbproj merge=binary
|
28
|
-
#*.vcxproj merge=binary
|
29
|
-
#*.vcproj merge=binary
|
30
|
-
#*.dbproj merge=binary
|
31
|
-
#*.fsproj merge=binary
|
32
|
-
#*.lsproj merge=binary
|
33
|
-
#*.wixproj merge=binary
|
34
|
-
#*.modelproj merge=binary
|
35
|
-
#*.sqlproj merge=binary
|
36
|
-
#*.wwaproj merge=binary
|
37
|
-
|
38
|
-
###############################################################################
|
39
|
-
# behavior for image files
|
40
|
-
#
|
41
|
-
# image files are treated as binary by default.
|
42
|
-
###############################################################################
|
43
|
-
#*.jpg binary
|
44
|
-
#*.png binary
|
45
|
-
#*.gif binary
|
46
|
-
|
47
|
-
###############################################################################
|
48
|
-
# diff behavior for common document formats
|
49
|
-
#
|
50
|
-
# Convert binary document formats to text before diffing them. This feature
|
51
|
-
# is only available from the command line. Turn it on by uncommenting the
|
52
|
-
# entries below.
|
53
|
-
###############################################################################
|
54
|
-
#*.doc diff=astextplain
|
55
|
-
#*.DOC diff=astextplain
|
56
|
-
#*.docx diff=astextplain
|
57
|
-
#*.DOCX diff=astextplain
|
58
|
-
#*.dot diff=astextplain
|
59
|
-
#*.DOT diff=astextplain
|
60
|
-
#*.pdf diff=astextplain
|
61
|
-
#*.PDF diff=astextplain
|
62
|
-
#*.rtf diff=astextplain
|
63
|
-
#*.RTF diff=astextplain
|
1
|
+
###############################################################################
|
2
|
+
# Set default behavior to automatically normalize line endings.
|
3
|
+
###############################################################################
|
4
|
+
* text=auto
|
5
|
+
|
6
|
+
###############################################################################
|
7
|
+
# Set default behavior for command prompt diff.
|
8
|
+
#
|
9
|
+
# This is need for earlier builds of msysgit that does not have it on by
|
10
|
+
# default for csharp files.
|
11
|
+
# Note: This is only used by command line
|
12
|
+
###############################################################################
|
13
|
+
#*.cs diff=csharp
|
14
|
+
|
15
|
+
###############################################################################
|
16
|
+
# Set the merge driver for project and solution files
|
17
|
+
#
|
18
|
+
# Merging from the command prompt will add diff markers to the files if there
|
19
|
+
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
20
|
+
# the diff markers are never inserted). Diff markers may cause the following
|
21
|
+
# file extensions to fail to load in VS. An alternative would be to treat
|
22
|
+
# these files as binary and thus will always conflict and require user
|
23
|
+
# intervention with every merge. To do so, just uncomment the entries below
|
24
|
+
###############################################################################
|
25
|
+
#*.sln merge=binary
|
26
|
+
#*.csproj merge=binary
|
27
|
+
#*.vbproj merge=binary
|
28
|
+
#*.vcxproj merge=binary
|
29
|
+
#*.vcproj merge=binary
|
30
|
+
#*.dbproj merge=binary
|
31
|
+
#*.fsproj merge=binary
|
32
|
+
#*.lsproj merge=binary
|
33
|
+
#*.wixproj merge=binary
|
34
|
+
#*.modelproj merge=binary
|
35
|
+
#*.sqlproj merge=binary
|
36
|
+
#*.wwaproj merge=binary
|
37
|
+
|
38
|
+
###############################################################################
|
39
|
+
# behavior for image files
|
40
|
+
#
|
41
|
+
# image files are treated as binary by default.
|
42
|
+
###############################################################################
|
43
|
+
#*.jpg binary
|
44
|
+
#*.png binary
|
45
|
+
#*.gif binary
|
46
|
+
|
47
|
+
###############################################################################
|
48
|
+
# diff behavior for common document formats
|
49
|
+
#
|
50
|
+
# Convert binary document formats to text before diffing them. This feature
|
51
|
+
# is only available from the command line. Turn it on by uncommenting the
|
52
|
+
# entries below.
|
53
|
+
###############################################################################
|
54
|
+
#*.doc diff=astextplain
|
55
|
+
#*.DOC diff=astextplain
|
56
|
+
#*.docx diff=astextplain
|
57
|
+
#*.DOCX diff=astextplain
|
58
|
+
#*.dot diff=astextplain
|
59
|
+
#*.DOT diff=astextplain
|
60
|
+
#*.pdf diff=astextplain
|
61
|
+
#*.PDF diff=astextplain
|
62
|
+
#*.rtf diff=astextplain
|
63
|
+
#*.RTF diff=astextplain
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in thetvdb_party.gemspec
|
4
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in thetvdb_party.gemspec
|
4
|
+
gemspec
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2015 Fredrik Høisæther Rasch, Tim Alexander Teige, Peter Munch-Ellingsen, Tore Skog Pettersen, Alexander Trondsen Norvik
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2015 Fredrik Høisæther Rasch, Tim Alexander Teige, Peter Munch-Ellingsen, Tore Skog Pettersen, Alexander Trondsen Norvik
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'rdoc/task'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
rdoc.
|
7
|
-
rdoc.
|
8
|
-
rdoc.
|
9
|
-
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rdoc/task'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
RDoc::Task.new do |rdoc|
|
6
|
+
rdoc.main = "README.md"
|
7
|
+
rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
|
8
|
+
rdoc.rdoc_dir = "doc"
|
9
|
+
rdoc.options << "--line-numbers"
|
10
|
+
end
|
11
|
+
|
12
|
+
RSpec::Core::RakeTask.new do |rspec|
|
13
|
+
rspec.pattern = 'spec/**/*_spec.rb'
|
14
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module TheTvDbParty
|
2
|
+
# Actors holds information about actors
|
3
|
+
# See also:: http://thetvdb.com/wiki/index.php/API:actors.xml
|
4
|
+
class Actor
|
5
|
+
# Useless field, will eventually be used to link actors between series but currently isn't in use and may actually change once it gets fully implemented so don't bother storing it at all.
|
6
|
+
attr_reader :id
|
7
|
+
# Can be appended to <mirrorpath>/banners/ to determine the actual location of the artwork.
|
8
|
+
attr_reader :image
|
9
|
+
# The actors real name.
|
10
|
+
attr_reader :name
|
11
|
+
# The name of the actors character in the series.
|
12
|
+
attr_reader :role
|
13
|
+
# An integer from 0-3. 1 being the most important actor on the show and 3 being the third most important actor. 0 means they have no special sort order. Duplicates of 1-3 aren't suppose to be allowed but currently are so the field isn't perfect but can still be used for basic sorting.
|
14
|
+
attr_reader :sortOrder
|
15
|
+
|
16
|
+
# Initializes a new Actor as it was retrieved from a given client.
|
17
|
+
# Parameters::
|
18
|
+
# +client+:: The TheTvDbParty::Client instance that retrieved the record this actor belongs to.
|
19
|
+
# +hashValues+:: A Hash{String => String} instance that maps the actor element names to their string values.
|
20
|
+
def initialize(client, hashValues)
|
21
|
+
@client = client
|
22
|
+
@hashValues = hashValues
|
23
|
+
|
24
|
+
read_hash_values
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def read_hash_values
|
29
|
+
@id = default @hashValues["id"], -1
|
30
|
+
@image = @hashValues["Image"]
|
31
|
+
@name = @hashValues["Name"]
|
32
|
+
@role = @hashValues["Role"]
|
33
|
+
@sortOrder = default @hashValues["SortOrder"], 0
|
34
|
+
|
35
|
+
nil
|
36
|
+
end
|
37
|
+
|
38
|
+
def default value, default
|
39
|
+
return value ? value : default
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module TheTvDbParty
|
2
|
+
class AllSeriesInformation
|
3
|
+
|
4
|
+
attr_reader :actors, :banners, :series, :episodes
|
5
|
+
|
6
|
+
def initialize(client, zip_file)
|
7
|
+
@client = client
|
8
|
+
|
9
|
+
unzip_file(zip_file)
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
def unzip_file(zip_file)
|
15
|
+
@series = BaseSeriesRectord.new(@client, zip_file.glob("Series").input_stream.read)
|
16
|
+
@actors = []
|
17
|
+
@banners = []
|
18
|
+
@episodes = []
|
19
|
+
|
20
|
+
zip_file.glob("Actors").each do |actor|
|
21
|
+
@actors << Actor.new(@client, actor.input_stream.read)
|
22
|
+
end
|
23
|
+
|
24
|
+
zip_file.glob("Banners").each do |banner|
|
25
|
+
@banners << Banner.new(@client, banner.input_stream.read)
|
26
|
+
end
|
27
|
+
|
28
|
+
zip_file.glob("Episode").each do |episode|
|
29
|
+
@episodes << Episode.new(@client, episode.input_stream.read)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module TheTvDbParty
|
2
|
+
# Banner holds information about banners associated with series and seasons.
|
3
|
+
# See Also:: http://thetvdb.com/wiki/index.php/API:banners.xml
|
4
|
+
class Banner
|
5
|
+
# Unique ID for this banner
|
6
|
+
attr_reader :id
|
7
|
+
# Can be appended to <mirrorpath>/banners/ to determine the actual location of the artwork.
|
8
|
+
attr_reader :bannerPath
|
9
|
+
# Used exactly the same way as BannerPath, only shows if BannerType is fanart.
|
10
|
+
attr_reader :thumbnailPath
|
11
|
+
attr_reader :vignettePath
|
12
|
+
# This can be poster, fanart, series or season.
|
13
|
+
attr_reader :bannerType
|
14
|
+
# For series banners it can be text, graphical, or blank. For season banners it can be season or seasonwide. For fanart it can be 1280x720 or 1920x1080. For poster it will always be 680x1000.
|
15
|
+
# Blank banners will leave the title and show logo off the banner. Text banners will show the series name as plain text in an Arial font. Graphical banners will show the series name in the show's official font or will display the actual logo for the show. Season banners are the standard DVD cover format while wide season banners will be the same dimensions as the series banners.
|
16
|
+
attr_reader :bannerType2
|
17
|
+
# Some banners list the series name in a foreign language. The language abbreviation will be listed here.
|
18
|
+
attr_reader :language
|
19
|
+
# If the banner is for a specific season.
|
20
|
+
attr_reader :season
|
21
|
+
# Either nil or a decimal with four decimal places. The rating the banner currently has on the site.
|
22
|
+
attr_reader :rating
|
23
|
+
# Always returns an unsigned integer. Number of people who have rated the image.
|
24
|
+
attr_reader :ratingCount
|
25
|
+
# This can be true or false. Only shows if BannerType is fanart. Indicates if the seriesname is included in the image or not.
|
26
|
+
attr_reader :seriesName
|
27
|
+
# Returns either nil or an array of three RGB colors. These are colors the artist picked that go well with the image. In order they are Light Accent Color, Dark Accent Color and Neutral Midtone Color. It's meant to be used if you want to write something over the image, it gives you a good idea of what colors may work and show up well. Only shows if BannerType is fanart.
|
28
|
+
attr_reader :colors
|
29
|
+
|
30
|
+
# Initializes a new Banner as it was retrieved from a given client.
|
31
|
+
# Parameters::
|
32
|
+
# +client+:: The TheTvDbParty::Client instance that retrieved the record this banner belongs to.
|
33
|
+
# +hashValues+:: A Hash{String => String} instance that maps the banner element names to their string values.
|
34
|
+
def initialize(client, hashValues)
|
35
|
+
@client = client
|
36
|
+
@hashValues = hashValues
|
37
|
+
|
38
|
+
read_hash_values
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
def read_hash_values
|
43
|
+
@id = default @hashValues["id"], -1
|
44
|
+
@bannerPath = @hashValues["BannerPath"]
|
45
|
+
@thumbnailPath = @hashValues["ThumbnailPath"]
|
46
|
+
@vignettePath = @hashValues["VignettePath"]
|
47
|
+
@bannerType = @hashValues["BannerType"]
|
48
|
+
@bannerType2 = @hashValues["BannerType2"]
|
49
|
+
@language = @hashValues["Language"]
|
50
|
+
@season = @hashValues["Season"]
|
51
|
+
@rating = @hashValues["Rating"]
|
52
|
+
@ratingCount = default @hashValues["RatingCount"], 0
|
53
|
+
@seriesName = default @hashValues["SeriesName"], false
|
54
|
+
@colors = @hashValues["Colors"]
|
55
|
+
|
56
|
+
nil
|
57
|
+
end
|
58
|
+
|
59
|
+
def default value, default
|
60
|
+
return value ? value : default
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -107,6 +107,20 @@ module TheTvDbParty
|
|
107
107
|
@client.get_series_absolute_episode @seriesid, episode_number
|
108
108
|
end
|
109
109
|
|
110
|
+
# Retrieves the banners for this series.
|
111
|
+
# Returns:: An array of TheTvDbParty::Banner instances, or +nil+ if none could be retrieved.
|
112
|
+
# See Also:: TheTvDbParty::Client#get_series_banners
|
113
|
+
def get_banners
|
114
|
+
@client.get_series_banners @seriesid
|
115
|
+
end
|
116
|
+
|
117
|
+
# Retrieves the banners for this series.
|
118
|
+
# Returns:: An array of TheTvDbParty::Banner instances, or +nil+ if none could be retrieved.
|
119
|
+
# See Also:: TheTvDbParty::Client#get_series_actors
|
120
|
+
def get_actors
|
121
|
+
@client.get_series_actors @seriesid
|
122
|
+
end
|
123
|
+
|
110
124
|
private
|
111
125
|
def read_hash_values
|
112
126
|
@seriesid = @hashValues["id"] ? @hashValues["id"].to_i : -1
|
data/lib/thetvdb_party/client.rb
CHANGED
@@ -63,6 +63,7 @@ module TheTvDbParty
|
|
63
63
|
end
|
64
64
|
request_url = URI.join(BASE_URL, 'api/', request_url)
|
65
65
|
resp = self.class.get(request_url).parsed_response
|
66
|
+
return nil unless resp["Data"]
|
66
67
|
return nil unless resp["Data"]["Series"]
|
67
68
|
BaseSeriesRecord.new(self, resp["Data"]["Series"])
|
68
69
|
end
|
@@ -134,6 +135,61 @@ module TheTvDbParty
|
|
134
135
|
get_base_episode_record_from_url request_url
|
135
136
|
end
|
136
137
|
|
138
|
+
# Retrieves the banners for a given series by its series id.
|
139
|
+
# Parameters::
|
140
|
+
# +seriesid+:: The TheTvDb assigned unique identifier for the series to access.
|
141
|
+
# Returns:: An array of TheTvDbParty::Banner instances or +nil+ if the banners could not be retrieved. Note: may return [] if banners are retrieved but there are none.
|
142
|
+
def get_series_banners(seriesid)
|
143
|
+
request_url = "#{@apikey}/series/#{seriesid}/banners.xml"
|
144
|
+
request_url = URI.join(BASE_URL, 'api/', request_url)
|
145
|
+
response = self.class.get(request_url).parsed_response
|
146
|
+
return nil unless response["Banners"]
|
147
|
+
return nil unless response["Banners"]["Banner"]
|
148
|
+
case response["Banners"]["Banner"]
|
149
|
+
when Array
|
150
|
+
response["Banners"]["Banner"].map {|s|Banner.new(self, s)}
|
151
|
+
when Hash
|
152
|
+
[Banner.new(self, response["Banners"]["Banner"])]
|
153
|
+
else
|
154
|
+
[]
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# Retrieves the actors for a given series by its series id.
|
159
|
+
# Parameters::
|
160
|
+
# +seriesid+:: The TheTvDb assigned unique identifier for the series to access.
|
161
|
+
# Returns:: An array of TheTvDbParty::Actor instances or +nil+ if the actors could not be retrieved. Note: may return [] if actors are retrieved but there are none.
|
162
|
+
def get_series_actors(seriesid)
|
163
|
+
request_url = "#{@apikey}/series/#{seriesid}/actors.xml"
|
164
|
+
request_url = URI.join(BASE_URL, 'api/', request_url)
|
165
|
+
response = self.class.get(request_url).parsed_response
|
166
|
+
return nil unless response["Actors"]
|
167
|
+
return nil unless response["Actors"]["Actor"]
|
168
|
+
case response["Actors"]["Actor"]
|
169
|
+
when Array
|
170
|
+
response["Actors"]["Actor"].map {|s|Actor.new(self, s)}
|
171
|
+
when Hash
|
172
|
+
[Actor.new(self, response["Actors"]["Actor"])]
|
173
|
+
else
|
174
|
+
[]
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
def get_series_all(seriesid)
|
179
|
+
unless @language
|
180
|
+
request_url = "#{@apikey}/series/#{seriesid}/all"
|
181
|
+
else
|
182
|
+
request_url = "#{@apikey}/series/#{seriesid}/all/#{@language}.zip"
|
183
|
+
end
|
184
|
+
|
185
|
+
resp = self.class.get(request_url)
|
186
|
+
|
187
|
+
return nil unless resp.body.extname == ".zip"
|
188
|
+
|
189
|
+
AllSeriesInformation.new(@client, resp.body)
|
190
|
+
|
191
|
+
end
|
192
|
+
|
137
193
|
private
|
138
194
|
def get_base_episode_record_from_url(request_url)
|
139
195
|
resp = self.class.get(request_url).parsed_response
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module TheTvDbParty
|
2
|
-
# The current version of the *thetvdb_party* gem
|
3
|
-
VERSION = "0.0.
|
4
|
-
end
|
1
|
+
module TheTvDbParty
|
2
|
+
# The current version of the *thetvdb_party* gem
|
3
|
+
VERSION = "0.0.11.pre"
|
4
|
+
end
|
data/lib/thetvdb_party.rb
CHANGED
@@ -4,7 +4,11 @@ require 'thetvdb_party/baseseriesrecord'
|
|
4
4
|
require 'thetvdb_party/baseepisoderecord'
|
5
5
|
require 'thetvdb_party/client'
|
6
6
|
require 'thetvdb_party/searchseriesrecord'
|
7
|
+
require 'thetvdb_party/actor'
|
8
|
+
require 'thetvdb_party/banner'
|
7
9
|
require 'thetvdb_party/version'
|
10
|
+
require 'thetvdb_party/banner'
|
11
|
+
require 'thetvdb_party/actor'
|
8
12
|
|
9
13
|
# thetvdb_party gem root namespace
|
10
14
|
module TheTvDbParty
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'thetvdb_party'
|
3
|
+
|
4
|
+
describe 'Actor' do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@valid_actor = TheTvDbParty::Actor.new(nil,
|
8
|
+
{
|
9
|
+
"id" => "0"
|
10
|
+
}
|
11
|
+
)
|
12
|
+
@invalid_actor = TheTvDbParty::Actor.new(nil, { })
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should have an id when valid' do
|
16
|
+
expect @valid_actor.id == 0
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should have a negative id when invalid' do
|
20
|
+
expect @invalid_actor.id < 0
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should not instantiate when created without hash values' do
|
24
|
+
expect{TheTvDbParty::Actor.new(nil, nil)}.to raise_error
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'thetvdb_party'
|
3
|
+
|
4
|
+
describe 'Banner' do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@valid_banner = TheTvDbParty::Banner.new(nil,
|
8
|
+
{
|
9
|
+
"id" => "0"
|
10
|
+
}
|
11
|
+
)
|
12
|
+
@invalid_banner = TheTvDbParty::Banner.new(nil, { })
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should have an id when valid' do
|
16
|
+
expect @valid_banner.id == 0
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should have a negative id when invalid' do
|
20
|
+
expect @invalid_banner.id < 0
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should not instantiate when created without hash values' do
|
24
|
+
expect{TheTvDbParty::Banner.new(nil, nil)}.to raise_error
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'thetvdb_party'
|
3
|
+
|
4
|
+
describe 'BaseSeriesRecord' do
|
5
|
+
before(:each) do
|
6
|
+
@valid_record = TheTvDbParty::BaseSeriesRecord.new(nil,
|
7
|
+
{
|
8
|
+
"id" => "0"
|
9
|
+
}
|
10
|
+
)
|
11
|
+
@invalid_record = TheTvDbParty::BaseSeriesRecord.new(nil, { })
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should have valid id if valid" do
|
15
|
+
expect @valid_record.seriesid == 0
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should have negative id if series not found or invalid" do
|
19
|
+
expect @invalid_record.seriesid < 0
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
|
3
|
+
describe 'TheTvDbParty' do
|
4
|
+
client = TheTvDbParty::Client.new(ENV["TVDB_API_KEY"])
|
5
|
+
let(:search_series_records) { client.search "The Mentalist" }
|
6
|
+
|
7
|
+
it 'should find search results' do
|
8
|
+
# client = TheTvDbParty::Client.new(ENV["TVDB_API_KEY"])
|
9
|
+
# let(:results) { client.search "The Mentalist" }
|
10
|
+
expect(search_series_records).to_not be_nil
|
11
|
+
expect(search_series_records).to_not be_empty
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thetvdb_party
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fredrik Høisæther Rasch
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-02-
|
15
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: bundler
|
@@ -90,13 +90,20 @@ files:
|
|
90
90
|
- README.md
|
91
91
|
- Rakefile
|
92
92
|
- lib/thetvdb_party.rb
|
93
|
+
- lib/thetvdb_party/actor.rb
|
94
|
+
- lib/thetvdb_party/all.rb
|
95
|
+
- lib/thetvdb_party/banner.rb
|
93
96
|
- lib/thetvdb_party/baseepisoderecord.rb
|
94
97
|
- lib/thetvdb_party/baseseriesrecord.rb
|
95
98
|
- lib/thetvdb_party/client.rb
|
96
99
|
- lib/thetvdb_party/searchseriesrecord.rb
|
97
100
|
- lib/thetvdb_party/version.rb
|
98
101
|
- spec/spec_helper.rb
|
102
|
+
- spec/thetvdb_party/actor_spec.rb
|
103
|
+
- spec/thetvdb_party/banner_spec.rb
|
99
104
|
- spec/thetvdb_party/baseepisoderecord_spec.rb
|
105
|
+
- spec/thetvdb_party/baseseriesrecord_spec.rb
|
106
|
+
- spec/thetvdb_party_spec.rb
|
100
107
|
- thetvdb_party.gemspec
|
101
108
|
homepage: https://github.com/couven92/thetvdb_party
|
102
109
|
licenses:
|
@@ -129,5 +136,9 @@ specification_version: 4
|
|
129
136
|
summary: Ruby Gem for accessing the TheTVDB programmers API
|
130
137
|
test_files:
|
131
138
|
- spec/spec_helper.rb
|
139
|
+
- spec/thetvdb_party/actor_spec.rb
|
140
|
+
- spec/thetvdb_party/banner_spec.rb
|
132
141
|
- spec/thetvdb_party/baseepisoderecord_spec.rb
|
142
|
+
- spec/thetvdb_party/baseseriesrecord_spec.rb
|
143
|
+
- spec/thetvdb_party_spec.rb
|
133
144
|
has_rdoc:
|