em-tvdb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/em-tvdb/client.rb +12 -0
- data/lib/em-tvdb/version.rb +1 -1
- metadata +4 -4
data/lib/em-tvdb/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
1
3
|
require 'rest-core'
|
2
4
|
require 'eventmachine'
|
3
5
|
require 'nokogiri'
|
@@ -102,11 +104,21 @@ module EM
|
|
102
104
|
def episodes(serie_id, &block)
|
103
105
|
@client.get("/#{@api_key}/series/#{serie_id}/all/en.xml") do |xml|
|
104
106
|
episodes = xml.css('Episode').map do |ep|
|
107
|
+
aired_date = ep.content_node('FirstAired')
|
108
|
+
|
109
|
+
if aired_date.empty?
|
110
|
+
aired_date = nil
|
111
|
+
else
|
112
|
+
aired_date = Time.parse(aired_date)
|
113
|
+
end
|
114
|
+
|
115
|
+
|
105
116
|
Hashie::Mash.new(
|
106
117
|
:id => ep.content_node('id'),
|
107
118
|
:name => ep.content_node('EpisodeName'),
|
108
119
|
:episode_number => ep.content_node('EpisodeNumber').to_i,
|
109
120
|
:season_number => ep.content_node('SeasonNumber').to_i,
|
121
|
+
:aired_date => aired_date,
|
110
122
|
:overview => ep.content_node('Overview')
|
111
123
|
)
|
112
124
|
end
|
data/lib/em-tvdb/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-tvdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-core
|
@@ -124,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
segments:
|
126
126
|
- 0
|
127
|
-
hash:
|
127
|
+
hash: 2008332620068431795
|
128
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
129
|
none: false
|
130
130
|
requirements:
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
segments:
|
135
135
|
- 0
|
136
|
-
hash:
|
136
|
+
hash: 2008332620068431795
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
139
|
rubygems_version: 1.8.24
|