rockstar 0.4.0 → 0.4.1

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/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  # Rakefile
2
2
  require 'rubygems'
3
3
  require 'rake'
4
- require 'lib/rockstar/version'
4
+ require File.expand_path('../lib/rockstar/version', __FILE__)
5
5
 
6
6
  begin
7
7
  require 'jeweler'
@@ -19,3 +19,14 @@ begin
19
19
  rescue LoadError
20
20
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
21
21
  end
22
+
23
+ require 'rake/testtask'
24
+ Rake::TestTask.new(:test) do |test|
25
+ test.libs << 'lib' << 'test'
26
+ test.pattern = 'test/**/test_*.rb'
27
+ test.verbose = true
28
+ end
29
+
30
+ task :test => :check_dependencies
31
+
32
+ task :default => :test
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -2,6 +2,10 @@
2
2
 
3
3
  $: << File.expand_path(File.dirname(__FILE__))
4
4
 
5
+ require 'rubygems'
6
+ require 'active_record'
7
+ require 'time'
8
+
5
9
  require 'rockstar/base'
6
10
  require 'rockstar/version'
7
11
 
@@ -75,7 +75,7 @@ module Rockstar
75
75
  def load_info
76
76
  doc = self.class.fetch_and_parse("album.getInfo", {:artist => @artist, :album =>@name})
77
77
  @url = Base.fix_url((doc).at(:url).inner_html)
78
- @release_date = Time.parse((doc).at(:releasedate).inner_html.strip)
78
+ @release_date = Base.parse_time((doc).at(:releasedate).inner_html.strip)
79
79
 
80
80
  @images = {}
81
81
  (doc/'image').each {|image|
@@ -12,6 +12,7 @@ module Rockstar
12
12
  def fetch_and_parse(resource, params = {}, sign_request = false)
13
13
  Hpricot::XML(connection.get(resource, sign_request, params))
14
14
  end
15
+
15
16
  end
16
17
 
17
18
  private
@@ -33,5 +34,10 @@ module Rockstar
33
34
  end
34
35
  url
35
36
  end
37
+
38
+ def self.parse_time(time_str)
39
+ return nil if time_str.blank?
40
+ Time.parse(time_str)
41
+ end
36
42
  end
37
43
  end
@@ -22,8 +22,8 @@ module Rockstar
22
22
  e.headliners << h.inner_html
23
23
  }
24
24
 
25
- e.start_date = Time.parse(xml.search("/startDate").inner_html.strip)
26
- e.end_date = Time.parse(xml.search("/endDate").inner_html.strip)
25
+ e.start_date = Base.parse_time(xml.search("/startDate").inner_html.strip)
26
+ e.end_date = Base.parse_time(xml.search("/endDate").inner_html.strip)
27
27
  e.description = xml.search("/description").inner_html.strip
28
28
  e.attendance = xml.search("/attendance").inner_html.strip.to_i
29
29
  e.reviews = xml.search("/reviews").inner_html.strip.to_i
@@ -25,7 +25,7 @@ module Rockstar
25
25
  #
26
26
  # = Get the session token
27
27
  # 1. Use the previous token and call
28
- # new Rockstar::Auth.new.session(token)
28
+ # session = Rockstar::Auth.new.session(token)
29
29
  # 2. Store the session.key and session.username returned. The session.key will not
30
30
  # expire. It is save to store it into your database.
31
31
  # 3. Use this session.key as token to authentificate with this class :
@@ -65,7 +65,7 @@ module Rockstar
65
65
  t.count = xml['count'] if xml['count']
66
66
  t.album = (xml).at(:album).inner_html if (xml).at(:album)
67
67
  t.album_mbid = (xml).at(:album)['mbid'] if (xml).at(:album) && (xml).at(:album)['mbid']
68
- t.date = Time.parse((xml).at(:date).inner_html) if (xml).at(:date)
68
+ t.date = Base.parse_time((xml).at(:date).inner_html) if (xml).at(:date)
69
69
  t.date_uts = (xml).at(:date)['uts'] if (xml).at(:date) && (xml).at(:date)['uts']
70
70
 
71
71
  t.images = {}
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rockstar}
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bodo Tasche"]
12
- s.date = %q{2010-07-30}
12
+ s.date = %q{2010-08-11}
13
13
  s.description = %q{This gem is an updated version of jnunemakers scrobbler gem. Rockstar uses v2.0 of the last.fm api.}
14
14
  s.email = %q{bodo@bitboxer.de}
15
15
  s.extra_rdoc_files = [
@@ -27,11 +27,9 @@ module Rockstar
27
27
  end
28
28
 
29
29
  elsif @base_url == Rockstar::AUTH_URL
30
-
31
30
  # Test Simple Auth
32
31
  if args[:hs] == "true" && args[:p] == Rockstar::AUTH_VER.to_s && args[:c] == 'rbs' &&
33
- args[:v] == Rockstar::Version.to_s && args[:u] == 'chunky' && !args[:t].blank? &&
34
- args[:a] == Digest::MD5.hexdigest('7813258ef8c6b632dde8cc80f6bda62f' + args[:t])
32
+ args[:v] == Rockstar::Version.to_s && args[:u] == 'chunky' && !args[:t].blank?
35
33
 
36
34
  "OK\n#{@session_id}\n#{@now_playing_url}\n#{@submission_url}"
37
35
 
@@ -1,6 +1,7 @@
1
1
  require 'test/unit'
2
- require File.dirname(__FILE__) + '/../lib/rockstar'
3
- require File.dirname(__FILE__) + '/mocks/rest'
2
+
3
+ require File.expand_path('../../lib/rockstar', __FILE__)
4
+ require File.expand_path('..//mocks/rest', __FILE__)
4
5
 
5
6
  class << Test::Unit::TestCase
6
7
  def test(name, &block)
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
1
+ require File.expand_path('../../test_helper.rb', __FILE__)
2
2
 
3
3
  class TestAlbum < Test::Unit::TestCase
4
4
  def setup
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
1
+ require File.expand_path('../../test_helper.rb', __FILE__)
2
2
 
3
3
  class TestArtist < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
1
+ require File.expand_path('../../test_helper.rb', __FILE__)
2
2
 
3
3
  class TestChart < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
1
+ require File.expand_path('../../test_helper.rb', __FILE__)
2
2
 
3
3
  class TestGeo < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
1
+ require File.expand_path('../../test_helper.rb', __FILE__)
2
2
 
3
3
  class TestPlaying < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
1
+ require File.expand_path('../../test_helper.rb', __FILE__)
2
2
 
3
3
  class TestScrobble < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
1
+ require File.expand_path('../../test_helper.rb', __FILE__)
2
2
 
3
3
  class TestSimpleAuth < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
1
+ require File.expand_path('../../test_helper.rb', __FILE__)
2
2
 
3
3
  class TestTag < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
1
+ require File.expand_path('../../test_helper.rb', __FILE__)
2
2
 
3
3
  class TestTokenAuth < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
1
+ require File.expand_path('../../test_helper.rb', __FILE__)
2
2
 
3
3
  class TestTrack < Test::Unit::TestCase
4
4
 
@@ -1,4 +1,5 @@
1
- require File.dirname(__FILE__) + '/../test_helper.rb'
1
+ # encoding: utf-8
2
+ require File.expand_path('../../test_helper.rb', __FILE__)
2
3
 
3
4
  class TestUser < Test::Unit::TestCase
4
5
 
@@ -278,7 +279,8 @@ class TestUser < Test::Unit::TestCase
278
279
  assert_equal("http://userserve-ak.last.fm/serve/252/3608276.jpg", first.images["extralarge"])
279
280
 
280
281
  assert_equal("Innenstadt", first.venue.name)
281
- assert_equal("Köln", first.venue.city)
282
+
283
+ assert_equal("Köln", first.venue.city.mb_chars)
282
284
  assert_equal("Germany", first.venue.country)
283
285
  assert_equal("Street", first.venue.street)
284
286
  assert_equal("12345", first.venue.postalcode)
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rockstar
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 4
9
- - 0
10
- version: 0.4.0
8
+ - 1
9
+ version: 0.4.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - Bodo Tasche
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-07-30 00:00:00 +02:00
17
+ date: 2010-08-11 00:00:00 +02:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 163
30
28
  segments:
31
29
  - 0
32
30
  - 4
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ">="
44
42
  - !ruby/object:Gem::Version
45
- hash: 3
46
43
  segments:
47
44
  - 1
48
45
  - 4
@@ -158,7 +155,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
158
155
  requirements:
159
156
  - - ">="
160
157
  - !ruby/object:Gem::Version
161
- hash: 3
162
158
  segments:
163
159
  - 0
164
160
  version: "0"
@@ -167,7 +163,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
163
  requirements:
168
164
  - - ">="
169
165
  - !ruby/object:Gem::Version
170
- hash: 3
171
166
  segments:
172
167
  - 0
173
168
  version: "0"