songsterr 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,10 @@ module Songsterr
11
11
  @data[key.to_s.camelize(:lower)]
12
12
  end
13
13
 
14
+ def attachment_url(key)
15
+ info(key)['attachmentUrl']
16
+ end
17
+
14
18
  def method_missing(method, *args, &block)
15
19
  info(method) or raise NoMethodError, "Method or attribute '#{method}' not exists on #{self.class.name}."
16
20
  end
@@ -4,16 +4,16 @@ module Songsterr
4
4
  module Data
5
5
  class SongRevision < Base
6
6
 
7
- def most_popular_track
8
- tracks.select {|track| track.id == info(:most_popular_track)['id'] }.first
9
- end
10
-
11
7
  def tracks
12
8
  @tracks ||= info(:tracks).collect {|data| Track.new(data) }
13
9
  end
14
10
 
11
+ def most_popular_track
12
+ tracks.select {|track| track.id == info(:most_popular_track)['id'] }.first
13
+ end
14
+
15
15
  def guitar_pro_tab
16
- @guitar_pro_url ||= info(:guitar_pro_tab)['attachmentUrl']
16
+ @guitar_pro_url ||= attachment_url(:guitar_pro_tab)
17
17
  end
18
18
 
19
19
  end
@@ -14,8 +14,9 @@ module Songsterr
14
14
  @instrument ||= Instrument.new(info(:instrument))
15
15
  end
16
16
 
17
- def audios
17
+ def audio(speed=100)
18
18
  @audios ||= info(:track_audios).collect {|data| TrackAudio.new(data) }
19
+ @audios.select {|audio| audio.speed == speed }.first
19
20
  end
20
21
 
21
22
  def layout_images
@@ -1,6 +1,11 @@
1
1
  module Songsterr
2
2
  module Data
3
3
  class TrackAudio < Base
4
+
5
+ def mp3_file
6
+ attachment_url(:mp3_file)
7
+ end
8
+
4
9
  end
5
10
  end
6
11
  end
@@ -1,6 +1,15 @@
1
1
  module Songsterr
2
2
  module Data
3
3
  class TrackLayoutImage < Base
4
+
5
+ def image
6
+ attachment_url(:image)
7
+ end
8
+
9
+ def timeline_map
10
+ attachment_url(:timeline_map)
11
+ end
12
+
4
13
  end
5
14
  end
6
15
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: songsterr
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: "0.1"
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Endel Dreyer