rscrobbler 0.0.1 → 0.0.2

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/lib/lastfm/track.rb +10 -2
  2. data/lib/rscrobbler.rb +1 -1
  3. metadata +3 -3
data/lib/lastfm/track.rb CHANGED
@@ -82,9 +82,17 @@ module LastFM
82
82
  end
83
83
 
84
84
  # @see http://www.last.fm/api/show?service=443
85
- def scrobble( tracks, artists, timestamps, albums = nil, album_artists = nil, contexts = nil, stream_ids = nil, track_numbers = nil, mbids = nil, durations = nil )
85
+ def scrobble( tracks, artists, timestamps, albums = nil, album_artists = nil, contexts = nil, stream_ids = nil, track_numbers = nil, mbids = nil, durations = nil, chosen_by_users = nil )
86
86
  LastFM.requires_authentication
87
- # Requires complicated logic & HTTP POST
87
+ params = {}
88
+ %w[tracks artists timestamps albums album_artists contexts stream_ids track_numbers mbids durations chosen_by_users].each{|var|
89
+ camel_var = var.chomp('s').split('_').map{|a| a.capitalize}.join
90
+ camel_var = camel_var[0, 1].downcase + camel_var[1..-1]
91
+ Array(eval(var)).each_with_index{|val, i|
92
+ params["#{camel_var}[#{i}]"] = val
93
+ }
94
+ }
95
+ LastFM.post( "#{TYPE}.scrobble", params )
88
96
  end
89
97
 
90
98
  # @see http://www.last.fm/api/show?service=286
data/lib/rscrobbler.rb CHANGED
@@ -22,7 +22,7 @@ require 'lastfm/user'
22
22
  require 'lastfm/venue'
23
23
 
24
24
  module LastFM
25
- VERSION = '0.0.1'
25
+ VERSION = '0.0.2'
26
26
 
27
27
  HOST = 'ws.audioscrobbler.com'
28
28
  POST_URI = URI.parse("http://#{HOST}/2.0/")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rscrobbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: libxml-ruby
16
- requirement: &2160394600 !ruby/object:Gem::Requirement
16
+ requirement: &2165660740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2160394600
24
+ version_requirements: *2165660740
25
25
  description: rscrobbler is a Ruby gem for accessing Last.fm's API (http://www.last.fm/api).
26
26
  email:
27
27
  - sgt.floydpepper@gmail.com