memo_rage 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,6 +14,10 @@ module MemoRage
14
14
  text.text
15
15
  end
16
16
  end
17
+
18
+ def parse_value(element, key)
19
+ element.elements.map { |e| e.has_name?(key) }.include?(true) ? element.elements[key].text : ""
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -16,26 +16,22 @@ module MemoRage
16
16
  entry.elements["Episodelist"].elements.each("Season") do |season|
17
17
  season_number += 1
18
18
  season.elements.each("episode") do |episode|
19
- if episode.elements["screencap"] == nil
20
- missing = episode.add_element "screencap"
21
- missing.add_text ""
22
- end
23
19
  episodes << MemoRage::Episode.new(
24
- :num => episode.elements["epnum"].text,
20
+ :num => parse_value(episode, "epnum"),
25
21
  :season => season_number,
26
- :season_num => episode.elements["seasonnum"].text,
27
- :prod_num => episode.elements["prodnum"].text,
28
- :airdate => episode.elements["airdate"].text,
29
- :link => episode.elements["link"].text,
30
- :title => episode.elements["title"].text,
31
- :rating => episode.elements["rating"].text,
32
- :image => episode.elements["screencap"].text
22
+ :season_num => parse_value(episode, "seasonnum"),
23
+ :prod_num => parse_value(episode, "prodnum"),
24
+ :airdate => parse_value(episode,"airdate"),
25
+ :link => parse_value(episode,"link"),
26
+ :title => parse_value(episode,"title"),
27
+ :rating => parse_value(episode,"rating"),
28
+ :image => parse_value(episode,"screencap")
33
29
  )
34
30
  end
35
31
  end
36
32
  MemoRage::Show.new(
37
- :name => entry.elements["name"].text,
38
- :seasons => entry.elements["totalseasons"].text.to_i,
33
+ :name => parse_value(entry, "name"),
34
+ :seasons => parse_value(entry, "totalseasons").to_i,
39
35
  :episodes => episodes
40
36
  )
41
37
  end
@@ -12,21 +12,21 @@ module MemoRage
12
12
 
13
13
  def parse_entry(entry)
14
14
  MemoRage::Show.new(
15
- :id => entry.elements["showid"].text.to_i,
16
- :name => entry.elements["showname"].text,
17
- :link => entry.elements["showlink"].text,
18
- :seasons => entry.elements["seasons"].text.to_i,
19
- :image => entry.elements["image"].text,
20
- :started => entry.elements["started"].text,
21
- :ended => entry.elements["ended"].text,
22
- :origin_country => entry.elements["origin_country"].text,
23
- :status => entry.elements["status"].text,
24
- :classification => entry.elements["classification"].text,
25
- :genres => form_array(entry.elements["genres"]),
26
- :runtime => entry.elements["runtime"].text.to_i,
27
- :airtime => entry.elements["airtime"].text,
28
- :airday => entry.elements["airday"].text,
29
- :timezone => entry.elements["timezone"].text
15
+ :id => parse_value(entry, "showid").to_i,
16
+ :name => parse_value(entry, "showname"),
17
+ :link => parse_value(entry, "showlink"),
18
+ :seasons => parse_value(entry, "seasons").to_i,
19
+ :image => parse_value(entry, "image"),
20
+ :started => parse_value(entry, "started"),
21
+ :ended => parse_value(entry, "ended"),
22
+ :origin_country => parse_value(entry, "origin_country"),
23
+ :status => parse_value(entry, "status"),
24
+ :classification => parse_value(entry, "classification"),
25
+ :genres => form_array(entry.elements["genres"]),
26
+ :runtime => parse_value(entry, "runtime").to_i,
27
+ :airtime => parse_value(entry, "airtime"),
28
+ :airday => parse_value(entry, "airday"),
29
+ :timezone => parse_value(entry, "timezone")
30
30
  )
31
31
  end
32
32
 
@@ -17,10 +17,10 @@ module MemoRage
17
17
 
18
18
  def parse_entry(entry)
19
19
  MemoRage::Show.new(
20
- :id => entry.elements["showid"].text.to_i,
21
- :name => entry.elements["name"].text
20
+ :id => parse_value(entry , "showid").to_i,
21
+ :name => parse_value(entry , "name")
22
22
  )
23
23
  end
24
24
  end
25
25
  end
26
- end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module MemoRage
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memo_rage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,12 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-03-12 00:00:00.000000000 +02:00
14
- default_executable:
13
+ date: 2012-03-12 00:00:00.000000000Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: httpclient
18
- requirement: &80528250 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
19
18
  none: false
20
19
  requirements:
21
20
  - - ! '>='
@@ -23,10 +22,15 @@ dependencies:
23
22
  version: 2.2.0.2
24
23
  type: :runtime
25
24
  prerelease: false
26
- version_requirements: *80528250
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 2.2.0.2
27
31
  - !ruby/object:Gem::Dependency
28
32
  name: hashie
29
- requirement: &80528000 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
30
34
  none: false
31
35
  requirements:
32
36
  - - ! '>='
@@ -34,10 +38,15 @@ dependencies:
34
38
  version: 1.1.0
35
39
  type: :runtime
36
40
  prerelease: false
37
- version_requirements: *80528000
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: 1.1.0
38
47
  - !ruby/object:Gem::Dependency
39
48
  name: rake
40
- requirement: &80527770 !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
41
50
  none: false
42
51
  requirements:
43
52
  - - ! '>='
@@ -45,10 +54,15 @@ dependencies:
45
54
  version: 0.8.7
46
55
  type: :development
47
56
  prerelease: false
48
- version_requirements: *80527770
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 0.8.7
49
63
  - !ruby/object:Gem::Dependency
50
64
  name: rspec
51
- requirement: &80527540 !ruby/object:Gem::Requirement
65
+ requirement: !ruby/object:Gem::Requirement
52
66
  none: false
53
67
  requirements:
54
68
  - - ! '>='
@@ -56,10 +70,15 @@ dependencies:
56
70
  version: '2'
57
71
  type: :development
58
72
  prerelease: false
59
- version_requirements: *80527540
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '2'
60
79
  - !ruby/object:Gem::Dependency
61
80
  name: webmock
62
- requirement: &80527310 !ruby/object:Gem::Requirement
81
+ requirement: !ruby/object:Gem::Requirement
63
82
  none: false
64
83
  requirements:
65
84
  - - ! '>='
@@ -67,10 +86,15 @@ dependencies:
67
86
  version: 1.6.2
68
87
  type: :development
69
88
  prerelease: false
70
- version_requirements: *80527310
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: 1.6.2
71
95
  - !ruby/object:Gem::Dependency
72
96
  name: timecop
73
- requirement: &80527080 !ruby/object:Gem::Requirement
97
+ requirement: !ruby/object:Gem::Requirement
74
98
  none: false
75
99
  requirements:
76
100
  - - ! '>='
@@ -78,7 +102,12 @@ dependencies:
78
102
  version: 0.3.5
79
103
  type: :development
80
104
  prerelease: false
81
- version_requirements: *80527080
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.3.5
82
111
  description: Find more information at https://github.com/appsbakery/memo_rage
83
112
  email:
84
113
  - aganov@gmail.com
@@ -113,7 +142,6 @@ files:
113
142
  - spec/mock_xml/show_info.xml
114
143
  - spec/mock_xml/show_search.xml
115
144
  - spec/spec_helper.rb
116
- has_rdoc: true
117
145
  homepage: ''
118
146
  licenses: []
119
147
  post_install_message:
@@ -134,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
162
  version: '0'
135
163
  requirements: []
136
164
  rubyforge_project: memo_rage
137
- rubygems_version: 1.6.2
165
+ rubygems_version: 1.8.18
138
166
  signing_key:
139
167
  specification_version: 3
140
168
  summary: Memo rage is an api wrapper for the http://services.tvrage.com/ The gem is