spot_tracks 0.0.3 → 0.0.4

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: ea05c75a301539b55e4561e21d06fa0a53fee7cc
4
- data.tar.gz: 811e8db11633bf3070c60f15b438a812885135ec
3
+ metadata.gz: 87ba8908127509416ab4ad0f69ec37639b0e587c
4
+ data.tar.gz: 22d6b68a94494f4181bfe441b3225da06a47c0ad
5
5
  SHA512:
6
- metadata.gz: 270fd7143b75ad4000fb008bb8019b8b688266436da8bebce608aea73ca07967eca2c5d4f2d9453712dd734ca2cdc5d8d359c92b0542f0010883a4d8f4eb0319
7
- data.tar.gz: c1faab71d9cd552e2a91367233b0bc5977e54dc53f649e98c71c99b3f8f7a355975063a48bb3c2312cf834759c5116bc133887b859a3b3652c568861cd110cae
6
+ metadata.gz: 3a48d2ecf46903f0cb479053524b255ab98d195dbdeedc3bcc6c95273316612e11e6d8af007867a03129c71966580bbb869f74c27004c8878fd2b1dad4aa2982
7
+ data.tar.gz: 9287079d9fbf4bbd6284f58dcd95c6a624514b374309df3a0b5e4351f86bb3fd45ddccaf84c2cec219ede152b4e80463816175973e46b49b1acd62ed5aa3a3d7
@@ -11,19 +11,26 @@ module SpotTracks
11
11
  end
12
12
 
13
13
  def title
14
+ return unless valid?
14
15
  client.title
15
16
  end
16
17
 
17
18
  def url
19
+ return unless valid?
18
20
  client.url
19
21
  end
20
22
 
21
23
  def tracks
24
+ return [] unless valid?
22
25
  client.entries.map do |entry|
23
26
  SpotTracks::Track.search entry.title
24
27
  end.compact
25
28
  end
26
29
 
30
+ def valid?
31
+ !!client
32
+ end
33
+
27
34
  def to_json
28
35
  {
29
36
  title: title,
@@ -35,7 +42,10 @@ module SpotTracks
35
42
  private
36
43
 
37
44
  def client
38
- @client ||= Feedjira::Feed.fetch_and_parse(rss_url)
45
+ @client ||= begin
46
+ feed = Feedjira::Feed.fetch_and_parse(rss_url)
47
+ feed.is_a?(Feedjira::Parser::RSS) ? feed : nil
48
+ end
39
49
  end
40
50
 
41
51
  def rss_url
@@ -1,3 +1,3 @@
1
1
  module SpotTracks
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spot_tracks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Werner
@@ -14,70 +14,70 @@ dependencies:
14
14
  name: simplecov
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.7'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2.13'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.13'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.6'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.6'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: feedjira
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.3'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.3'
83
83
  description: Get your recent Last.fm tracks with spotify links
@@ -87,8 +87,8 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
91
- - .rspec
90
+ - ".gitignore"
91
+ - ".rspec"
92
92
  - CHANGELOG.md
93
93
  - Gemfile
94
94
  - LICENSE.txt
@@ -117,17 +117,17 @@ require_paths:
117
117
  - lib
118
118
  required_ruby_version: !ruby/object:Gem::Requirement
119
119
  requirements:
120
- - - '>='
120
+ - - ">="
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - '>='
125
+ - - ">="
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
129
  rubyforge_project:
130
- rubygems_version: 2.2.0
130
+ rubygems_version: 2.2.2
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: A small gem to get recent spotify tracks