soundcloud-ruby-api-wrapper 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 8
4
+ :patch: 9
@@ -8,6 +8,9 @@ module Soundcloud
8
8
  # * resource_id
9
9
  # * comment/track/user (embedded resource, depending on type)
10
10
  #
11
+ # Custom Wrapper Attribute:
12
+ # * event_type (access to type attribute, since 'type' is a ruby keyword)
13
+ #
11
14
  # Look up the resource attributes and filtering usage here:
12
15
  #
13
16
  # http://wiki.github.com/soundcloud/api/documentation#event
@@ -25,9 +28,13 @@ module Soundcloud
25
28
  # sc_client.Event.find(:all)
26
29
  #
27
30
  class Event < Base
28
- #belongs_to :user, :track, :comment # this is not right
29
31
  cattr_accessor :element_name
30
32
  self.element_name = 'event'
33
+
34
+
35
+ def event_type
36
+ return attributes['type']
37
+ end
31
38
  end
32
39
  end
33
40
  end
@@ -1,6 +1,6 @@
1
1
  module Soundcloud
2
2
  module Models
3
- # Note: At the moment, you can't create or delete playlists via Soundcloud API
3
+ # Note: At the moment, you can't create or delete playlists or change their permissions via Soundcloud API
4
4
  #
5
5
  # SC API Attributes (as of 26/05/09):
6
6
  # * created_at
@@ -20,7 +20,6 @@ module Soundcloud
20
20
  #
21
21
  # Custom Wrapper Attributes/Methods:
22
22
  # * user
23
- # * permissions
24
23
  #
25
24
  # Look up the resource attributes and filtering usage here:
26
25
  #
@@ -29,16 +28,11 @@ module Soundcloud
29
28
  # Examples:
30
29
  #
31
30
  # # Find a Playlist and add a track to it
32
- # playlist = sc_client.Playlist('my-playlist')
33
- # track = sc_client.Track('my-track')
31
+ # playlist = sc_client.Playlist.find('my-playlist')
32
+ # track = sc_client.Track.find('my-track')
34
33
  # playlist.tracks << track
35
34
  # playlist.save
36
35
  #
37
- # # Allow a user to access this track
38
- # some_user = sc_client.User.find('some-user')
39
- # playlist.permissions << some_user
40
- # playlist.permissions.save
41
- #
42
36
  # # Delete first song in playlist
43
37
  # playlist.tracks.delete playlist.tracks.first
44
38
  # playlist.save
@@ -46,7 +40,7 @@ module Soundcloud
46
40
 
47
41
  class Playlist < Base
48
42
  belongs_to :user
49
- has_many :permissions
43
+ # has_many :permissions
50
44
  cattr_accessor :element_name
51
45
  self.element_name = 'playlist'
52
46
  def initialize(*args)
@@ -42,6 +42,8 @@ module Soundcloud
42
42
  #
43
43
  # Examples:
44
44
  #
45
+ # some_user = sc_client.User.find('some_user')
46
+ #
45
47
  # # gets 50 (Soundcloud API limit) tracks from some_user
46
48
  # some_user_tracks = some_user.tracks
47
49
  #
@@ -58,6 +60,10 @@ module Soundcloud
58
60
  # p "#{comment.user.username} #{timestamp}: #{comment.body}"
59
61
  # end
60
62
  #
63
+ # # downloads the original track file (track.downloadable must be true)
64
+ # # (the open call requires the 'open-uri' gem)
65
+ # downloaded_file = open first_song.download_url
66
+ #
61
67
  #
62
68
  # # gets 50 (Soundcloud API limit) tracks with a BPM <= 100
63
69
  # slow_tracks = sc_client.Track.find(:all, :params => { "bpm[to]" => "100"} )
@@ -69,19 +75,11 @@ module Soundcloud
69
75
  # new_track.sharing = 'private'
70
76
  # new_track.asset_data = File.new('some_sound_file.wav')
71
77
  # new_track.save
72
- #
73
- # # downloads the original soundfile.
74
- # #some_sound_file.wav and downloaded_file should be the same (the open call requires the 'open-uri' gem)
75
- # downloaded_file = open new_track.download_url
76
78
  #
77
79
  # # gives some_user permission to access the new_track
78
- # some_user = sc_client.User.find('some_user')
79
80
  # new_track.permissions << some_user
80
81
  # new_track.permissions.save
81
82
  #
82
- #
83
- #
84
- #
85
83
 
86
84
  class Track < Base
87
85
  belongs_to :user
@@ -12,8 +12,19 @@ describe 'Soundcloud::Models::Event' do
12
12
  events = @sc.Event.find(:all)
13
13
  end
14
14
 
15
- it 'should get a fan event and should provide the user resource' do
16
- fan_events = @sc.Event.find(:all,:params => {:type => 'Fan'})
17
- fan_events.first.user.username.should_not be nil
15
+ it 'should get fan events and they should provide the user resource' do
16
+ fan_events = @sc.Event.find(:all,:params => {:filter => 'fan'})
17
+ fan_events.each do |event|
18
+ event.event_type.should be == "Fan"
19
+ event.user.username.should_not be nil
20
+ end
21
+ end
22
+
23
+ it 'should get track events and they should provide the track resource' do
24
+ events = @sc.Event.find(:all,:params => {:filter => 'track'})
25
+ events.each do |event|
26
+ event.event_type.should be == "Track"
27
+ event.track.title.should_not be nil
28
+ end
18
29
  end
19
30
  end
@@ -11,7 +11,7 @@ require 'spec_helper'
11
11
  # api-test-2 follows api-test-1 and api-test-3
12
12
  # api-test-3 follows api-test-2 but NOT api-test-1
13
13
  #
14
- # api-test-2 has 3 Tracks [Track1 (downloadable),Track2,Track3]
14
+ # api-test-2 has 3 Tracks [Track1 (public,downloadable),Track2,Track3(private,downloadable)]
15
15
  # api-test-2 has favorites: Track1 but NOT Track2
16
16
  # api-test-2 has 'static-test-playlist' with Track1, 2 and 3
17
17
  #
@@ -62,7 +62,7 @@ describe "Soundcloud::Models::User" do
62
62
  @api_test_2.fans({:limit => 1}).count.should be == 1
63
63
  @api_test_2.fans({:limit => 2}).count.should be == 2
64
64
  end
65
-
65
+
66
66
  end
67
67
 
68
68
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soundcloud-ruby-api-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Wagener
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-27 00:00:00 -07:00
12
+ date: 2009-05-28 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency