rdio 0.0.93 → 0.0.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/rdio/api.rb CHANGED
@@ -121,17 +121,19 @@ module Rdio
121
121
  end
122
122
 
123
123
  # Get the albums in the user's collection by a particular artist.
124
- def getAlbumsForArtistInCollection(artist,user=nil)
124
+ def getAlbumsForArtistInCollection(artist,user=nil,extras=nil)
125
125
  method = 'getAlbumsForArtistInCollection'
126
126
  type = Album
127
127
  args = {:artist=>artist}
128
128
  args[:user] = user if user
129
+ args[:extras] = extras if extras
129
130
  auth = !!user
130
131
  return_object type,method,args,auth
131
132
  end
132
133
 
133
134
  # Get all of the albums in the user's collection.
134
- def getAlbumsInCollection(user=nil,start=nil,count=nil,sort=nil,query=nil)
135
+ def getAlbumsInCollection(user=nil,start=nil,count=nil,
136
+ sort=nil,query=nil,extras=nil)
135
137
  method = 'getAlbumsInCollection'
136
138
  type = Album
137
139
  args = {}
@@ -140,12 +142,14 @@ module Rdio
140
142
  args[:count] = count if count
141
143
  args[:sort] = sort if sort
142
144
  args[:query] = query if query
145
+ args[:extras] = extras if extras
143
146
  auth = !!user
144
147
  return_object type,method,args,auth
145
148
  end
146
149
 
147
150
  # Get all of the artist in a user's collection.
148
- def getArtistsInCollection(user=nil,start=nil,count=nil,sort=nil,query=nil)
151
+ def getArtistsInCollection(user=nil,start=nil,count=nil,sort=nil,
152
+ query=nil,extras=nil)
149
153
  method = 'getArtistsInCollection'
150
154
  type = Artist
151
155
  args = {}
@@ -154,13 +158,14 @@ module Rdio
154
158
  args[:count] = count if count
155
159
  args[:sort] = sort if sort
156
160
  args[:query] = query if query
161
+ args[:extras] = extras if extras
157
162
  auth = !!user
158
163
  return_object type,method,args,auth
159
164
  end
160
165
 
161
166
  # Find the most popular artists or albums for a user, their friends
162
167
  # or the whole site.
163
- def getHeavyRotation(user=nil,type=nil,friends=nil,limit=nil)
168
+ def getHeavyRotation(user=nil,type=nil,friends=nil,limit=nil,extras=nil)
164
169
  method = 'getHeavyRotation'
165
170
  cls = TODO
166
171
  if type == 'artist'
@@ -173,6 +178,7 @@ module Rdio
173
178
  args[:type] = type if type
174
179
  args[:friends] = friends if friends
175
180
  args[:limit] = limit if limit
181
+ args[:extras] = extras if extras
176
182
  return_object cls,method,args
177
183
  end
178
184
 
@@ -276,7 +282,7 @@ module Rdio
276
282
  end
277
283
 
278
284
  # Get all of the tracks in the user's collection.
279
- def getTracksInCollection(user=nil,start=nil,count=nil,sort=nil,query=nil)
285
+ def getTracksInCollection(user=nil,start=nil,count=nil,sort=nil,query=nil,extras=nil)
280
286
  method = 'getTracksInCollection'
281
287
  type = Track
282
288
  args = {}
@@ -285,6 +291,7 @@ module Rdio
285
291
  args[:count] = count if count
286
292
  args[:sort] = sort if sort
287
293
  args[:query] = query if query
294
+ args[:extras] = extras if extras
288
295
  return_object type,method,args
289
296
  end
290
297
 
@@ -310,7 +317,41 @@ module Rdio
310
317
  type = TODO
311
318
  args = {:playlist=>playlist,:index=>index,
312
319
  :count=>count,:tracks=>Rdio::keys(tracks)}
313
- return_object type,method,args,truex
320
+ return_object type,method,args,true
321
+ end
322
+
323
+ # Start or stop collaborating on this playlist.
324
+ def setPlaylistCollaborating(playlist,collaborating)
325
+ method = 'setPlaylistCollaborating'
326
+ type = Boolean
327
+ args = {:playlist=>playlist,:collaborating=>collaborating}
328
+ return_object type,method,args,true
329
+ end
330
+
331
+ # Start or stop collaborating on this playlist.
332
+ def setPlaylistCollaborationMode(playlist,mode)
333
+ method = 'setPlaylistCollaborationMode'
334
+ type = Boolean
335
+ args = {:playlist=>playlist,:mode=>mode}
336
+ return_object type,method,args,true
337
+ end
338
+
339
+ # Saves the given order of tracks in a given playlist. The new
340
+ # order must have the same tracks as the previous order (this
341
+ # method may not be used to add/remove tracks).
342
+ def setPlaylistOrder(playlist,tracks)
343
+ method = 'setPlaylistOrder'
344
+ type = Boolean
345
+ args = {:playlist=>playlist,:tracks=>Rdio::keys(tracks)}
346
+ return_object type,method,args,true
347
+ end
348
+
349
+ # Sets the name and description for a playlist.
350
+ def setPlaylistFields(playlist,name,description)
351
+ method = 'setPlaylistFields'
352
+ type = Boolean
353
+ args = {:playlist=>playlist,:name=>name,:description=>description}
354
+ return_object type,method,args,true
314
355
  end
315
356
 
316
357
  # Search for artists, albums, tracks, users or all kinds of objects.
data/lib/rdio/base.rb CHANGED
@@ -80,6 +80,9 @@ module Rdio
80
80
  # values in 'objs'. We also remove the nils from the input array.
81
81
  #
82
82
  def keys(objs)
83
+ if objs.instance_of? String
84
+ objs = objs.split /,/
85
+ end
83
86
  (not objs) ? '' : objs.compact.map {|x| x.to_k}.join(',')
84
87
  end
85
88
 
data/lib/rdio/types.rb CHANGED
@@ -165,14 +165,14 @@ module Rdio
165
165
  end
166
166
 
167
167
  # Get the albums in the user's collection by a particular artist.
168
- def self.for_artist_in_collection(artist,user=nil)
169
- Rdio::api.getAlbumsForArtistInCollection artist,user
168
+ def self.for_artist_in_collection(artist,user=nil,extras=nil)
169
+ Rdio::api.getAlbumsForArtistInCollection artist,user,extras
170
170
  end
171
171
 
172
172
  # Get all of the albums in the user's collection.
173
173
  def self.in_collection(user=nil,start=nil,count=nil,
174
- sort=nil,query=nil)
175
- Rdio::api.getAlbumsInCollection user,start,count,sort,query
174
+ sort=nil,query=nil,extras=nil)
175
+ Rdio::api.getAlbumsInCollection user,start,count,sort,query,extras
176
176
  end
177
177
 
178
178
  # Return new albums released across a timeframe.
@@ -267,8 +267,9 @@ module Rdio
267
267
  end
268
268
 
269
269
  # Get all of the tracks in the user's collection.
270
- def self.in_collection(user=nil,start=nil,count=nil,sort=nil,query=nil)
271
- Rdio::api.getTracksInCollection user,start,count,sort,query
270
+ def self.in_collection(user=nil,start=nil,count=nil,
271
+ sort=nil,query=nil,extras=nil)
272
+ Rdio::api.getTracksInCollection user,start,count,sort,query,extras
272
273
  end
273
274
 
274
275
  # Get all of the tracks by this artist.
@@ -388,6 +389,28 @@ module Rdio
388
389
  Rdio::api.getTopCharts Playlist
389
390
  end
390
391
 
392
+ # Start or stop collaborating on this playlist.
393
+ def collaborating=(collaborating)
394
+ Rdio::api.setPlaylistCollaborating self,collaborating
395
+ end
396
+
397
+ # Start or stop collaborating on this playlist.
398
+ def collaboration_mode=(mode)
399
+ Rdio::api.setPlaylistCollaborationMode self,mode
400
+ end
401
+
402
+ # Saves the given order of tracks in a given playlist. The new
403
+ # order must have the same tracks as the previous order (this
404
+ # method may not be used to add/remove tracks).
405
+ def order=(tracks)
406
+ Rdio::api.setPlaylistOrder self,tracks
407
+ end
408
+
409
+ # Sets the name and description for a playlist.
410
+ def set_fields(name,description)
411
+ Rdio::api.setPlaylistFields self,name,description
412
+ end
413
+
391
414
  end
392
415
 
393
416
  # ----------------------------------------------------------------------
@@ -477,8 +500,9 @@ module Rdio
477
500
  end
478
501
 
479
502
  # Get all of the artist in a user's collection.
480
- def artists_in_collection(start=nil,count=nil,sort=nil,query=nil)
481
- api.getArtistsInCollection self,start,count,sort,query
503
+ def artists_in_collection(start=nil,count=nil,sort=nil,
504
+ query=nil,extras=nil)
505
+ api.getArtistsInCollection self,start,count,sort,query,extras
482
506
  end
483
507
 
484
508
  # Which tracks from the given artist are in the user's collection.
@@ -487,8 +511,8 @@ module Rdio
487
511
  end
488
512
 
489
513
  # Get all of the tracks in the user's collection.
490
- def tracks_in_collection(start=nil,count=nil,sort=nil,query=nil)
491
- api.getTracksInCollection self,start,count,sort,query
514
+ def tracks_in_collection(start=nil,count=nil,sort=nil,query=nil,extras=nil)
515
+ api.getTracksInCollection self,start,count,sort,query,extras
492
516
  end
493
517
 
494
518
  # Which tracks on the given album are in the user's collection.
@@ -538,8 +562,8 @@ module Rdio
538
562
 
539
563
  # Find the most popular artists or albums for a user, their
540
564
  # friends or the whole site.
541
- def heavy_rotation(friends=nil,limit=nil)
542
- api.getHeavyRotation self,nil,friends,limit
565
+ def heavy_rotation(friends=nil,limit=nil,extras=nil)
566
+ api.getHeavyRotation self,nil,friends,limit,extras
543
567
  end
544
568
 
545
569
  # Find the most popular artists for a user, their friends or the
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdio
3
3
  version: !ruby/object:Gem::Version
4
- hash: 165
4
+ hash: 163
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 93
10
- version: 0.0.93
9
+ - 94
10
+ version: 0.0.94
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeffrey Palm
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-22 00:00:00 -04:00
18
+ date: 2011-07-03 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency