rdio 0.0.6 → 0.0.7

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.
Files changed (3) hide show
  1. data/README +14 -8
  2. data/lib/rdio/base.rb +22 -22
  3. metadata +4 -4
data/README CHANGED
@@ -9,16 +9,22 @@ This is a ruby implementation of the rd.io API here:
9
9
 
10
10
  * USAGE
11
11
 
12
- To use it you have to get an api key and secret here:
12
+ See the exmples for usage. You first must obtain a consumer
13
+ key/secret pair described here:
13
14
 
14
- And then, currently, you can do something like the following:
15
+ http:/developer.rdio.com
15
16
 
16
- key = <RDIO_KEY>
17
- secret = <RDIO_SECRET>
18
- Rdio::init key,sec
19
- user = Rdio::User.find_by_email 'jeff@jeffpalm.com'
20
- 'Jeffrey' == user.first_name
21
- 'Palm' == user.last_name
17
+ You can user the 'rdio-call' script (strikingly similar to rdio's
18
+ python one) for exploring the api. Pass '-h' argument to rdio-call to
19
+ see the options. Here's an example:
20
+
21
+ % ./rdio-call get keys=t7609753 -i
22
+ {
23
+ "result": {
24
+ "t7609753": {
25
+ "artist": "Mogwai",
26
+ "name": "White Noise",
27
+ ....
22
28
 
23
29
 
24
30
  * TODO
data/lib/rdio/base.rb CHANGED
@@ -50,27 +50,6 @@ module Rdio
50
50
  end
51
51
  s
52
52
  end
53
-
54
- # hash -> hash
55
- #
56
- # Uses the value of 'to_k' for all the iput hash values in the
57
- # result hash. This is used to make sure that the arguments passed
58
- # to create urls use keys for the values of objects like Artist,
59
- # Track, etc. Also, we use the simple name of classes.
60
- #
61
- def convert_args(args)
62
- return nil if not args
63
- res = {}
64
- args.each do |k,v|
65
- if v.is_a? Array
66
- v = keys v
67
- else
68
- v = v.to_k
69
- end
70
- res[k] = v
71
- end
72
- return res
73
- end
74
53
 
75
54
  # array -> string
76
55
  #
@@ -257,11 +236,32 @@ module Rdio
257
236
  @oauth.get_pin
258
237
  end
259
238
 
239
+ # hash -> hash
240
+ #
241
+ # Uses the value of 'to_k' for all the iput hash values in the
242
+ # result hash. This is used to make sure that the arguments passed
243
+ # to create urls use keys for the values of objects like Artist,
244
+ # Track, etc. Also, we use the simple name of classes.
245
+ #
246
+ def self.convert_args(args)
247
+ return nil if not args
248
+ res = {}
249
+ args.each do |k,v|
250
+ if v.is_a? Array
251
+ v = keys v
252
+ else
253
+ v = v.to_k
254
+ end
255
+ res[k] = v
256
+ end
257
+ return res
258
+ end
259
+
260
260
  def call(method,args,requires_auth=false)
261
261
  #
262
262
  # Convert object with keys just to use their keys
263
263
  #
264
- args = convert_args args
264
+ args = BaseApi.convert_args args
265
265
  if Rdio::log_methods
266
266
  Rdio::log "Called method: #{method}(#{args}) : auth=#{requires_auth}"
267
267
  end
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: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
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-03-23 00:00:00 -04:00
18
+ date: 2011-03-25 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency