tvdb2 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tvdb2/episode.rb +13 -0
- data/lib/tvdb2/series.rb +19 -0
- data/lib/tvdb2/version.rb +1 -1
- metadata +1 -2
- data/test.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35acac1f19d387fe8bb928969a6d5b136b550eec
|
4
|
+
data.tar.gz: 8b659ccbe41cacf0a45b790cb6fc266f01ae796c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c5ecad7942fcba9300e5329361c9b104de5093ce18afbdc9082552154a2124cb4d0c9c5b4fb81dbc520386e88f86c9f55ebcbc12e6f0701eb27b0538cd143ba
|
7
|
+
data.tar.gz: 49f11f181082b805ca7141da68872c89244241ef766d1fd1dbb60bfb2cb9e80351c3a360f96c3f04ecaa74ea0dab933a9bf7ab1227da5538cf51543b490577da
|
data/lib/tvdb2/episode.rb
CHANGED
@@ -79,6 +79,19 @@ module Tvdb2
|
|
79
79
|
"#{self.airedSeason}x#{self.airedEpisodeNumber}"
|
80
80
|
end
|
81
81
|
|
82
|
+
# @param [Boolean] retrieve_all_fields if true retrieve all fields
|
83
|
+
# (from api) of the episode.
|
84
|
+
# @return [Hash] the episode to hash.
|
85
|
+
def to_h(retrieve_all_fields: false)
|
86
|
+
get_all_fields! if retrieve_all_fields
|
87
|
+
hash = {}
|
88
|
+
FIELDS.each do |field|
|
89
|
+
hash[field.to_sym] = instance_variable_get("@#{field}")
|
90
|
+
end
|
91
|
+
hash[:name] = @episodeName
|
92
|
+
return hash
|
93
|
+
end
|
94
|
+
|
82
95
|
private
|
83
96
|
|
84
97
|
# Get all data fields for this episode. Calling api endpoint `GET
|
data/lib/tvdb2/series.rb
CHANGED
@@ -74,6 +74,7 @@ module Tvdb2
|
|
74
74
|
def series_summary
|
75
75
|
@client.series_summary(self.id)
|
76
76
|
end
|
77
|
+
alias_method :summary, :series_summary
|
77
78
|
|
78
79
|
# Retrieve the episodes of the series.
|
79
80
|
#
|
@@ -206,6 +207,24 @@ module Tvdb2
|
|
206
207
|
|
207
208
|
# @!endgroup
|
208
209
|
|
210
|
+
# @param [Boolean] episodes if true include all episodes
|
211
|
+
# ({Episode#to_h}) on the hash.
|
212
|
+
# @param [Boolean] retrieve_all_fields if true retrieve all fields
|
213
|
+
# (from api) of the series.
|
214
|
+
# @return [Hash] the series to hash.
|
215
|
+
def to_h(episodes: false, retrieve_all_fields: false)
|
216
|
+
get_all_fields! if retrieve_all_fields
|
217
|
+
hash = {}
|
218
|
+
FIELDS.each do |field|
|
219
|
+
hash[field.to_sym] = instance_variable_get("@#{field}")
|
220
|
+
end
|
221
|
+
hash[:name] = @seriesName
|
222
|
+
hash[:poster_url] = self.poster_url
|
223
|
+
hash[:banner_url] = self.banner_url
|
224
|
+
hash[:episodes] = self.episodes.map(&:to_h) if episodes
|
225
|
+
return hash
|
226
|
+
end
|
227
|
+
|
209
228
|
private
|
210
229
|
|
211
230
|
# Get all data fields for this series. Calling api endpoint `GET
|
data/lib/tvdb2/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tvdb2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pioz
|
@@ -102,7 +102,6 @@ files:
|
|
102
102
|
- lib/tvdb2/series.rb
|
103
103
|
- lib/tvdb2/tvdb_struct.rb
|
104
104
|
- lib/tvdb2/version.rb
|
105
|
-
- test.rb
|
106
105
|
- tvdb2.gemspec
|
107
106
|
homepage: https://github.com/pioz/tvdb2
|
108
107
|
licenses:
|